F08JHF (DSTEDC) (PDF version)
F08 Chapter Contents
F08 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

F08JHF (DSTEDC)

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

F08JHF (DSTEDC) computes all the eigenvalues and, optionally, all the eigenvectors of a real n by n 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 T. That is, the routine computes the spectral factorization of T given by
T = Z Λ ZT ,
where Λ is a diagonal matrix whose diagonal elements are the eigenvalues, λi, of T and Z is an orthogonal matrix whose columns are the eigenvectors, zi, of T. Thus
Tzi = λi zi ,   i = 1,2,,n .
The routine may also be used to compute all the eigenvalues and vectors of a real full, or banded, symmetric matrix A which has been reduced to tridiagonal form T as
A = QTQT ,
where Q is orthogonal. The spectral factorization of A is then given by
A = QZ Λ QZT .
In this case Q must be formed explicitly and passed to F08JHF (DSTEDC) in the array Z, and the routine called with COMPZ='V'. Routines which may be called to form T and Q are
full matrix F08FEF (DSYTRD) and F08FFF (DORGTR)
full matrix, packed storage F08GEF (DSPTRD) and F08GFF (DOPGTR)
band matrix F08HEF (DSBTRD), with VECT='V'
When only eigenvalues are required then this routine calls F08JFF (DSTERF) to compute the eigenvalues of the tridiagonal matrix T, but when eigenvectors of T 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.
COMPZ='N'
Only the eigenvalues are computed (and the array Z is not referenced).
COMPZ='I'
The eigenvalues and eigenvectors of T are computed (and the array Z is initialized by the routine).
COMPZ='V'
The eigenvalues and eigenvectors of A are computed (and the array Z must contain the matrix Q on entry).
Constraint: COMPZ='N', 'V' or 'I'.
2:     N – INTEGERInput
On entry: n, the order of the symmetric tridiagonal matrix T.
Constraint: N0.
3:     D(*) – REAL (KIND=nag_wp) arrayInput/Output
Note: the dimension of the array D must be at least max1,N.
On entry: the diagonal elements of the tridiagonal matrix.
On exit: if INFO=0, the eigenvalues in ascending order.
4:     E(*) – REAL (KIND=nag_wp) arrayInput/Output
Note: the dimension of the array E must be at least max1,N-1.
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 max1,N if COMPZ='V' or 'I', and at least 1 otherwise.
On entry: if COMPZ='V', Z must contain the orthogonal matrix Q used in the reduction to tridiagonal form.
On exit: if COMPZ='V', Z contains the orthonormal eigenvectors of the original symmetric matrix A, and if COMPZ='I', Z contains the orthonormal eigenvectors of the symmetric tridiagonal matrix T.
If COMPZ='N', 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 COMPZ='V' or 'I', LDZ max1,N ;
  • otherwise LDZ1.
7:     WORK(max1,LWORK) – REAL (KIND=nag_wp) arrayWorkspace
On exit: if INFO=0, WORK1 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 LWORK=-1, 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 LWORK-1,
  • if COMPZ='N' or N1, LWORK must be at least 1;
  • if COMPZ='V' and N>1, LWORK must be at least 1+3×N+2×N×lgN+4×N2, where lgN= smallest integer k such that 2kN;
  • if COMPZ='I' and N>1, LWORK must be at least 1+4×N+N2.
Note: that for COMPZ='I' or 'V' then if N is less than or equal to the minimum divide size, usually 25, then LWORK need only be max1,2×N-1 .
9:     IWORK(max1,LIWORK) – INTEGER arrayWorkspace
On exit: if INFO=0, IWORK1 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 LIWORK=-1, 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 LIWORK-1,
  • if COMPZ='N' or N1, LIWORK must be at least 1;
  • if COMPZ='V' and N>1, LIWORK must be at least 6+6×N+5×N×lgN;
  • if COMPZ='I' and N>1, LIWORK must be at least 3+5×N.
Note: that for COMPZ='I' or 'V', then if N is less than or equal to the minimum divide size, usually 25, then LIWORK need only be 1.
11:   INFO – INTEGEROutput
On exit: INFO=0 unless the routine detects an error (see Section 6).

6  Error Indicators and Warnings

Errors or warnings detected by the routine:
INFO<0
If INFO=-i, argument i had an illegal value. An explanatory message is output, and execution of the program is terminated.
INFO>0
The algorithm failed to compute an eigenvalue while working on the submatrix lying in rows and columns INFO/N+1 through INFO mod N+1.

7  Accuracy

The computed eigenvalues and eigenvectors are exact for a nearby matrix T+E, where
E2 = Oε T2 ,
and ε is the machine precision.
If λi is an exact eigenvalue and λ~i is the corresponding computed value, then
λ~i - λi c n ε T2 ,
where cn is a modestly increasing function of n.
If zi is the corresponding exact eigenvector, and z~i is the corresponding computed eigenvector, then the angle θz~i,zi between them is bounded as follows:
θ z~i,zi cnεT2 minijλi-λj .
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).

8  Further Comments

If only eigenvalues are required, the total number of floating point operations is approximately proportional to n2. 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
A = 4.99 0.04 0.22 0.00 0.04 1.05 -0.79 1.04 0.22 -0.79 -2.31 -1.30 0.00 1.04 -1.30 -0.43 .
A 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)


F08JHF (DSTEDC) (PDF version)
F08 Chapter Contents
F08 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012