XLPack 7.0
XLPack Numerical Library (Excel VBA) Reference Manual
Loading...
Searching...
No Matches

◆ Dsbtrd()

Sub Dsbtrd ( Vect As  String,
Uplo As  String,
N As  Long,
Kd As  Long,
Ab() As  Double,
D() As  Double,
E() As  Double,
Q() As  Double,
Info As  Long 
)

Reduces a real symmetric band matrix to tridiagonal form

Purpose
This routine reduces a real symmetric band matrix A to real symmetric tridiagonal form T by an orthogonal similarity transformation: Q^T * A * Q = T.
Parameters
[in]Vect= "N": Do not form Q.
= "V": Form Q.
= "U": Update a matrix X, by forming X*Q.
[in]Uplo= "U": Upper triangle of A is stored.
= "L": Lower triangle of A is stored.
[in]NOrder of the matrix A. (N >= 0) (If N = 0, returns without computation)
[in]KdNumber of superdiagonals of the matrix A if Uplo = "U" or number of subdiagonals if Uplo = "L". (Kd >= 0)
[in,out]Ab()Array Ab(LAb1 - 1, LAb2 - 1) (LAb1 >= Kd + 1, LAb2 >= N)
[in] The upper or lower triangle of the symmetric band matrix A, stored in the first Kd + 1 rows of the array. The j-th column of A is stored in the j-th column of the array Ab() as follows.
Uplo = "U": ab[j][Kd + i - j] = A(i, j) for max(0, j - Kd - 1) <= i <= j <= N - 1.
Uplo = "L": ab[j][i - j] = A(i, j) for 0 <= j <= i <= min(N - 1, j + Kd - 1).
[out] The diagonal elements of Ab() are overwritten by the diagonal elements of the tridiagonal matrix T. If Kd > 0, the elements on the first superdiagonal (if Uplo = "U") or the first subdiagonal (if Uplo = "L") are overwritten by the off-diagonal elements of T. The rest of Ab() is overwritten by values generated during the reduction.
[out]D()Array D(LD - 1) (LD >= N)
The diagonal elements of the tridiagonal matrix T: D(i) = Tii.
[out]E()Array E(LE - 1) (LE >= N - 1)
The off-diagonal elements of the tridiagonal matrix T: E(i) = T(i+1, i) if Uplo = "U", E(i) = T(i, i+1) if Uplo = "L".
[in,out]Q()Array Q(LQ1 - 1, LQ2 - 1) (LQ1 >= N, LQ2 >= N)
[in] If Vect = "U", then Q() must contain an N x N matrix X. If Vect = "N" or "V", then Q() need not be set.
[out] If Vect = "V", Q() contains the N x N orthogonal matrix Q. If Vect = "U", Q() contains the product X*Q. If Vect = "N", the array Q() is not referenced.
[out]Info= 0: Successful exit.
= -1: The argument Vect had an illegal value. (Vect <> "N", "V" nor "Q")
= -2: The argument Uplo had an illegal value (Uplo != "U" nor "L")
= -3: The argument N had an illegal value. (N < 0)
= -4: The argument Kd had an illegal value. (Kd < 0)
= -5: The argument Ab() is invalid.
= -6: The argument D() is invalid.
= -7: The argument E() is invalid.
= -8: The argument Q() is invalid.
Reference
LAPACK
Example Program
Compute all eigenvalues of the symmetric band matrix A, where
( 0.61 0.79 0 )
A = ( 0.79 2.23 0.25 )
( 0 0.25 2.87 )
Reduces to tridiagonal form by Dsbtrd, then Dsterf is applied.
Sub Ex_Dsbtrd_Dsterf()
Const N = 3, Kd = 1
Dim Ab(Kd, N - 1) As Double, Q() As Double
Dim D(N - 1) As Double, E(N - 2) As Double, Info As Long
Ab(0, 0) = 0.61: Ab(0, 1) = 2.23: Ab(0, 2) = 2.87
Ab(1, 0) = 0.79: Ab(1, 1) = 0.25
Call Dsbtrd("N", "L", N, Kd, Ab(), D(), E(), Q(), Info)
If Info <> 0 Then
Debug.Print "Error in Dsbtrd: Info =", Info
Exit Sub
End If
Call Dsterf(N, D(), E(), Info)
If Info <> 0 Then
Debug.Print "Error in Dsterf: Info =", Info
Exit Sub
End If
Debug.Print "Eigenvalues =", D(0), D(1), D(2)
End Sub
Sub Dsterf(N As Long, D() As Double, E() As Double, Info As Long)
Eigenvalues of a symmetric tridiagonal matrix (QL or QR method)
Sub Dsbtrd(Vect As String, Uplo As String, N As Long, Kd As Long, Ab() As Double, D() As Double, E() As Double, Q() As Double, Info As Long)
Reduces a real symmetric band matrix to tridiagonal form
Example Results
Eigenvalues = 0.285074336232239 2.43057331973532 2.99435234403244