PDF version (NAG web site
, 64-bit version, 64-bit version)
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
Description
nag_lapack_dsteqr (f08je) computes all the eigenvalues and, optionally, all the eigenvectors of a real symmetric tridiagonal matrix
.
In other words, it can compute the spectral factorization of
as
where
is a diagonal matrix whose diagonal elements are the eigenvalues
, and
is the orthogonal matrix whose columns are the eigenvectors
. Thus
The function may also be used to compute all the eigenvalues and eigenvectors of a real symmetric matrix
which has been reduced to tridiagonal form
:
In this case, the matrix
must be formed explicitly and passed to
nag_lapack_dsteqr (f08je), which must be called with
. The functions which must be called to perform the reduction to tridiagonal form and form
are:
nag_lapack_dsteqr (f08je) uses the implicitly shifted
algorithm, switching between the
and
variants in order to handle graded matrices effectively (see
Greenbaum and Dongarra (1980)). The eigenvectors are normalized so that
, but are determined only to within a factor
.
If only the eigenvalues of
are required, it is more efficient to call
nag_lapack_dsterf (f08jf) instead. If
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
http://www.netlib.org/lapack/lawnspdf/lawn17.pdf
Parlett B N (1998) The Symmetric Eigenvalue Problem SIAM, Philadelphia
Parameters
Compulsory Input Parameters
- 1:
– string (length ≥ 1)
-
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 must contain the matrix on entry).
- The eigenvalues and eigenvectors of are computed (and the array z is initialized by the function).
Constraint:
, or .
- 2:
– double array
-
The dimension of the array
d
must be at least
The diagonal elements of the tridiagonal matrix .
- 3:
– double array
-
The dimension of the array
e
must be at least
The off-diagonal elements of the tridiagonal matrix .
Optional Input Parameters
- 1:
– 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.)
, the order of the matrix .
Constraint:
.
- 2:
– double array
-
The first dimension,
, of the array
z must satisfy
- if or , ;
- if , .
The second dimension of the array
z must be at least
if
or
and at least
if
.
If
,
z must contain the orthogonal matrix
from the reduction to tridiagonal form.
If
,
z need not be set.
Output Parameters
- 1:
– double array
-
The dimension of the array
d will be
The
eigenvalues in ascending order, unless
(in which case see
Error Indicators and Warnings).
- 2:
– double array
-
The dimension of the array
e will be
- 3:
– double array
-
The first dimension,
, of the array
z will be
- if or , ;
- if , .
The second dimension of the array
z will be
if
or
and at least
if
.
If
or
, the
required orthonormal eigenvectors stored as columns of
; the
th column corresponds to the
th eigenvalue, where
, unless
.
If
,
z is not referenced.
- 4:
– int64int32nag_int scalar
unless the function detects an error (see
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.
-
If , parameter 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
-
The algorithm has failed to find all the eigenvalues after a total of
iterations. In this case,
d and
e contain on exit the diagonal and off-diagonal elements, respectively, of a tridiagonal matrix orthogonally similar to
. If
, then
off-diagonal elements have not converged to zero.
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.
Further Comments
The total number of floating-point operations is typically about if and about if or , but depends on how rapidly the algorithm converges. When , the operations are all performed in scalar mode; the additional operations to compute the eigenvectors when or can be vectorized and on some machines may be performed much faster.
The complex analogue of this function is
nag_lapack_zsteqr (f08js).
Example
This example computes all the eigenvalues and eigenvectors of the symmetric tridiagonal matrix
, where
See also the examples for
nag_lapack_dorgtr (f08ff),
nag_lapack_dopgtr (f08gf) or
nag_lapack_dsbtrd (f08he), which illustrate the use of this function to compute the eigenvalues and eigenvectors of a full or band symmetric matrix.
Open in the MATLAB editor:
f08je_example
function f08je_example
fprintf('f08je example results\n\n');
n = 4;
d = [-6.99; 7.92; 2.34; 0.32];
e = [-0.44; -2.63; -1.18];
compz = 'I';
z = zeros(n, n);
[w, ~, z, info] = f08je( ...
compz, d, e, 'z', z);
for j = 1:n
[~,k] = max(abs(z(:,j)));
if z(k,j) < 0;
z(:,j) = -z(:,j);
end
end
disp('Eigenvalues');
disp(w');
disp('Eigenvectors');
disp(z);
f08je example results
Eigenvalues
-7.0037 -0.4059 2.0028 8.9968
Eigenvectors
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
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015