NAG Library Routine Document

f02gcf (complex_gen_eigsys)


f02gcf computes selected eigenvalues and eigenvectors of a complex general matrix.


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 <nagmk26.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)


f02gcf computes selected eigenvalues and the corresponding right eigenvectors of a complex general matrix A:
Eigenvalues λi may be selected either by modulus, satisfying
or by real part, satisfying


Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore


1:     crit – Character(1)Input
On entry: indicates the criterion for selecting eigenvalues.
Eigenvalues are selected according to their moduli: wlλiwu.
Eigenvalues are selected according to their real parts: wlReλiwu.
Constraint: crit='M' or 'R'.
2:     n – IntegerInput
On entry: n, the order of the matrix A.
Constraint: n0.
3:     alda* – Complex (Kind=nag_wp) arrayInput/Output
Note: the second dimension of the array a must be at least max1,n.
On entry: the n by n general matrix A.
On exit: contains the Hessenberg form of the balanced input matrix A (see Section 9).
4:     lda – IntegerInput
On entry: the first dimension of the array a as declared in the (sub)program from which f02gcf is called.
Constraint: ldamax1,n.
5:     wl – Real (Kind=nag_wp)Input
6:     wu – Real (Kind=nag_wp)Input
On entry: wl and wu, the lower and upper bounds on the criterion for the selected eigenvalues (see crit).
Constraint: wu>wl.
7:     mest – IntegerInput
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 m, the number of eigenvalues and eigenvectors selected. No eigenvectors are computed if mest<m.
Constraint: mestmax1,m.
8:     m – IntegerOutput
On exit: m, the number of eigenvalues actually selected.
9:     wn – Complex (Kind=nag_wp) arrayOutput
On exit: the first m elements of w hold the selected eigenvalues; elements m+1 to n contain the other eigenvalues.
10:   vldvmest – Complex (Kind=nag_wp) arrayOutput
On exit: contains the selected eigenvectors, with the ith column holding the eigenvector associated with the eigenvalue λi (stored in wi).
11:   ldv – IntegerInput
On entry: the first dimension of the array v as declared in the (sub)program from which f02gcf is called.
Constraint: ldvmax1,n.
12:   worklwork – Complex (Kind=nag_wp) arrayWorkspace
13:   lwork – IntegerInput
On entry: the dimension of the array work as declared in the (sub)program from which f02gcf is called.
Constraint: lworkmax1,n×n+2.
14:   rwork2×n – Real (Kind=nag_wp) arrayWorkspace
15:   iworkn – Integer arrayWorkspace
16:   bworkn – Logical arrayWorkspace
17:   ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1 or 1. 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 -1 or 1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, crit=value.
Constraint: crit='M' or 'R'.
On entry, lda=value and n=value.
Constraint: ldamax1,n.
On entry, ldv=value and n=value.
Constraint: ldvmax1,n.
On entry, lwork=value and n=value.
Constraint: lworkmax1,n×n+2.
On entry, mest=value.
Constraint: mest1.
On entry, n=value.
Constraint: n0.
On entry, wu=value and wl=value.
Constraint: wu>wl.
The QR algorithm failed to converge: only value 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) =value and mest=value. No eigenvectors have been computed. Rerun with second dimension of v=mestm.
Inverse iteration failed to compute all the specified eigenvectors. The number of eigenvectors which failed to converge is value. The corresponding columns of v are 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.


If λi is an exact eigenvalue, and λ~i is the corresponding computed value, then
λ~i - λi cnεA2si,  
where cn is a modestly increasing function of n, ε is the machine precision, and si is the reciprocal condition number of λi; A is the balanced form of the original matrix A (see Section 9), and AA.
If xi is the corresponding exact eigenvector, and x~i is the corresponding computed eigenvector, then the angle θx~i,xi between them is bounded as follows:
where sepi is the reciprocal condition number of xi.
The condition numbers si and sepi may be computed from the Hessenberg form of the balanced matrix A which is returned in the array a. This requires calling f08psf (zhseqr) with job='S' to compute the Schur form of A, followed by f08qyf (ztrsna).

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.

Further Comments

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 A to upper Hessenberg form H, using a unitary similarity transformation: A=QHQH. The routine uses the Hessenberg QR algorithm to compute all the eigenvalues of H, which are the same as the eigenvalues of A. It computes the eigenvectors of H which correspond to the selected eigenvalues, using inverse iteration. It premultiplies the eigenvectors by Q to form the eigenvectors of A; and finally transforms the eigenvectors to those of the original matrix A.
Each eigenvector x is normalized so that x2=1, 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 n3.
The routine can be used to compute all eigenvalues and eigenvectors, by setting wl large and negative, and wu large and positive.


This example computes those eigenvalues of the matrix A which lie in the range -5.5,+5.5 , and their corresponding eigenvectors, where
A = -3.97-5.04i -4.11+3.70i -0.34+1.01i 1.29-0.86i 0.34-1.50i 1.52-0.43i 1.88-5.38i 3.36+0.65i 3.31-3.85i 2.50+3.45i 0.88-1.08i 0.64-1.48i -1.10+0.82i 1.81-1.59i 3.25+1.33i 1.57-3.44i .  

Program Text

Program Text (f02gcfe.f90)

Program Data

Program Data (f02gcfe.d)

Program Results

Program Results (f02gcfe.r)