NAG Library Routine Document
F08JHF (DSTEDC)
1 Purpose
F08JHF (DSTEDC) computes all the eigenvalues and, optionally, all the eigenvectors of a real by symmetric tridiagonal matrix, or of a real full or banded symmetric matrix which has been reduced to tridiagonal form.
2 Specification
SUBROUTINE F08JHF ( |
COMPZ, N, D, E, Z, LDZ, WORK, LWORK, IWORK, LIWORK, INFO) |
INTEGER |
N, LDZ, LWORK, IWORK(max(1,LIWORK)), LIWORK, INFO |
REAL (KIND=nag_wp) |
D(*), E(*), Z(LDZ,*), WORK(max(1,LWORK)) |
CHARACTER(1) |
COMPZ |
|
The routine may be called by its
LAPACK
name dstedc.
3 Description
F08JHF (DSTEDC) computes all the eigenvalues and, optionally, the eigenvectors of a real symmetric tridiagonal matrix
. That is, the routine computes the spectral factorization of
given by
where
is a diagonal matrix whose diagonal elements are the eigenvalues,
, of
and
is an orthogonal matrix whose columns are the eigenvectors,
, of
. Thus
The routine may also be used to compute all the eigenvalues and vectors of a real full, or banded, symmetric matrix
which has been reduced to tridiagonal form
as
where
is orthogonal. The spectral factorization of
is then given by
In this case
must be formed explicitly and passed to F08JHF (DSTEDC) in the array
Z, and the routine called with
. Routines which may be called to form
and
are
When only eigenvalues are required then this routine calls
F08JFF (DSTERF) to compute the eigenvalues of the tridiagonal matrix
, but when eigenvectors of
are also required and the matrix is not too small, then a divide and conquer method is used, which can be much faster than
F08JEF (DSTEQR), although more storage is required.
4 References
Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999)
LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia
http://www.netlib.org/lapack/lug
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
5 Parameters
- 1: COMPZ – CHARACTER(1)Input
On entry: indicates whether the eigenvectors are to be computed.
- Only the eigenvalues are computed (and the array Z is not referenced).
- The eigenvalues and eigenvectors of are computed (and the array Z is initialized by the routine).
- The eigenvalues and eigenvectors of are computed (and the array Z must contain the matrix on entry).
Constraint:
, or .
- 2: N – INTEGERInput
On entry: , the order of the symmetric tridiagonal matrix .
Constraint:
.
- 3: D() – REAL (KIND=nag_wp) arrayInput/Output
-
Note: the dimension of the array
D
must be at least
.
On entry: the diagonal elements of the tridiagonal matrix.
On exit: if , the eigenvalues in ascending order.
- 4: E() – REAL (KIND=nag_wp) arrayInput/Output
-
Note: the dimension of the array
E
must be at least
.
On entry: the subdiagonal elements of the tridiagonal matrix.
On exit:
E is overwritten.
- 5: Z(LDZ,) – REAL (KIND=nag_wp) arrayInput/Output
-
Note: the second dimension of the array
Z
must be at least
if
or
, and at least
otherwise.
On entry: if
,
Z must contain the orthogonal matrix
used in the reduction to tridiagonal form.
On exit: if
,
Z contains the orthonormal eigenvectors of the original symmetric matrix
, and if
,
Z contains the orthonormal eigenvectors of the symmetric tridiagonal matrix
.
If
,
Z is not referenced.
- 6: LDZ – INTEGERInput
On entry: the first dimension of the array
Z as declared in the (sub)program from which F08JHF (DSTEDC) is called.
Constraints:
- if or , ;
- otherwise .
- 7: WORK() – REAL (KIND=nag_wp) arrayWorkspace
On exit: if
,
contains the minimum value of
LWORK required for optimal performance.
- 8: LWORK – INTEGERInput
On entry: the dimension of the array
WORK as declared in the (sub)program from which F08JHF (DSTEDC) is called.
If
, a workspace query is assumed; the routine only calculates the minimum 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.
Constraints:
if
,
- if or , LWORK must be at least ;
- if and , LWORK must be at least , where smallest integer such that ;
- if and , LWORK must be at least .
Note: that for
or
then if
N is less than or equal to the minimum divide size, usually
, then
LWORK need only be
.
- 9: IWORK() – INTEGER arrayWorkspace
On exit: if
,
returns the minimum
LIWORK.
- 10: LIWORK – INTEGERInput
On entry: the dimension of the array
IWORK as declared in the (sub)program from which F08JHF (DSTEDC) is called.
If
, a workspace query is assumed; the routine only calculates the minimum 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.
Constraints:
if
,
- if or , LIWORK must be at least ;
- if and , LIWORK must be at least ;
- if and , LIWORK must be at least .
Note: that for
or
, then if
N is less than or equal to the minimum divide size, usually
, then
LIWORK need only be
.
- 11: INFO – INTEGEROutput
On exit:
unless the routine detects an error (see
Section 6).
6 Error Indicators and Warnings
Errors or warnings detected by the routine:
If , argument had an illegal value. An explanatory message is output, and execution of the program is terminated.
The algorithm failed to compute an eigenvalue while working on the submatrix lying in rows and columns through .
7 Accuracy
The computed eigenvalues and eigenvectors are exact for a nearby matrix
, where
and
is the
machine precision.
If
is an exact eigenvalue and
is the corresponding computed value, then
where
is a modestly increasing function of
.
If
is the corresponding exact eigenvector, and
is the corresponding computed eigenvector, then the angle
between them is bounded as follows:
Thus the accuracy of a computed eigenvector depends on the gap between its eigenvalue and all the other eigenvalues.
See Section 4.7 of
Anderson et al. (1999) for further details. See also
F08FLF (DDISNA).
If only eigenvalues are required, the total number of floating point operations is approximately proportional to
. When eigenvectors are required the number of operations is bounded above by approximately the same number of operations as
F08JEF (DSTEQR), but for large matrices F08JHF (DSTEDC) is usually much faster.
The complex analogue of this routine is
F08JVF (ZSTEDC).
9 Example
This example finds all the eigenvalues and eigenvectors of the symmetric band matrix
is first reduced to tridiagonal form by a call to
F08HEF (DSBTRD).
9.1 Program Text
Program Text (f08jhfe.f90)
9.2 Program Data
Program Data (f08jhfe.d)
9.3 Program Results
Program Results (f08jhfe.r)