PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_eigen_real_gen_eigsys (f02ec)
Purpose
nag_eigen_real_gen_eigsys (f02ec) computes selected eigenvalues and eigenvectors of a real general matrix.
Syntax
[
a,
m,
wr,
wi,
vr,
vi,
ifail] = f02ec(
crit,
a,
wl,
wu,
mest, 'n',
n)
[
a,
m,
wr,
wi,
vr,
vi,
ifail] = nag_eigen_real_gen_eigsys(
crit,
a,
wl,
wu,
mest, 'n',
n)
Description
nag_eigen_real_gen_eigsys (f02ec) computes selected eigenvalues and the corresponding right eigenvectors of a real general matrix
:
Eigenvalues
may be selected either by
modulus, satisfying:
or by
real part, satisfying:
Note that even though is real, and may be complex. If is an eigenvector corresponding to a complex eigenvalue , then the complex conjugate vector is the eigenvector corresponding to the complex conjugate eigenvalue . The eigenvalues in a complex conjugate pair and are either both selected or both not selected.
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 the criterion for selecting eigenvalues.
- Eigenvalues are selected according to their moduli: .
- Eigenvalues are selected according to their real parts: .
Constraint:
or .
- 2:
– double array
-
lda, the first dimension of the array, must satisfy the constraint
.
The by general matrix .
- 3:
– double scalar
- 4:
– double scalar
-
and
, the lower and upper bounds on the criterion for the selected eigenvalues (see
crit).
Constraint:
.
- 5:
– int64int32nag_int scalar
-
The second dimension of the arrays
vr and
vi.
mest must be an upper bound on
, the number of eigenvalues and eigenvectors selected. No eigenvectors are computed if
.
Constraint:
.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the second dimension of the array
a.
, the order of the matrix .
Constraint:
.
Output Parameters
- 1:
– double array
-
Contains the Hessenberg form of the balanced input matrix
(see
Further Comments).
- 2:
– int64int32nag_int scalar
-
, the number of eigenvalues actually selected.
- 3:
– double array
- 4:
– double array
-
The first
m elements of
wr and
wi hold the real and imaginary parts, respectively, of the selected eigenvalues; elements
to
n contain the other eigenvalues. Complex conjugate pairs of eigenvalues are stored in consecutive elements of the arrays, with the eigenvalue having positive imaginary part first. See also
Further Comments.
- 5:
– double array
-
Contains the real parts of the selected eigenvectors, with the th column holding the real part of the eigenvector associated with the eigenvalue (stored in and ).
- 6:
– double array
-
Contains the imaginary parts of the selected eigenvectors, with the th column holding the imaginary part of the eigenvector associated with the eigenvalue (stored in and ).
- 7:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
-
On entry, | or , |
or | , |
or | , |
or | , |
or | , |
or | , |
or | , |
or | . |
-
-
The algorithm failed to compute all the eigenvalues. No eigenvectors have been computed.
-
-
There are more than
mest eigenvalues in the specified range. The actual number of eigenvalues in the range is returned in
m. No eigenvectors have been computed. Rerun with the second dimension of
vr and
.
- W
-
Inverse iteration failed to compute all the specified eigenvectors. If an eigenvector failed to converge, the corresponding column of
vr and
vi is set to zero.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
If
is an exact eigenvalue, and
is the corresponding computed value, then
where
is a modestly increasing function of
,
is the
machine precision, and
is the reciprocal condition number of
;
is the balanced form of the original matrix
(see
Further Comments), and
.
If
is the corresponding exact eigenvector, and
is the corresponding computed eigenvector, then the angle
between them is bounded as follows:
where
is the reciprocal condition number of
.
The condition numbers
and
may be computed from the Hessenberg form of the balanced matrix
which is returned in the array
a. This requires calling
nag_lapack_dhseqr (f08pe) with
to compute the Schur form of
, followed by
nag_lapack_dtrsna (f08ql).
Further Comments
nag_eigen_real_gen_eigsys (f02ec)
calls functions from LAPACK in
Chapter F08. It
first balances the matrix, using a diagonal similarity transformation to reduce its norm; and then reduces the balanced matrix
to upper Hessenberg form
, using an orthogonal similarity transformation:
. The function uses the Hessenberg
algorithm to compute all the eigenvalues of
, which are the same as the eigenvalues of
. It computes the eigenvectors of
which correspond to the selected eigenvalues, using inverse iteration. It premultiplies the eigenvectors by
to form the eigenvectors of
; and finally transforms the eigenvectors to those of the original matrix
.
Each eigenvector (real or complex) is normalized so that , and the element of largest absolute value is real.
The inverse iteration function may make a small perturbation to the real parts of close eigenvalues, and this may shift their moduli just outside the specified bounds. If you are relying on eigenvalues being within the bounds, you should test them on return from nag_eigen_real_gen_eigsys (f02ec).
The time taken by the function is approximately proportional to .
The function can be used to compute
all eigenvalues and eigenvectors, by setting
wl large and negative, and
wu large and positive.
Example
This example computes those eigenvalues of the matrix
whose moduli lie in the range
, and their corresponding eigenvectors, where
Open in the MATLAB editor:
f02ec_example
function f02ec_example
fprintf('f02ec example results\n\n');
a = [ 0.35, 0.45, -0.14, -0.17;
0.09, 0.07, -0.54, 0.35;
-0.44, -0.33, -0.03, 0.17;
0.25, -0.32, -0.13, 0.11];
crit = 'Moduli';
wl = 0.2;
wu = 0.5;
mest = int64(3);
[a, m, wr, wi, vr, vi, ifail] = f02ec( ...
crit, a, wl, wu, mest);
evals = wr(1:m) + i*wi(1:m);
disp('Eigenvalues');
disp(evals);
evecs = vr(:,1:m) + i*vi(:,1:m);
disp('Eigenvectors');
disp(evecs);
f02ec example results
Eigenvalues
-0.0994 + 0.4008i
-0.0994 - 0.4008i
Eigenvectors
-0.1933 + 0.2546i -0.1933 - 0.2546i
0.2519 - 0.5224i 0.2519 + 0.5224i
0.0972 - 0.3084i 0.0972 + 0.3084i
0.6760 + 0.0000i 0.6760 + 0.0000i
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015