PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_dpteqr (f08jg)
Purpose
nag_lapack_dpteqr (f08jg) computes all the eigenvalues and, optionally, all the eigenvectors of a real symmetric positive definite tridiagonal matrix, or of a real symmetric positive definite matrix which has been reduced to tridiagonal form.
Syntax
Description
nag_lapack_dpteqr (f08jg) computes all the eigenvalues and, optionally, all the eigenvectors of a real symmetric positive definite 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 positive definite matrix
which has been reduced to tridiagonal form
:
In this case, the matrix
must be formed explicitly and passed to
nag_lapack_dpteqr (f08jg), which must be called with
. The functions which must be called to perform the reduction to tridiagonal form and form
are:
nag_lapack_dpteqr (f08jg) first factorizes
as
where
is unit lower bidiagonal and
is diagonal. It forms the bidiagonal matrix
, and then calls
nag_lapack_dbdsqr (f08me) to compute the singular values of
which are the same as the eigenvalues of
. The method used by the function allows high relative accuracy to be achieved in the small eigenvalues of
. The eigenvectors are normalized so that
, but are determined only to within a factor
.
References
Barlow J and Demmel J W (1990) Computing accurate eigensystems of scaled diagonally dominant matrices SIAM J. Numer. Anal. 27 762–791
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 .
- 4:
– 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.
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 in descending order, unless
, in which case
d is overwritten.
- 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
-
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.
-
-
If , the leading minor of order is not positive definite and the Cholesky factorization of could not be completed. Hence itself is not positive definite.
If , the algorithm to compute the singular values of the Cholesky factor failed to converge; off-diagonal elements did not converge to zero.
Accuracy
The eigenvalues and eigenvectors of are computed to high relative accuracy which means that if they vary widely in magnitude, then any small eigenvalues (and corresponding eigenvectors) will be computed more accurately than, for example, with the standard method. However, the reduction to tridiagonal form (prior to calling the function) may exclude the possibility of obtaining high relative accuracy in the small eigenvalues of the original matrix if its eigenvalues vary widely in magnitude.
To be more precise, let
be the tridiagonal matrix defined by
, where
is diagonal with
, and
for all
. If
is an exact eigenvalue of
and
is the corresponding computed value, then
where
is a modestly increasing function of
,
is the
machine precision, and
is the condition number of
with respect to inversion defined by:
.
If
is the corresponding exact eigenvector of
, and
is the corresponding computed eigenvector, then the angle
between them is bounded as follows:
where
is the relative gap between
and the other eigenvalues, defined by
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_zpteqr (f08ju).
Example
This example computes all the eigenvalues and eigenvectors of the symmetric positive definite tridiagonal matrix
, where
Open in the MATLAB editor:
f08jg_example
function f08jg_example
fprintf('f08jg example results\n\n');
n = 4;
d = [4.16; 5.25; 1.09; 0.62];
e = [3.17; -0.97; 0.55];
compz = 'I';
z = zeros(4, 4);
[w, ~, z, info] = f08jg( ...
compz, d, e, 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);
f08jg example results
Eigenvalues
8.0023 1.9926 1.0014 0.1237
Eigenvectors
0.6326 0.6245 -0.4191 0.1847
0.7668 -0.4270 0.4176 -0.2352
-0.1082 0.6071 0.4594 -0.6393
-0.0081 0.2432 0.6625 0.7084
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015