NAG Library Routine Document
f02ecf
(real_gen_eigsys)
1
Purpose
f02ecf computes selected eigenvalues and eigenvectors of a real general matrix.
2
Specification
Fortran Interface
Subroutine f02ecf ( |
crit,
n,
a,
lda,
wl,
wu,
mest,
m,
wr,
wi,
vr,
ldvr,
vi,
ldvi,
work,
lwork,
iwork,
bwork,
ifail) |
Integer, Intent (In) | :: |
n,
lda,
mest,
ldvr,
ldvi,
lwork | Integer, Intent (Inout) | :: |
ifail | Integer, Intent (Out) | :: |
m,
iwork(n) | Real (Kind=nag_wp), Intent (In) | :: |
wl,
wu | Real (Kind=nag_wp), Intent (Inout) | :: |
a(lda,n),
vr(ldvr,mest),
vi(ldvi,mest) | Real (Kind=nag_wp), Intent (Out) | :: |
wr(n),
wi(n),
work(lwork) | Logical, Intent (Out) | :: |
bwork(n) | Character (1), Intent (In) | :: |
crit |
|
C Header Interface
#include nagmk26.h
void |
f02ecf_ (
const char *crit,
const Integer *n,
double a[],
const Integer *lda,
const double *wl,
const double *wu,
const Integer *mest,
Integer *m,
double wr[],
double wi[],
double vr[],
const Integer *ldvr,
double vi[],
const Integer *ldvi,
double work[],
const Integer *lwork,
Integer iwork[],
logical bwork[],
Integer *ifail,
const Charlen length_crit) |
|
3
Description
f02ecf 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.
4
References
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
5
Arguments
- 1: – Character(1)Input
-
On entry: indicates the criterion for selecting eigenvalues.
- Eigenvalues are selected according to their moduli: .
- Eigenvalues are selected according to their real parts: .
Constraint:
or .
- 2: – IntegerInput
-
On entry: , the order of the matrix .
Constraint:
.
- 3: – Real (Kind=nag_wp) arrayInput/Output
-
On entry: the by general matrix .
On exit: contains the Hessenberg form of the balanced input matrix
(see
Section 9).
- 4: – IntegerInput
-
On entry: the first dimension of the array
a as declared in the (sub)program from which
f02ecf is called.
Constraint:
.
- 5: – Real (Kind=nag_wp)Input
- 6: – Real (Kind=nag_wp)Input
-
On entry:
and
, the lower and upper bounds on the criterion for the selected eigenvalues (see
crit).
Constraint:
.
- 7: – IntegerInput
-
On entry: the second dimension of the arrays
vr and
vi as declared in the (sub)program from which
f02ecf is called.
mest must be an upper bound on
, the number of eigenvalues and eigenvectors selected. No eigenvectors are computed if
.
Constraint:
.
- 8: – IntegerOutput
-
On exit: , the number of eigenvalues actually selected.
- 9: – Real (Kind=nag_wp) arrayOutput
- 10: – Real (Kind=nag_wp) arrayOutput
-
On exit: 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
Section 9.
- 11: – Real (Kind=nag_wp) arrayOutput
-
On exit: 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 ).
- 12: – IntegerInput
-
On entry: the first dimension of the array
vr as declared in the (sub)program from which
f02ecf is called.
Constraint:
.
- 13: – Real (Kind=nag_wp) arrayOutput
-
On exit: 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 ).
- 14: – IntegerInput
-
On entry: the first dimension of the array
vi as declared in the (sub)program from which
f02ecf is called.
Constraint:
.
- 15: – Real (Kind=nag_wp) arrayWorkspace
- 16: – IntegerInput
-
On entry: the dimension of the array
work as declared in the (sub)program from which
f02ecf is called.
Constraint:
.
- 17: – Integer arrayWorkspace
-
- 18: – Logical arrayWorkspace
-
- 19: – IntegerInput/Output
-
On entry:
ifail must be set to
,
. If you are unfamiliar with this argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this argument, the recommended value is
.
When the value is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
-
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
.
-
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.
See
Section 3.9 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.8 in How to Use the NAG Library and its Documentation for further information.
Dynamic memory allocation failed.
See
Section 3.7 in How to Use the NAG Library and its Documentation for further information.
7
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
Section 9), 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
f08pef (dhseqr) with
to compute the Schur form of
, followed by
f08qlf (dtrsna).
8
Parallelism and Performance
f02ecf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f02ecf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
f02ecf
calls routines 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 routine 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 and positive.
The inverse iteration routine 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 f02ecf.
The time taken by the routine is approximately proportional to .
The routine can be used to compute
all eigenvalues and eigenvectors, by setting
wl large and negative, and
wu large and positive.
10
Example
This example computes those eigenvalues of the matrix
whose moduli lie in the range
, and their corresponding eigenvectors, where
10.1
Program Text
Program Text (f02ecfe.f90)
10.2
Program Data
Program Data (f02ecfe.d)
10.3
Program Results
Program Results (f02ecfe.r)