|
|
◆ Dstevr()
| Sub Dstevr |
( |
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, |
|
|
Isuppz() As |
Long, |
|
|
Info As |
Long |
|
) |
| |
(MRRR driver) Eigenvalues and eigenvectors of a symmetric tridiagonal matrix
- Purpose
- This routine computes selected eigenvalues and, optionally, eigenvectors of a real symmetric tridiagonal matrix T. Eigenvalues and eigenvectors can be selected by specifying either a Range of values or a Range of indices for the desired eigenvalues.
Whenever possible, this routine calls Dstemr to compute the eigenspectrum using RRR (Relatively Robust Representations). dstemr computes eigenvalues by the dqds algorithm, while orthogonal eigenvectors are computed from various "good" L D L^T representations (also known as RRR).
- 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.
For Range = "V" or "I" and Iu - Il < N - 1, Dstebz and Dstein are called. |
| [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.
See "Computing Small Singular Values of Bidiagonal Matrices with Guaranteed High Relative Accuracy" by Demmel and Kahan, LAPACK Working Note #3.
If high relative accuracy is important, set Abstol to Dlamch("S"). Doing so will guarantee that eigenvalues are computed to high relative accuracy when possible in future releases. The current code does not make any guarantees about high relative accuracy, but future releases will. See J. Barlow and J. Demmel, "Computing Accurate Eigensystems of Scaled Diagonally Dominant Matrices", LAPACK Working Note #7, for a discussion of which matrices define their eigenvalues to high relative accuracy. |
| [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)
The first M elements contain the selected eigenvalues in ascending order. |
| [out] | Z() | Array A(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).
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] | Isuppz() | Array isuppz[lisuppz] (lisuppz >= 2*max(1, M))
The support of the eigenvectors in Z(), i.e., the indices indicating the nonzero elements in Z(). The i-th eigenvector is nonzero only in elements Isuppz(2*(i-1)) through Isuppz(2*(i-1) + 1).
Implemented only for Range = "A" or "I" and Iu - Il = N - 1. |
| [out] | Info | = 0: Successful exit.
= -1: The argument Jobz had an illegal value. (Jobz <> "N" nor "V")
= -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 Isuppz() is invalid.
= > 0: Internal error. |
- 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_Dstevr()
Const N = 3
Dim D(N - 1) As Double, E(N - 2) As Double, W(N - 1) As Double, Z(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, Isuppz(2 * 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
Abstol = 0
Call Dstevr("V", "A", N, D(), E(), Vl, Vu, Il, Iu, Abstol, M, W(), Z(), Isuppz(), 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 Dstevr(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, Isuppz() As Long, Info As Long) (MRRR 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.882055576996614 -0.393433463029321
0.959925126764757 -0.280225406466732 4.18002107893757E-03
M = 3 Info = 0
|