NAG FL Interface
f08jhf (dstedc)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

f08jhf computes all the eigenvalues and, optionally, all the eigenvectors of a real n×n symmetric tridiagonal matrix, or of a real full or banded symmetric matrix which has been reduced to tridiagonal form.

2 Specification

Fortran Interface
Subroutine f08jhf ( compz, n, d, e, z, ldz, work, lwork, iwork, liwork, info)
Integer, Intent (In) :: n, ldz, lwork, liwork
Integer, Intent (Out) :: iwork(max(1,liwork)), info
Real (Kind=nag_wp), Intent (Inout) :: d(*), e(*), z(ldz,*)
Real (Kind=nag_wp), Intent (Out) :: work(max(1,lwork))
Character (1), Intent (In) :: compz
C Header Interface
#include <nag.h>
void  f08jhf_ (const char *compz, const Integer *n, double d[], double e[], double z[], const Integer *ldz, double work[], const Integer *lwork, Integer iwork[], const Integer *liwork, Integer *info, const Charlen length_compz)
The routine may be called by the names f08jhf, nagf_lapackeig_dstedc or its LAPACK name dstedc.

3 Description

f08jhf 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) Λ (QZ)T .  
In this case Q must be formed explicitly and passed to f08jhf 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 and f08fff
full matrix, packed storage f08gef and f08gff
band matrix f08hef, with vect='V'
When only eigenvalues are required then this routine calls f08jff 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, 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 https://www.netlib.org/lapack/lug
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

5 Arguments

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='V'
The eigenvalues and eigenvectors of A are computed (and the array z must contain the matrix Q on entry).
compz='I'
The eigenvalues and eigenvectors of T are computed (and the array z is initialized by the routine).
Constraint: compz='N', 'V' or 'I'.
2: n Integer Input
On entry: n, the order of the symmetric tridiagonal matrix T.
Constraint: n0.
3: d(*) Real (Kind=nag_wp) array Input/Output
Note: the dimension of the array d must be at least max(1,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) array Input/Output
Note: the dimension of the array e must be at least max(1,n-1).
On entry: the subdiagonal elements of the tridiagonal matrix.
On exit: e is overwritten.
5: z(ldz,*) Real (Kind=nag_wp) array Input/Output
Note: the second dimension of the array z must be at least max(1,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 Integer Input
On entry: the first dimension of the array z as declared in the (sub)program from which f08jhf is called.
Constraints:
  • if compz='V' or 'I', ldz max(1,n) ;
  • otherwise ldz1.
7: work(max(1,lwork)) Real (Kind=nag_wp) array Workspace
On exit: if info=0, work(1) contains the minimum value of lwork required for optimal performance.
8: lwork Integer Input
On entry: the dimension of the array work as declared in the (sub)program from which f08jhf 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, lwork1;
  • if compz='V' and n>1, lwork(1+3×n+2×n×lg(n)+4×n2), where lg(n)= smallest integer k such that 2kn;
  • if compz='I' and n>1, lwork(1+4×n+n2).
Note: that for compz='V' or 'I' then if n is less than or equal to the minimum divide size, usually 25, then lwork need only be max(1,2×(n-1)) .
9: iwork(max(1,liwork)) Integer array Workspace
On exit: if info=0, iwork(1) returns the minimum liwork.
10: liwork Integer Input
On entry: the dimension of the array iwork as declared in the (sub)program from which f08jhf 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, liwork1;
  • if compz='V' and n>1, liwork(6+6×n+5×n×lg(n));
  • if compz='I' and n>1, liwork(3+5×n).
Note: that for compz='V' or 'I', then if n is less than or equal to the minimum divide size, usually 25, liwork need only be 1.
11: info Integer Output
On exit: info=0 unless the routine detects an error (see Section 6).

6 Error Indicators and Warnings

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 value/(n+1) through value 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 c(n) 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) c(n)ε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.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
f08jhf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f08jhf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 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, but for large matrices f08jhf is usually much faster.
The complex analogue of this routine is f08jvf.

10 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.

10.1 Program Text

Program Text (f08jhfe.f90)

10.2 Program Data

Program Data (f08jhfe.d)

10.3 Program Results

Program Results (f08jhfe.r)