PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_dstevd (f08jc)
Purpose
nag_lapack_dstevd (f08jc) computes all the eigenvalues and, optionally, all the eigenvectors of a real symmetric tridiagonal matrix.
If the eigenvectors are requested, then it uses a divide-and-conquer algorithm to compute eigenvalues and eigenvectors. However, if only eigenvalues are required, then it uses the Pal–Walker–Kahan variant of the or algorithm.
Syntax
Description
nag_lapack_dstevd (f08jc) 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
References
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Parameters
Compulsory Input Parameters
- 1:
– string (length ≥ 1)
-
Indicates whether eigenvectors are computed.
- Only eigenvalues are computed.
- Eigenvalues and eigenvectors are computed.
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 . The th element of this array is used as workspace.
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:
.
Output Parameters
- 1:
– double array
-
The dimension of the array
d will be
The eigenvalues of the matrix in ascending order.
- 2:
– double array
-
The dimension of the array
e will be
e is overwritten with intermediate results.
- 3:
– double array
-
The first dimension,
, of the array
z will be
- if , ;
- if , .
The second dimension of the array
z will be
if
and at least
if
.
If
,
z stores the orthogonal matrix
which contains the eigenvectors of
.
If
,
z is not referenced.
- 4:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
-
If , parameter had an illegal value on entry. The parameters are numbered as follows:
1:
job, 2:
n, 3:
d, 4:
e, 5:
z, 6:
ldz, 7:
work, 8:
lwork, 9:
iwork, 10:
liwork, 11:
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.
-
-
if and , the algorithm failed to converge; elements of an intermediate tridiagonal form did not converge to zero; if and , then the algorithm failed to compute an eigenvalue while working on the submatrix lying in rows and column through .
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
There is no complex analogue of this function.
Example
This example computes all the eigenvalues and eigenvectors of the symmetric tridiagonal matrix
, where
Open in the MATLAB editor:
f08jc_example
function f08jc_example
fprintf('f08jc example results\n\n');
n = 4;
d = [1; 4; 9; 16];
e = [1; 2; 3; 0];
job = 'Vectors';
[w, ~, z, info] = f08jc( ...
job, d, e);
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);
f08jc example results
Eigenvalues:
0.6476 3.5470 8.6578 17.1477
Eigenvectors:
0.9396 0.3388 0.0494 0.0034
-0.3311 0.8628 0.3781 0.0545
0.0853 -0.3648 0.8558 0.3568
-0.0167 0.0879 -0.3497 0.9326
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015