XLPack 6.1
Excel VBA Numerical Library Reference Manual
Loading...
Searching...
No Matches

◆ Dsbgvx()

Sub Dsbgvx ( Jobz As  String,
Range As  String,
Uplo As  String,
N As  Long,
Ka As  Long,
Kb As  Long,
Ab() As  Double,
Bb() As  Double,
Q() As  Double,
Vl As  Double,
Vu As  Double,
Il As  Long,
Iu As  Long,
AbsTol As  Double,
M As  Long,
W() As  Double,
Z() As  Double,
IFail() As  Long,
Info As  Long 
)

(Expert driver) Generalized eigenvalue problem of symmetric band matrices (expert driver)

Purpose
This routine computes selected eigenvalues, and optionally, 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.
Eigenvalues and eigenvectors can be selected by specifying either all eigenvalues, a range of values or a range of indices for the desired eigenvalues.
Parameters
[in]Jobz= "N": Compute eigenvalues only.
= "V": Compute eigenvalues and eigenvectors.
[in]Range= "A": All eigenvalues will be found.
= "V": All eigenvalues in the half-open interval (Vl, Vu] will be found.
= "I": The Il-th through Iu-th eigenvalues will be found.
[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]Q()Array Q(LQ1 - 1, LQ2 - 1) (LQ1 >= N, LQ2 >= N)
Jobz = "V": The N x N matrix used in the reduction of A*x = λ*B*x to standard form, i.e. C*x = λ*x, and consequently C to tridiagonal form.
Jobz = "N": The array Q() is not referenced.
[in]VlRange = "V": The lower bound of the interval to be searched for eigenvalues. (Vl < Vu)
Range = "A" or "I": Not referenced.
[in]VuRange = "V": The upper bound of the interval to be searched for eigenvalues. (Vl < Vu)
Range = "A" or "I": Not referenced.
[in]IlRange = "I": The index of the smallest eigenvalue to be returned. (1 <= Il <= Iu <= N, if N > 0; Il = 1 and Iu = 0 if N = 0)
Range = "A" or "V": Not referenced.
[in]IuRange = "I": The index of the largest eigenvalues to be returned. (1 <= Il <= Iu <= N, if N > 0; Il = 1 and Iu = 0 if N = 0)
Range = "A" or "V": Not referenced.
[in]AbsTolThe absolute error tolerance for the eigenvalues.
An approximate eigenvalue is accepted as converged when it is determined to lie in an interval [a, b] of width less than or equal to AbsTol + eps * max(|a|, |b|), where eps is the machine precision. If AbsTol is less than or equal to zero, then eps*|T| will be used in its place, where |T| is the 1-norm of the tridiagonal matrix obtained by reducing A to tridiagonal form.
Eigenvalues will be computed most accurately when abstol is set to twice the underflow threshold 2*Dlamch("S"), not zero. If this routine returns with Info > 0, indicating that some eigenvectors did not converge, try setting abstol to 2*Dlamch("S").
[out]MThe total number of eigenvalues found. (0 <= M <= N)
If Range = "A", M = N, and if Range = "I", M = Iu - Il + 1.
[out]W()Array W(LW - 1) (LW >= N)
On normal exit, the first M elements contain the selected eigenvalues in ascending order.
[out]Z()Array Z(LZ1 - 1, LZ2 - 1) (LZ1 >= N, LZ2 >= M)
Jobz = "V": If Info = 0, the first M columns of Z() contain the orthonormal eigenvectors of the matrix A corresponding to the selected eigenvalues, 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.
  If an eigenvector fails to converge, then that column of Z() contains the latest approximation to the eigenvector, and the index of the eigenvector is returned in IFail().
Jobz = "N": Z() is not referenced.
Note: The user must ensure that at least max(1, M) columns are supplied in the array Z(); if Range = "V", the exact value of M is not known in advance and an upper bound must be used.
[out]IFail()Array IFail(LIFail - 1) (LIFail >= N)
Jobz = "V": If Info = 0, the first M elements of IFail() are zero. If Info > 0, then IFail() contains the indices of the eigenvectors that failed to converge.
Jobz = "N": IFail() is not referenced.
[out]Info= 0: Successful exit.
= -1: The argument Jobz had an illegal value. (Jobz <> "V" nor "N")
= -2: The argument Range had an illegal value. (Range <> "A", "V" nor "I")
= -3: The argument Uplo had an illegal value. (Uplo <> "U" nor "L")
= -4: The argument N had an illegal value. (N < 0)
= -5: The argument Ka had an illegal value. (Ka < 0)
= -6: The argument Kb had an illegal value. (Kb < 0)
= -7: The argument Ab() is invalid.
= -8: The argument Bb() is invalid.
= -9: The argument Q() is invalid.
= -11: The argument Vu had an illegal value. (Vu <= Vl)
= -12: The argument Il had an illegal value. (Il < 1 or Il > N)
= -13: The argument Iu had an illegal value. (Iu < min(N, Il) or Iu > N)
= -16: The argument W() is invalid.
= -17: The argument Z() is invalid.
= -18: The argument IFail() is invalid.
= i (0 < i <= N): i eigenvectors failed to converge. Their indices are stored in IFail().
= i (i > N): Dpbstf returned Info = i-N; the leading minor of order i-N of 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_Dsbgvx()
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, Q(N - 1, N - 1) As Double
Dim Vl As Double, Vu As Double, Il As Long, Iu As Long, AbsTol As Double
Dim M As Long, Z(N - 1, N - 1) As Double, IFail(N - 1) As Long, 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 Dsbgvx("V", "A", "L", N, Ka, Kb, Ab(), Bb(), Q(), Vl, Vu, Il, Iu, AbsTol, M, W(), Z(), IFail(), 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 "M =", M, "Info =", Info
End Sub
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
M = 3 Info = 0