hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_lapack_dsteqr (f08je)

Purpose

nag_lapack_dsteqr (f08je) computes all the eigenvalues and, optionally, all the eigenvectors of a real symmetric tridiagonal matrix, or of a real symmetric matrix which has been reduced to tridiagonal form.

Syntax

[d, e, z, info] = f08je(compz, d, e, 'n', n, 'z', z)
[d, e, z, info] = nag_lapack_dsteqr(compz, d, e, 'n', n, 'z', z)

Description

nag_lapack_dsteqr (f08je) computes all the eigenvalues and, optionally, all the eigenvectors of a real symmetric tridiagonal matrix TT. In other words, it can compute the spectral factorization of TT as
T = ZΛZT,
T=ZΛZT,
where ΛΛ is a diagonal matrix whose diagonal elements are the eigenvalues λiλi, and ZZ is the orthogonal matrix whose columns are the eigenvectors zizi. Thus
Tzi = λizi,  i = 1,2,,n.
Tzi=λizi,  i=1,2,,n.
The function may also be used to compute all the eigenvalues and eigenvectors of a real symmetric matrix AA which has been reduced to tridiagonal form TT:
A = QTQT, where ​Q​ is orthogonal
= (QZ)Λ(QZ)T.
A =QTQT, where ​Q​ is orthogonal =(QZ)Λ(QZ)T.
In this case, the matrix QQ must be formed explicitly and passed to nag_lapack_dsteqr (f08je), which must be called with compz = 'V'compz='V'. The functions which must be called to perform the reduction to tridiagonal form and form QQ are:
full matrix nag_lapack_dsytrd (f08fe) and nag_lapack_dorgtr (f08ff)
full matrix, packed storage nag_lapack_dsptrd (f08ge) and nag_lapack_dopgtr (f08gf)
band matrix nag_lapack_dsbtrd (f08he) with vect = 'V'vect='V'.
nag_lapack_dsteqr (f08je) uses the implicitly shifted QRQR algorithm, switching between the QRQR and QLQL variants in order to handle graded matrices effectively (see Greenbaum and Dongarra (1980)). The eigenvectors are normalized so that zi2 = 1zi2=1, but are determined only to within a factor ± 1±1.
If only the eigenvalues of TT are required, it is more efficient to call nag_lapack_dsterf (f08jf) instead. If TT is positive definite, small eigenvalues can be computed more accurately by nag_lapack_dpteqr (f08jg).

References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Greenbaum A and Dongarra J J (1980) Experiments with QR/QL methods for the symmetric triangular eigenproblem LAPACK Working Note No. 17 (Technical Report CS-89-92) University of Tennessee, Knoxville
Parlett B N (1998) The Symmetric Eigenvalue Problem SIAM, Philadelphia

Parameters

Compulsory Input Parameters

1:     compz – string (length ≥ 1)
Indicates whether the eigenvectors are to be computed.
compz = 'N'compz='N'
Only the eigenvalues are computed (and the array z is not referenced).
compz = 'I'compz='I'
The eigenvalues and eigenvectors of TT are computed (and the array z is initialized by the function).
compz = 'V'compz='V'
The eigenvalues and eigenvectors of AA are computed (and the array z must contain the matrix QQ on entry).
Constraint: compz = 'N'compz='N', 'V''V' or 'I''I'.
2:     d( : :) – double array
Note: the dimension of the array d must be at least max (1,n)max(1,n).
The diagonal elements of the tridiagonal matrix TT.
3:     e( : :) – double array
Note: the dimension of the array e must be at least max (1,n1)max(1,n-1).
The off-diagonal elements of the tridiagonal matrix TT.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The first dimension of the array d and the second dimension of the array d. (An error is raised if these dimensions are not equal.)
nn, the order of the matrix TT.
Constraint: n0n0.
2:     z(ldz, : :) – double array
The first dimension, ldz, of the array z must satisfy
  • if compz = 'I'compz='I' or 'V''V', ldz max (1,n) ldz max(1,n) ;
  • if compz = 'N'compz='N', ldz1ldz1.
The second dimension of the array must be at least max (1,n)max(1,n) if compz = 'V'compz='V' or 'I''I' and at least 11 if compz = 'N'compz='N'
If compz = 'V'compz='V', z must contain the orthogonal matrix QQ from the reduction to tridiagonal form.
If compz = 'I'compz='I', z need not be set.

Input Parameters Omitted from the MATLAB Interface

ldz work

Output Parameters

1:     d( : :) – double array
Note: the dimension of the array d must be at least max (1,n)max(1,n).
The nn eigenvalues in ascending order, unless INFO > 0INFO>0 (in which case see Section [Error Indicators and Warnings]).
2:     e( : :) – double array
Note: the dimension of the array e must be at least max (1,n1)max(1,n-1).
3:     z(ldz, : :) – double array
The first dimension, ldz, of the array z will be
  • if compz = 'I'compz='I' or 'V''V', ldz max (1,n) ldz max(1,n) ;
  • if compz = 'N'compz='N', ldz1ldz1.
The second dimension of the array will be max (1,n)max(1,n) if compz = 'V'compz='V' or 'I''I' and at least 11 if compz = 'N'compz='N'
If compz = 'I'compz='I' or 'V''V', the nn required orthonormal eigenvectors stored as columns of ZZ; the iith column corresponds to the iith eigenvalue, where i = 1,2,,ni=1,2,,n, unless INFO > 0INFO>0.
If compz = 'N'compz='N', z is not referenced.
4:     info – int64int32nag_int scalar
info = 0info=0 unless the function detects an error (see Section [Error Indicators and Warnings]).

Error Indicators and Warnings

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

  info = iinfo=-i
If info = iinfo=-i, parameter ii had an illegal value on entry. The parameters are numbered as follows:
1: compz, 2: n, 3: d, 4: e, 5: z, 6: ldz, 7: work, 8: info.
It is possible that info refers to a parameter that is omitted from the MATLAB interface. This usually indicates that an error in one of the other input parameters has caused an incorrect value to be inferred.
W INFO > 0INFO>0
The algorithm has failed to find all the eigenvalues after a total of 30 × n30×n iterations. In this case, d and e contain on exit the diagonal and off-diagonal elements, respectively, of a tridiagonal matrix orthogonally similar to TT. If info = iinfo=i, then ii off-diagonal elements have not converged to zero.

Accuracy

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

Further Comments

The total number of floating point operations is typically about 24n224n2 if compz = 'N'compz='N' and about 7n37n3 if compz = 'V'compz='V' or 'I''I', but depends on how rapidly the algorithm converges. When compz = 'N'compz='N', the operations are all performed in scalar mode; the additional operations to compute the eigenvectors when compz = 'V'compz='V' or 'I''I' can be vectorized and on some machines may be performed much faster.
The complex analogue of this function is nag_lapack_zsteqr (f08js).

Example

function nag_lapack_dsteqr_example
compz = 'I';
d = [-6.99;
     7.92;
     2.34;
     0.32];
e = [-0.44;
     -2.63;
     -1.18];
z = zeros(4, 4);
[dOut, eOut, z, info] = nag_lapack_dsteqr(compz, d, e, 'z', z)
 

dOut =

   -7.0037
   -0.4059
    2.0028
    8.9968


eOut =

     0
     0
     0


z =

   -0.9995   -0.0109   -0.0167   -0.0255
   -0.0310    0.1627    0.3408    0.9254
   -0.0089    0.5170    0.7696   -0.3746
   -0.0014    0.8403   -0.5397    0.0509


info =

                    0


function f08je_example
compz = 'I';
d = [-6.99;
     7.92;
     2.34;
     0.32];
e = [-0.44;
     -2.63;
     -1.18];
z = zeros(4, 4);
[dOut, eOut, z, info] = f08je(compz, d, e, 'z', z)
 

dOut =

   -7.0037
   -0.4059
    2.0028
    8.9968


eOut =

     0
     0
     0


z =

   -0.9995   -0.0109   -0.0167   -0.0255
   -0.0310    0.1627    0.3408    0.9254
   -0.0089    0.5170    0.7696   -0.3746
   -0.0014    0.8403   -0.5397    0.0509


info =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013