PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_zstegr (f08jy)
Purpose
nag_lapack_zstegr (f08jy) computes all the eigenvalues and, optionally, all the eigenvectors of a real by symmetric tridiagonal matrix.
Syntax
[
d,
e,
m,
w,
z,
isuppz,
info] = f08jy(
jobz,
range,
d,
e,
vl,
vu,
il,
iu, 'n',
n)
[
d,
e,
m,
w,
z,
isuppz,
info] = nag_lapack_zstegr(
jobz,
range,
d,
e,
vl,
vu,
il,
iu, 'n',
n)
Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 23: |
abstol was made an optional input parameter |
Description
nag_lapack_zstegr (f08jy) computes all the eigenvalues and, optionally, the eigenvectors, of a real symmetric tridiagonal matrix
. That is, the function computes the spectral factorization of
given by
where
is a diagonal matrix whose diagonal elements are the eigenvalues,
, of
and
is an orthogonal matrix whose columns are the eigenvectors,
, of
. Thus
The function stores the real orthogonal matrix
in a complex array, so that it may also be used to compute all the eigenvalues and eigenvectors of a complex Hermitian matrix
which has been reduced to tridiagonal form
:
In this case, the matrix
must be explicitly applied to the output matrix
. The functions which must be called to perform the reduction to tridiagonal form and apply
are:
This function uses the dqds and the Relatively Robust Representation algorithms to compute the eigenvalues and eigenvectors respectively; see for example
Parlett and Dhillon (2000) and
Dhillon and Parlett (2004) for further details.
nag_lapack_zstegr (f08jy) can usually compute all the eigenvalues and eigenvectors in
floating-point operations and so, for large matrices, is often considerably faster than the other symmetric tridiagonal functions in this chapter when all the eigenvectors are required, particularly so compared to those functions that are based on the
algorithm.
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
http://www.netlib.org/lapack/lug
Barlow J and Demmel J W (1990) Computing accurate eigensystems of scaled diagonally dominant matrices SIAM J. Numer. Anal. 27 762–791
Dhillon I S and Parlett B N (2004) Orthogonal eigenvectors and relative gaps. SIAM J. Appl. Math. 25 858–899
Parlett B N and Dhillon I S (2000) Relatively robust representations of symmetric tridiagonals Linear Algebra Appl. 309 121–151
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:
– string (length ≥ 1)
-
Indicates which eigenvalues should be returned.
- All eigenvalues will be found.
- All eigenvalues in the half-open interval will be found.
- The ilth through iuth eigenvectors will be found.
Constraint:
, or .
- 3:
– double array
-
The dimension of the array
d
must be at least
The diagonal elements of the tridiagonal matrix .
- 4:
– double array
-
The dimension of the array
e
must be at least
contains the subdiagonal elements of the tridiagonal matrix . need not be set.
- 5:
– double scalar
- 6:
– double scalar
-
If
,
vl and
vu contain the lower and upper bounds respectively of the interval to be searched for eigenvalues.
If
or
,
vl and
vu are not referenced.
Constraint:
if , .
- 7:
– int64int32nag_int scalar
- 8:
– int64int32nag_int scalar
-
If
,
il and
iu contains the indices (in ascending order) of the smallest and largest eigenvalues to be returned, respectively.
If
or
,
il and
iu are not referenced.
Constraints:
- if and , ;
- if and , and .
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the array
d.
, the order of the matrix .
Constraint:
.
Output Parameters
- 1:
– double array
-
The dimension of the array
d will be
- 2:
– double array
-
The dimension of the array
e will be
- 3:
– int64int32nag_int scalar
-
The total number of eigenvalues found.
.
If , .
If , .
- 4:
– double array
-
The dimension of the array
w will be
The eigenvalues in ascending order.
- 5:
– complex array
-
The first dimension,
, of the array
z will be
- if , ;
- otherwise .
The second dimension of the array
z will be
if
and
otherwise.
If
, then if
, the columns of
z contain the orthonormal eigenvectors of the matrix
, with the
th column of
holding the eigenvector associated with
.
If
,
z is not referenced.
- 6:
– int64int32nag_int array
-
The dimension of the array
isuppz will be
The support of the eigenvectors in , i.e., the indices indicating the nonzero elements in . The th eigenvector is nonzero only in elements through .
- 7:
– 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:
jobz, 2:
range, 3:
n, 4:
d, 5:
e, 6:
vl, 7:
vu, 8:
il, 9:
iu, 10:
abstol, 11:
m, 12:
w, 13:
z, 14:
ldz, 15:
isuppz, 16:
work, 17:
lwork, 18:
iwork, 19:
liwork, 20:
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 algorithm failed to converge, if , inverse iteration failed to converge.
Accuracy
See the description for
abstol. See also Section 4.7 of
Anderson et al. (1999) and
Barlow and Demmel (1990) for further details.
Further Comments
The total number of floating-point operations required to compute all the eigenvalues and eigenvectors is approximately proportional to .
The real analogue of this function is
nag_lapack_dstegr (f08jl).
Example
This example finds all the eigenvalues and eigenvectors of the symmetric tridiagonal matrix
abstol is set to zero so that the default tolerance of
is used.
Open in the MATLAB editor:
f08jy_example
function f08jy_example
fprintf('f08jy example results\n\n');
d = [1; 4; 9; 16];
e = [1; 2; 3; 0];
jobz = 'V';
range = 'A';
vl = 0;
vu = 0;
il = int64(0);
iu = int64(0);
abstol = 0;
[~, ~, m, w, z, ~, info] = f08jy( ...
jobz, range, d, e, vl, vu, il, iu);
for i = 1:m
[~,k] = max(abs(real(z(:,i)))+abs(imag(z(:,i))));
z(:,i) = z(:,i)*conj(z(k,i))/abs(z(k,i));
end
disp(' Eigenvalues of A:');
disp(w');
disp(' Corresponding eigenvectors:');
disp(z);
f08jy example results
Eigenvalues of A:
0.6476 3.5470 8.6578 17.1477
Corresponding 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