Computes all eigenvalues and (optionally) all eigenvectors of a real symmetric tridiagonal matrix using divide and conquer algorithm.
FORTRAN 77:
call sstevd(jobz, n, d, e, z, ldz, work, lwork, iwork, liwork, info)
call dstevd(jobz, n, d, e, z, ldz, work, lwork, iwork, liwork, info)
FORTRAN 95:
call stevd(d, e [,z] [,info])
C:
lapack_int LAPACKE_<?>stevd( int matrix_order, char jobz, lapack_int n, <datatype>* d, <datatype>* e, <datatype>* z, lapack_int ldz );
The routine computes all the eigenvalues, and optionally all the eigenvectors, of a real symmetric tridiagonal matrix T. In other words, the routine can compute the spectral factorization of T as: T = Z*Λ*ZT.
Here Λ is a diagonal matrix whose diagonal elements are the eigenvalues λi, and Z is the orthogonal matrix whose columns are the eigenvectors zi. Thus,
T*zi = λi*zi for i = 1, 2, ..., n.
If the eigenvectors are requested, then this routine uses a divide and conquer algorithm to compute eigenvalues and eigenvectors. However, if only eigenvalues are required, then it uses the Pal-Walker-Kahan variant of the QL or QR algorithm.
There is no complex analogue of this routine.
The data types are given for the Fortran interface. A <datatype> placeholder, if present, is used for the C interface data types in the C interface section above. See C Interface Conventions for the C interface principal conventions and type definitions.
CHARACTER*1. Must be 'N' or 'V'.
If jobz = 'N', then only eigenvalues are computed.
If jobz = 'V', then eigenvalues and eigenvectors are computed.
INTEGER. The order of the matrix T (n ≥ 0).
REAL for sstevd
DOUBLE PRECISION for dstevd.
Arrays:
d(*) contains the n diagonal elements of the tridiagonal matrix T.
The dimension of d must be at least max(1, n).
e(*) contains the n-1 off-diagonal elements of T.
The dimension of e must be at least max(1, n-1). The n-th element of this array is used as workspace.
work(*) is a workspace array.
The dimension of work must be at least lwork.
INTEGER. The leading dimension of the output array z. Constraints:
ldz ≥ 1 if job = 'N';
ldz < max(1, n) if job = 'V'.
INTEGER.
The dimension of the array work.
Constraints:
if jobz = 'N' or n ≤ 1, then lwork ≥ 1;
if jobz = 'V' and n > 1, then lwork ≥ n2 + 4*n + 1.
If lwork = -1, then a workspace query is assumed; the routine only calculates the required sizes of the work and iwork arrays, returns these values as the first entries of the work and iwork arrays, and no error message related to lwork or liwork is issued by xerbla. See Application Notes for details.
INTEGER. Workspace array, its dimension max(1, liwork).
INTEGER.
The dimension of the array iwork.
Constraints:
if jobz = 'N' or n ≤ 1, then liwork ≥ 1;
if jobz = 'V' and n > 1, then liwork ≥ 5*n+3.
If liwork = -1, then a workspace query is assumed; the routine only calculates the required sizes of the work and iwork arrays, returns these values as the first entries of the work and iwork arrays, and no error message related to lwork or liwork is issued by xerbla. See Application Notes for details.
On exit, if info = 0, contains the eigenvalues of the matrix T in ascending order.
See also info.
REAL for sstevd
DOUBLE PRECISION for dstevd
Array, DIMENSION (ldz, *).
The second dimension of z must be:
at least 1 if jobz = 'N';
at least max(1, n) if jobz = 'V'.
If jobz = 'V', then this array is overwritten by the orthogonal matrix Z which contains the eigenvectors of T.
If jobz = 'N', then z is not referenced.
On exit, this array is overwritten with intermediate results.
On exit, if lwork > 0, then work(1) returns the required minimal size of lwork.
On exit, if liwork > 0, then iwork(1) returns the required minimal size of liwork.
INTEGER.
If info = 0, the execution is successful.
If info = i, then the algorithm failed to converge; i indicates the number of elements of an intermediate tridiagonal form which did not converge to zero.
If info = -i, the i-th parameter had an illegal value.
Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or restorable arguments, see Fortran 95 Interface Conventions.
Specific details for the routine stevd interface are the following:
Holds the vector of length n.
Holds the vector of length n.
Holds the matrix Z of size (n, n).
Restored based on the presence of the argument z as follows:
jobz = 'V', if z is present,
jobz = 'N', if z is omitted.
The computed eigenvalues and eigenvectors are exact for a matrix T+E such that ||E||2 = O(ε)*||T||2, where ε is the machine precision.
If λi is an exact eigenvalue, and mi is the corresponding computed value, then
|μi - λi| ≤ c(n)*ε*||T||2
where c(n) is a modestly increasing function of n.
If zi is the corresponding exact eigenvector, and wi is the corresponding computed vector, then the angle θ(zi, wi) between them is bounded as follows:
θ(zi, wi) ≤ c(n)*ε*||T||2 / min i≠j|λi - λj|.
Thus the accuracy of a computed eigenvector depends on the gap between its eigenvalue and all the other eigenvalues.
If it is not clear how much workspace to supply, use a generous value of lwork (or liwork) for the first run, or set lwork = -1 (liwork = -1).
If lwork (or liwork) has any of admissible sizes, which is no less than the minimal value described, then the routine completes the task, though probably not so fast as with a recommended workspace, and provides the recommended workspace in the first element of the corresponding array (work, iwork) on exit. Use this value (work(1), iwork(1)) for subsequent runs.
If lwork = -1 (liwork = -1), then the routine returns immediately and provides the recommended workspace in the first element of the corresponding array (work, iwork). This operation is called a workspace query.
Note that if lwork (liwork) is less than the minimal required value and is not equal to -1, then the routine returns immediately with an error exit and does not provide any information on the recommended workspace.