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

◆ Dsbevd()

Sub Dsbevd ( Jobz As  String,
Uplo As  String,
N As  Long,
Kd As  Long,
Ab() As  Double,
W() As  Double,
Z() As  Double,
Info As  Long 
)

(Divide and conquer driver) Eigenvalues and eigenvectors of a symmetric band matrix

Purpose
This routine computes all the eigenvalues and, optionally, eigenvectors of a real symmetric band matrix A. If only eigenvalues are desired, it uses a QL or QR method. If eigenvectors are also desired, it uses a divide and conquer algorithm.
Parameters
[in]Jobz= "N": Compute eigenvalues only.
= "V": Compute eigenvalues and eigenvectors.
[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 columns 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(Kd + i - j, j) = Aij for max(0, j - Kd - 1) <= i <= j <= N - 1.
Uplo = "L": Ab(i - j, j) = Aij for 0 <= j <= i <= min(N - 1, j + Kd - 1).
[out] Ab() is overwritten by values generated during the reduction to tridiagonal form. If Uplo = "U", the first superdiagonal and the diagonal of the tridiagonal matrix T are returned in rows Kd and Kd + 1 of Ab(). If Uplo = "L", the diagonal and first subdiagonal of T are returned in the first two rows of Ab().
[out]W()Array W(LW - 1) (LW >= N)
If Info = 0, the eigenvalues in ascending order.
[out]Z()Array Z(LZ1 - 1, LZ2 - 1) (LZ1 >= N, LZ2 >= N)
Jobz = "V": If Info = 0, Z() contains the orthonormal eigenvectors of the matrix A, with the i-th column of Z() holding the eigenvector associated with W(i).
Jobz = "N": Z() is not referenced.
[out]Info= 0: Successful exit__N = -1: The argument Jobz had an illegal value. (Jobz <> "V" nor "N")
= -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 W() is invalid.
= -7: The argument Z() is invalid.
= i > 0: The algorithm failed to converge; i off-diagonal elements of an intermediate tridiagonal form did not converge to zero
Reference
LAPACK
Example Program
Compute all eigenvalues and eigenvectors of the symmetric band matrix A, where
( 0.61 0.79 0 )
A = ( 0.79 2.23 0.25 )
( 0 0.25 2.87 )
Sub Ex_Dsbevd()
Const N = 3, Kd = 1
Dim Ab(Kd, N - 1) As Double, W(N - 1) As Double, Z(N - 1, N - 1) As Double
Dim 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 Dsbevd("V", "L", N, Kd, Ab(), W(), Z(), Info)
Debug.Print "Eigenvalues =", W(0), W(1), W(2)
Debug.Print "Eigenvectors ="
Debug.Print Z(0, 0), Z(0, 1), Z(0, 2)
Debug.Print Z(1, 0), Z(1, 1), Z(1, 2)
Debug.Print Z(2, 0), Z(2, 1), Z(2, 2)
Debug.Print "Info =", Info
End Sub
Sub Dsbevd(Jobz As String, Uplo As String, N As Long, Kd As Long, Ab() As Double, W() As Double, Z() As Double, Info As Long)
(Divide and conquer driver) Eigenvalues and eigenvectors of a symmetric band matrix
Example Results
Eigenvalues = 0.285074336232239 2.43057331973532 2.99435234403244
Eigenvectors =
0.924204695519984 -0.35289670385953 0.145978070900713
-0.380123828036851 -0.813258637555945 0.440586272822087
3.67635163909111E-02 0.462681645244035 0.885761897474061
Info = 0