NAG FL Interface
f02gcf (complex_gen_eigsys)
1
Purpose
f02gcf computes selected eigenvalues and eigenvectors of a complex general matrix.
2
Specification
Fortran Interface
Subroutine f02gcf ( |
crit, n, a, lda, wl, wu, mest, m, w, v, ldv, work, lwork, rwork, iwork, bwork, ifail) |
Integer, Intent (In) |
:: |
n, lda, mest, ldv, lwork |
Integer, Intent (Inout) |
:: |
ifail |
Integer, Intent (Out) |
:: |
m, iwork(n) |
Real (Kind=nag_wp), Intent (In) |
:: |
wl, wu |
Real (Kind=nag_wp), Intent (Out) |
:: |
rwork(2*n) |
Complex (Kind=nag_wp), Intent (Inout) |
:: |
a(lda,*), v(ldv,mest) |
Complex (Kind=nag_wp), Intent (Out) |
:: |
w(n), work(lwork) |
Logical, Intent (Out) |
:: |
bwork(n) |
Character (1), Intent (In) |
:: |
crit |
|
C Header Interface
#include <nag.h>
void |
f02gcf_ (const char *crit, const Integer *n, Complex a[], const Integer *lda, const double *wl, const double *wu, const Integer *mest, Integer *m, Complex w[], Complex v[], const Integer *ldv, Complex work[], const Integer *lwork, double rwork[], Integer iwork[], logical bwork[], Integer *ifail, const Charlen length_crit) |
|
C++ Header Interface
#include <nag.h> extern "C" {
void |
f02gcf_ (const char *crit, const Integer &n, Complex a[], const Integer &lda, const double &wl, const double &wu, const Integer &mest, Integer &m, Complex w[], Complex v[], const Integer &ldv, Complex work[], const Integer &lwork, double rwork[], Integer iwork[], logical bwork[], Integer &ifail, const Charlen length_crit) |
}
|
The routine may be called by the names f02gcf or nagf_eigen_complex_gen_eigsys.
3
Description
f02gcf computes selected eigenvalues and the corresponding right eigenvectors of a complex general matrix
:
Eigenvalues
may be selected either by
modulus, satisfying
or by
real part, satisfying
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:
– Integer
Input
-
On entry: , the order of the matrix .
Constraint:
.
-
3:
– Complex (Kind=nag_wp) array
Input/Output
-
Note: the second dimension of the array
a
must be at least
.
On entry: the by general matrix .
On exit: contains the Hessenberg form of the balanced input matrix
(see
Section 9).
-
4:
– Integer
Input
-
On entry: the first dimension of the array
a as declared in the (sub)program from which
f02gcf 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:
– Integer
Input
-
On entry: the second dimension of the array
v as declared in the (sub)program from which
f02gcf is called.
mest must be an upper bound on
, the number of eigenvalues and eigenvectors selected. No eigenvectors are computed if
.
Constraint:
.
-
8:
– Integer
Output
-
On exit: , the number of eigenvalues actually selected.
-
9:
– Complex (Kind=nag_wp) array
Output
-
On exit: the first
m elements of
w hold the selected eigenvalues; elements
to
n contain the other eigenvalues.
-
10:
– Complex (Kind=nag_wp) array
Output
-
On exit: contains the selected eigenvectors, with the th column holding the eigenvector associated with the eigenvalue (stored in ).
-
11:
– Integer
Input
-
On entry: the first dimension of the array
v as declared in the (sub)program from which
f02gcf is called.
Constraint:
.
-
12:
– Complex (Kind=nag_wp) array
Workspace
-
13:
– Integer
Input
-
On entry: the dimension of the array
work as declared in the (sub)program from which
f02gcf is called.
Constraint:
.
-
14:
– Real (Kind=nag_wp) array
Workspace
-
-
15:
– Integer array
Workspace
-
-
16:
– Logical array
Workspace
-
-
17:
– Integer
Input/Output
-
On entry:
ifail must be set to
,
or
to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value
or
is recommended. If message printing is undesirable, then the value
is recommended. Otherwise, the value
is recommended.
When the value or 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, .
Constraint: or .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, and .
Constraint: .
-
The algorithm failed to converge: only eigenvalues have been computed; no eigenvectors have been computed.
-
There are more than
mest eigenvalues in the specified range.
m (number of eigenvalues in range)
and
. No eigenvectors have been computed. Rerun with second dimension of
.
-
Inverse iteration failed to compute all the specified eigenvectors. The number of eigenvectors which failed to converge is
. The corresponding columns of
v are set to zero.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See
Section 9 in the Introduction to the NAG Library FL Interface 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
f08psf with
to compute the Schur form of
, followed by
f08qyf.
8
Parallelism and Performance
f02gcf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f02gcf 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.
f02gcf 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 a unitary 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 is normalized so that , and the element of largest absolute value is real.
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 f02gcf.
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
which lie in the range
, and their corresponding eigenvectors, where
10.1
Program Text
10.2
Program Data
10.3
Program Results