|
◆ Zhbevx()
Sub Zhbevx |
( |
Jobz As |
String, |
|
|
Range As |
String, |
|
|
Uplo As |
String, |
|
|
N As |
Long, |
|
|
Kd As |
Long, |
|
|
Ab() As |
Complex, |
|
|
Q() As |
Complex, |
|
|
Vl As |
Double, |
|
|
Vu As |
Double, |
|
|
Il As |
Long, |
|
|
Iu As |
Long, |
|
|
AbsTol As |
Double, |
|
|
M As |
Long, |
|
|
W() As |
Double, |
|
|
Z() As |
Complex, |
|
|
IFail() As |
Long, |
|
|
Info As |
Long |
|
) |
| |
(Expert driver) Eigenvalues and eigenvectors of a Hermitian band matrix
- Purpose
- This routine computes selected eigenvalues and, optionally, eigenvectors of a Hermitian band matrix A. Eigenvalues and eigenvectors can be selected by specifying either 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 triangle of A is stored.
= "L": Lower triangle of A is stored. |
[in] | N | Order of the matrix A. (N >= 0) (If N = 0, returns without computation) |
[in] | Kd | Number of super-diagonals of the matrix A if Uplo = "U" or number of sub-diagonals if Uplo = "L". (Kd >= 0) |
[in,out] | Ab() | Array Ab(LAb1 - 1, LAb2 - 1) (LAb1 >= Kd + 1, LAb2 >= N)
[in] N x N Hermitian band matrix A in Kd+1 x N symmetric band matrix form. Upper or lower part is to be stored in accordance with Uplo.
[out] Ab() is overwritten by values generated during the reduction to tridiagonal form. |
[out] | Q() | Array Q(LQ1 - 1, LQ2 - 1) (LQ1 >= N, LQ2 >= N)
Jobz = "V": N x N unitary matrix used in the reduction to tridiagonal form.
Jobz = "N": Array Q() is not referenced. |
[in] | Vl | Range = "V": The lower bound of the interval to be searched for eigenvalues. (Vl < Vu)
Range = "A" or "I": Not referenced. |
[in] | Vu | Range = "V": The upper bound of the interval to be searched for eigenvalues. (Vl < Vu)
Range = "A" or "I": Not referenced. |
[in] | Il | Range = "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] | Iu | Range = "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] | AbsTol | The 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").
See "Computing Small Singular Values of Bidiagonal Matrices with Guaranteed High Relative Accuracy," by Demmel and Kahan, LAPACK Working Note #3. |
[out] | M | The 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). 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 Kd had an illegal value. (Kd < 0)
= -6: The argument Ab() is invalid.
= -7: The argument Q() is invalid.
= -9: The argument Vu had an illegal value. (Vu <= Vl)
= -10: The argument Il had an illegal value. (Il < 1 or Il > N)
= -11: The argument Iu had an illegal value. (Iu < min(N, Il) or Iu > N)
= -14: The argument W() is invalid.
= -15: The argument Z() is invalid.
= -16: The argument IFail() is invalid.
= i > 0: i eigenvectors failed to converge. Their indices are stored in array IFail(). |
- Reference
- LAPACK
- Example Program
- Compute all eigenvalues and eigenvectors of the Hermitian band matrix A, where
( 2.20 -0.32-0.81i 0 )
A = ( -0.32+0.81i 2.11 0.37+0.80i )
( 0 0.37-0.80i 2.93 )
Sub Ex_Zhbevx()
Const N = 3, Kd = 1
Dim Ab(Kd, N - 1) As Complex, W(N - 1) As Double, Q(N - 1, N - 1) As Complex
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 Complex, IFail(N - 1) As Long, Info As Long
Ab(0, 0) = Cmplx(2.2, 0): Ab(0, 1) = Cmplx(2.11, 0): Ab(0, 2) = Cmplx(2.93, 0)
Ab(1, 0) = Cmplx(-0.32, 0.81): Ab(1, 1) = Cmplx(0.37, -0.8)
Call Zhbevx("V", "A", "L", N, Kd, Ab(), 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 Creal(Z(0, 0)), Cimag(Z(0, 0)), Creal(Z(0, 1)), Cimag(Z(0, 1))
Debug.Print Creal(Z(1, 0)), Cimag(Z(1, 0)), Creal(Z(1, 1)), Cimag(Z(1, 1))
Debug.Print Creal(Z(2, 0)), Cimag(Z(2, 0)), Creal(Z(2, 1)), Cimag(Z(2, 1))
Debug.Print Creal(Z(0, 2)), Cimag(Z(0, 2))
Debug.Print Creal(Z(1, 2)), Cimag(Z(1, 2))
Debug.Print Creal(Z(2, 2)), Cimag(Z(2, 2))
Debug.Print "M =", M, "Info =", Info
End Sub
- Example Results
Eigenvalues = 1.04283948355918 2.52504447979701 3.67211603664382
Eigenvectors =
-0.563395195782213 0 0.745522345299636 0
-0.275043343741226 0.696203463844978 -0.102234588437164 0.258781301981572
-0.241207215775279 -0.253094504921304 -0.417819329339414 -0.438410500970378
-0.356065002532476 -0
0.221139195914327 -0.559758589658141
-0.493164614651588 -0.51746898859873
M = 3 Info = 0
|