hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

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 AA:
Axi = λi xi .
Axi = λi xi .
Eigenvalues λiλi may be selected either by modulus, satisfying:
wl |λi| wu ,
wl |λi| wu ,
or by real part, satisfying:
wl Re(λi) wu .
wl Re(λi) wu .
Note that even though AA is real, λiλi and xixi may be complex. If xixi is an eigenvector corresponding to a complex eigenvalue λiλi, then the complex conjugate vector xix-i is the eigenvector corresponding to the complex conjugate eigenvalue λiλ-i. The eigenvalues in a complex conjugate pair λiλi and λiλ-i 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:     crit – string (length ≥ 1)
Indicates the criterion for selecting eigenvalues.
crit = 'M'crit='M'
Eigenvalues are selected according to their moduli: wl|λi|wuwl|λi|wu.
crit = 'R'crit='R'
Eigenvalues are selected according to their real parts: wlRe(λi)wuwlRe(λi)wu.
Constraint: crit = 'M'crit='M' or 'R''R'.
2:     a(lda,n) – double array
lda, the first dimension of the array, must satisfy the constraint ldamax (1,n)ldamax(1,n).
The nn by nn general matrix AA.
3:     wl – double scalar
4:     wu – double scalar
wlwl and wuwu, the lower and upper bounds on the criterion for the selected eigenvalues (see crit).
Constraint: wu > wlwu>wl.
5:     mest – int64int32nag_int scalar
The second dimension of the arrays vr and vi as declared in the (sub)program from which nag_eigen_real_gen_eigsys (f02ec) is called. mest must be an upper bound on mm, the number of eigenvalues and eigenvectors selected. No eigenvectors are computed if mest < mmest<m.
Constraint: mestmax (1,m)mestmax(1,m).

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The second dimension of the array a.
nn, the order of the matrix AA.
Constraint: n0n0.

Input Parameters Omitted from the MATLAB Interface

lda ldvr ldvi work lwork iwork bwork

Output Parameters

1:     a(lda,n) – double array
ldamax (1,n)ldamax(1,n).
Contains the Hessenberg form of the balanced input matrix AA (see Section [Further Comments]).
2:     m – int64int32nag_int scalar
mm, the number of eigenvalues actually selected.
3:     wr(n) – double array
4:     wi(n) – double array
The first m elements of wr and wi hold the real and imaginary parts, respectively, of the selected eigenvalues; elements m + 1m+1 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 [Further Comments].
5:     vr(ldvr,mest) – double array
ldvrmax (1,n)ldvrmax(1,n).
Contains the real parts of the selected eigenvectors, with the iith column holding the real part of the eigenvector associated with the eigenvalue λiλi (stored in wr(i)wri and wi(i)wii).
6:     vi(ldvi,mest) – double array
ldvimax (1,n)ldvimax(1,n).
Contains the imaginary parts of the selected eigenvectors, with the iith column holding the imaginary part of the eigenvector associated with the eigenvalue λiλi (stored in wr(i)wri and wi(i)wii).
7:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 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.

  ifail = 1ifail=1
On entry,crit'M'crit'M' or 'R''R',
orn < 0n<0,
orlda < max (1,n)lda<max(1,n),
orwuwlwuwl,
ormest < 1mest<1,
orldvr < max (1,n)ldvr<max(1,n),
orldvi < max (1,n)ldvi<max(1,n),
orlwork < max (1,n × (n + 4))lwork<max(1,n×(n+4)).
  ifail = 2ifail=2
The QRQR algorithm failed to compute all the eigenvalues. No eigenvectors have been computed.
  ifail = 3ifail=3
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 vi = mestmvi=mestm.
W ifail = 4ifail=4
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.

Accuracy

If λiλi is an exact eigenvalue, and λ̃iλ~i is the corresponding computed value, then
|λ̃iλi|(c(n)εA2)/(si),
|λ~i-λi|c(n)εA2si,
where c(n)c(n) is a modestly increasing function of nn, εε is the machine precision, and sisi is the reciprocal condition number of λiλi; AA is the balanced form of the original matrix AA (see Section [Further Comments]), and AAAA.
If xixi is the corresponding exact eigenvector, and ix~i is the corresponding computed eigenvector, then the angle θ(i,xi)θ(x~i,xi) between them is bounded as follows:
θ(i,xi)(c(n)εA2)/(sepi),
θ(x~i,xi)c(n)εA2sepi,
where sepisepi is the reciprocal condition number of xixi.
The condition numbers sisi and sepisepi may be computed from the Hessenberg form of the balanced matrix AA which is returned in the array a. This requires calling nag_lapack_dhseqr (f08pe) with job = 'S'job='S' to compute the Schur form of AA, 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 AA to upper Hessenberg form HH, using an orthogonal similarity transformation: A = QHQTA=QHQT. The function uses the Hessenberg QRQR algorithm to compute all the eigenvalues of HH, which are the same as the eigenvalues of AA. It computes the eigenvectors of HH which correspond to the selected eigenvalues, using inverse iteration. It premultiplies the eigenvectors by QQ to form the eigenvectors of AA; and finally transforms the eigenvectors to those of the original matrix AA.
Each eigenvector xx (real or complex) is normalized so that x2 = 1x2=1, and the element of largest absolute value is real and positive.
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 n3n3.
The function can be used to compute all eigenvalues and eigenvectors, by setting wl large and negative, and wu large and positive.

Example

function nag_eigen_real_gen_eigsys_example
crit = 'Moduli';
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];
wl = 0.2;
wu = 0.5;
mest = int64(3);
[aOut, m, wr, wi, vr, vi, ifail] = nag_eigen_real_gen_eigsys(crit, a, wl, wu, mest)
 

aOut =

    0.3500   -0.1160   -0.3886   -0.2942
   -0.5140    0.1225    0.1004    0.1126
   -0.7285    0.6443   -0.1357   -0.0977
    0.4139   -0.1665    0.4262    0.1632


m =

                    2


wr =

   -0.0994
   -0.0994
    0.7995
   -0.1007


wi =

    0.4008
   -0.4008
         0
         0


vr =

   -0.1933   -0.1933         0
    0.2519    0.2519         0
    0.0972    0.0972         0
    0.6760    0.6760         0


vi =

    0.2546   -0.2546         0
   -0.5224    0.5224         0
   -0.3084    0.3084         0
         0         0         0


ifail =

                    0


function f02ec_example
crit = 'Moduli';
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];
wl = 0.2;
wu = 0.5;
mest = int64(3);
[aOut, m, wr, wi, vr, vi, ifail] = f02ec(crit, a, wl, wu, mest)
 

aOut =

    0.3500   -0.1160   -0.3886   -0.2942
   -0.5140    0.1225    0.1004    0.1126
   -0.7285    0.6443   -0.1357   -0.0977
    0.4139   -0.1665    0.4262    0.1632


m =

                    2


wr =

   -0.0994
   -0.0994
    0.7995
   -0.1007


wi =

    0.4008
   -0.4008
         0
         0


vr =

   -0.1933   -0.1933         0
    0.2519    0.2519         0
    0.0972    0.0972         0
    0.6760    0.6760         0


vi =

    0.2546   -0.2546         0
   -0.5224    0.5224         0
   -0.3084    0.3084         0
         0         0         0


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013