|
|
◆ Dstevx()
| Sub Dstevx |
( |
Jobz As |
String, |
|
|
Range As |
String, |
|
|
N As |
Long, |
|
|
D() As |
Double, |
|
|
E() 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) Eigenvalues and eigenvectors of a symmetric tridiagonal matrix
- Purpose
- This routine computes selected eigenvalues and, optionally, eigenvectors of a real symmetric tridiagonal 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] | N | Order of the matrix A. (N >= 0) (If N = 0, returns without computation) |
| [in,out] | D() | Array D(LD - 1) (LD >= N)
[in] N diagonal elements of the symmetric tridiagonal matrix A.
[out] D() may be multiplied by a constant factor chosen to avoid over/underflow in computing the eigenvalues. |
| [in,out] | E() | Array E(LE - 1) (LE >= N - 1)
[in] N-1 subdiagonal elements of the symmetric tridiagonal matrix A stored in elements 0 to n-2 of E().
[out] E() may be multiplied by a constant factor chosen to avoid over/underflow in computing the eigenvalues. |
| [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 (Info > 0), 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 N had an illegal value. (N < 0)
= -4: The argument D() is invalid.
= -5: The argument E() is invalid.
= -7: The argument Vu had an illegal value. (Vu <= Vl)
= -8: The argument Il had an illegal value. (Il < 1 or Il > N)
= -9: The argument Iu had an illegal value. (Iu < min(N, Il) or Iu > N)
= -12: The argument W() is invalid.
= -13: The argument Z() is invalid.
= -14: 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 symmetric tridiagonal matrix A, where
( 2.58 -0.99 0 )
A = ( -0.99 0.69 -0.03 )
( 0 -0.03 0.18 )
Sub Ex_Dstevx()
Const N = 3
Dim D(N - 1) As Double, E(N - 2) As Double, W(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
D(0) = 2.58: D(1) = 0.69: D(2) = 0.18
E(0) = -0.99: E(1) = -0.03
Call Dstevx("V", "A", N, D(), E(), 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
Sub Dstevx(Jobz As String, Range As String, N As Long, D() As Double, E() 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) Eigenvalues and eigenvectors of a symmetric tridiagonal matrix
- Example Results
Eigenvalues = 0.171899161473039 0.274429936398504 3.00367090212846
Eigenvectors =
0.106563041190365 -0.378750155986403 -0.919343590608286
0.259206614996466 -0.882055576996615 0.393433463029321
0.959925126764757 0.280225406466732 -4.18002107893757E-03
M = 3 Info = 0
|