Computes all eigenvalues and, optionally, all eigenvectors of a real symmetric tridiagonal matrix using divide and conquer algorithm.


lapack_int LAPACKE_sstevd (int matrix_layout, char jobz, lapack_int n, float* d, float* e, float* z, lapack_int ldz);

lapack_int LAPACKE_dstevd (int matrix_layout, char jobz, lapack_int n, double* d, double* e, double* z, lapack_int ldz);

Include Files

  • mkl.h


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.

Input Parameters


Specifies whether matrix storage layout is row major (LAPACK_ROW_MAJOR) or column major (LAPACK_COL_MAJOR).


Must be 'N' or 'V'.

If jobz = 'N', then only eigenvalues are computed.

If jobz = 'V', then eigenvalues and eigenvectors are computed.


The order of the matrix T (n 0).

d, e


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). The n-th element of this array is used as workspace.


The leading dimension of the output array z. Constraints:

ldz 1 if job = 'N';

ldz max(1, n) if job = 'V'.

Output Parameters


On exit, if info = 0, contains the eigenvalues of the matrix T in ascending order.

See also info.


Array, size max(1, ldz*n) if jobz = 'V' and 1 if jobz = 'N' .

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.

Return Values

This function returns a value info.

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.

Application Notes

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 μi 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 ij|λi - λj|.

Thus the accuracy of a computed eigenvector depends on the gap between its eigenvalue and all the other eigenvalues.

For more complete information about compiler optimizations, see our Optimization Notice.
Select sticky button color: 
Orange (only for download buttons)