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

◆ Dsbgv()

Sub Dsbgv ( Jobz As  String,
Uplo As  String,
N As  Long,
Ka As  Long,
Kb As  Long,
Ab() As  Double,
Bb() As  Double,
W() As  Double,
Z() As  Double,
Info As  Long 
)

(Simple driver) Generalized eigenvalue problem of symmetric band matrices

Purpose
This routine computes all the eigenvalues, and optionally, the eigenvectors of a real generalized symmetric-definite banded eigenproblem, of the form
Ax = λBx.
Here A and B are assumed to be symmetric and banded, and B is also positive definite.
Parameters
[in]Jobz= "N": Compute eigenvalues only.
= "V": Compute eigenvalues and eigenvectors.
[in]Uplo= "U": Upper triangles of A and B are stored.
= "L": Lower triangles of A and B are stored.
[in]NOrder of the matrices A and B. (N >= 0) (If N = 0, returns without computation)
[in]KaNumber of super-diagonals of the matrix A if Uplo = "U" or the number of sub-diagonals if Uplo = "L". (ka >= 0)
[in]KbNumber of super-diagonals of the matrix B if Uplo = "U" or the number of sub-diagonals if Uplo = "L". (kb >= 0)
[in,out]Ab()Array Ab(LAb1 - 1, LAb2 - 1) (LAb1 >= Ka + 1, LAb2 >= N)
[in] N x N symmetric band matrix A in Ka+1 x N symmetric band matrix form. Upper or lower part is to be stored in accordance with Uplo.
[out] The contents of Ab() are destroyed.
[in,out]Bb()Array Bb(LBb1 - 1, LBb2 - 1) (LBb1 >= Kb + 1, LBb2 >= N)
[in] N x N symmetric positive definite band matrix B in Kb+1 x N symmetric band matrix form. Upper or lower part is to be stored in accordance with Uplo.
[out] The factor S from the split Cholesky factorization B = S^T*S, as returned by Dpbstf.
[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 matrix Z of eigenvectors, with the i-th column of Z holding the eigenvector associated with W(i). The eigenvectors are normalized so that Z^T*B*Z = I.
Jobz = "N": Z() is not referenced.
[out]Info= 0: Successful exit.
= -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 Ka had an illegal value. (Ka < 0)
= -5: The argument Kb had an illegal value. (Kb < 0)
= -6: The argument Ab() is invalid.
= -7: The argument Bb() is invalid.
= -8: The argument W() is invalid.
= -9: The argument Z() is invalid.
= i (0 < i <= N): The algorithm failed to converge. i off-diagonal elements of an intermediate tridiagonal form did not converge to zero.
= i (i > N): Dpbstf returned Info = i-N. B is not positive definite. The factorization of B could not be completed and no eigenvalues or eigenvectors were computed.
Reference
LAPACK
Example Program
Compute the eigenvalues and the eigenvectors of a generalized symmetric-definite eigenproblem of the form Ax = λBx, where A is a symmetric matrix and B is a symmetric positive definite matrix.
( 0.31 0.69 0 ) ( 2.58 -0.99 0 )
A = ( 0.69 2.71 0.57 ) B = ( -0.99 0.69 -0.03 )
( 0 0.57 -0.13 ) ( 0 -0.03 0.18 )
Sub Ex_Dsbgv()
Const N = 3, Ka = 1, Kb = 1
Dim Ab(Ka, N - 1) As Double, Bb(Kb, N - 1) As Double
Dim W(N - 1) As Double, Z(N - 1, N - 1) As Double, Info As Long
Ab(0, 0) = 0.31: Ab(0, 1) = 2.71: Ab(0, 2) = -0.13
Ab(1, 0) = 0.69: Ab(1, 1) = 0.57
Bb(0, 0) = 2.58: Bb(0, 1) = 0.69: Bb(0, 2) = 0.18
Bb(1, 0) = -0.99: Bb(1, 1) = -0.03
Call Dsbgv("V", "L", N, Ka, Kb, Ab(), Bb(), 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 Dsbgv(Jobz As String, Uplo As String, N As Long, Ka As Long, Kb As Long, Ab() As Double, Bb() As Double, W() As Double, Z() As Double, Info As Long)
(Simple driver) Generalized eigenvalue problem of symmetric band matrices
Example Results
Eigenvalues = -1.18147421492712 7.44172967142041E-02 11.8828445198389
Eigenvectors =
-4.93563525964657E-02 0.580733103214333 0.728344545882694
-0.345554886717425 -8.97353379594566E-02 1.77481785369013
2.23453164309908 -0.358097826727939 0.724727404571494
Info = 0