?steqr

Computes all eigenvalues and eigenvectors of a symmetric or Hermitian matrix reduced to tridiagonal form (QR algorithm).

Syntax

FORTRAN 77:

call ssteqr(compz, n, d, e, z, ldz, work, info)

call dsteqr(compz, n, d, e, z, ldz, work, info)

call csteqr(compz, n, d, e, z, ldz, work, info)

call zsteqr(compz, n, d, e, z, ldz, work, info)

FORTRAN 95:

call rsteqr(d, e [,z] [,compz] [,info])

call steqr(d, e [,z] [,compz] [,info])

C:

lapack_int LAPACKE_ssteqr( int matrix_order, char compz, lapack_int n, float* d, float* e, float* z, lapack_int ldz );

lapack_int LAPACKE_dsteqr( int matrix_order, char compz, lapack_int n, double* d, double* e, double* z, lapack_int ldz );

lapack_int LAPACKE_csteqr( int matrix_order, char compz, lapack_int n, float* d, float* e, lapack_complex_float* z, lapack_int ldz );

lapack_int LAPACKE_zsteqr( int matrix_order, char compz, lapack_int n, double* d, double* e, lapack_complex_double* z, lapack_int ldz );

Include Files

Description

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: T = Z*Λ*ZT. Here Λ is a diagonal matrix whose diagonal elements are the eigenvalues λi; Z is an orthogonal matrix whose columns are eigenvectors. Thus,

T*zi = λi*zi for i = 1, 2, ..., n.

The routine normalizes the eigenvectors so that ||zi||2 = 1.

You can also use the routine for computing the eigenvalues and eigenvectors of an arbitrary real symmetric (or complex Hermitian) matrix A reduced to tridiagonal form T: A = Q*T*QH. In this case, the spectral factorization is as follows: A = Q*T*QH = (Q*Z)*Λ*(Q*Z)H. Before calling ?steqr, you must reduce A to tridiagonal form and generate the explicit matrix Q by calling the following routines:

 

for real matrices:

for complex matrices:

full storage

?sytrd, ?orgtr

?hetrd, ?ungtr

packed storage

?sptrd, ?opgtr

?hptrd, ?upgtr

band storage

?sbtrd (vect='V')

?hbtrd (vect='V')

If you need eigenvalues only, it's more efficient to call sterf. If T is positive-definite, pteqr can compute small eigenvalues more accurately than ?steqr.

To solve the problem by a single call, use one of the divide and conquer routines stevd, syevd, spevd, or sbevd for real symmetric matrices or heevd, hpevd, or hbevd for complex Hermitian matrices.

Input Parameters

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.

compz

CHARACTER*1. Must be 'N' or 'I' or 'V'.

If compz = 'N', the routine computes eigenvalues only.

If compz = 'I', the routine computes the eigenvalues and eigenvectors of the tridiagonal matrix T.

If compz = 'V', the routine computes the eigenvalues and eigenvectors of A (and the array z must contain the matrix Q on entry).

n

INTEGER. The order of the matrix T (n 0).

d, e, work

REAL for single-precision flavors

DOUBLE PRECISION for double-precision flavors.

Arrays:

d(*) contains the diagonal elements of T.

The dimension of d must be at least max(1, n).

e(*) contains the off-diagonal elements of T.

The dimension of e must be at least max(1, n-1).

work(*) is a workspace array.

The dimension of work must be:

at least 1 if compz = 'N';

at least max(1, 2*n-2) if compz = 'V' or 'I'.

z

REAL for ssteqr

DOUBLE PRECISION for dsteqr

COMPLEX for csteqr

DOUBLE COMPLEX for zsteqr.

Array, DIMENSION (ldz, *)

If compz = 'N' or 'I', z need not be set.

If vect = 'V', z must contain the n-by-n matrix Q.

The second dimension of z must be:

at least 1 if compz = 'N';

at least max(1, n) if compz = 'V' or 'I'.

work (lwork) is a workspace array.

ldz

INTEGER. The leading dimension of z. Constraints:

ldz 1 if compz = 'N';

ldz max(1, n) if compz = 'V' or 'I'.

Output Parameters

d

The n eigenvalues in ascending order, unless info > 0.

See also info.

e

On exit, the array is overwritten; see info.

z

If info = 0, contains the n orthonormal eigenvectors, stored by columns. (The i-th column corresponds to the ith eigenvalue.)

info

INTEGER.

If info = 0, the execution is successful.

If info = i, the algorithm failed to find all the eigenvalues after 30n iterations: i off-diagonal elements have not converged to zero. On exit, d and e contain, respectively, the diagonal and off-diagonal elements of a tridiagonal matrix orthogonally similar to T.

If info = -i, the i-th parameter had an illegal value.

Fortran 95 Interface Notes

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 steqr interface are the following:

d

Holds the vector of length n.

e

Holds the vector of length (n-1).

z

Holds the matrix Z of size (n,n).

compz

If omitted, this argument is restored based on the presence of argument z as follows:

compz = 'I', if z is present,

compz = 'N', if z is omitted.

If present, compz must be equal to 'I' or 'V' and the argument z must also be present. Note that there will be an error condition if compz is present and z omitted.

Note that two variants of Fortran 95 interface for steqr routine are needed because of an ambiguous choice between real and complex cases appear when z is omitted. Thus, the name rsteqr is used in real cases (single or double precision), and the name steqr is used in complex cases (single or double precision).

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 / minij|λi - λj|.

The total number of floating-point operations depends on how rapidly the algorithm converges. Typically, it is about

24n2 if compz = 'N';

7n3 (for complex flavors, 14n3) if compz = 'V' or 'I'.


Submit feedback on this help topic