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_lapack_dhsein (f08pk)

Purpose

nag_lapack_dhsein (f08pk) computes selected left and/or right eigenvectors of a real upper Hessenberg matrix corresponding to specified eigenvalues, by inverse iteration.

Syntax

[select, wr, vl, vr, m, ifaill, ifailr, info] = f08pk(job, eigsrc, initv, select, h, wr, wi, vl, vr, mm, 'n', n)
[select, wr, vl, vr, m, ifaill, ifailr, info] = nag_lapack_dhsein(job, eigsrc, initv, select, h, wr, wi, vl, vr, mm, 'n', n)

Description

nag_lapack_dhsein (f08pk) computes left and/or right eigenvectors of a real upper Hessenberg matrix HH, corresponding to selected eigenvalues.
The right eigenvector xx, and the left eigenvector yy, corresponding to an eigenvalue λλ, are defined by:
Hx = λx   and   yHH = λyH (  or HTy = λy) .
Hx = λx   and   yHH = λyH (   or  HTy = λ-y ) .
Note that even though HH is real, λλ, xx and yy may be complex. If xx is an eigenvector corresponding to a complex eigenvalue λλ, then the complex conjugate vector xx- is the eigenvector corresponding to the complex conjugate eigenvalue λλ-.
The eigenvectors are computed by inverse iteration. They are scaled so that, for a real eigenvector xx, max|xi| = 1 max|xi| = 1 , and for a complex eigenvector, max  |Re(xi)| + |Imxi| = 1 max | Re(xi) | +| Imxi | = 1 .
If HH has been formed by reduction of a real general matrix AA to upper Hessenberg form, then the eigenvectors of HH may be transformed to eigenvectors of AA by a call to nag_lapack_dormhr (f08ng).

References

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

Parameters

Compulsory Input Parameters

1:     job – string (length ≥ 1)
Indicates whether left and/or right eigenvectors are to be computed.
job = 'R'job='R'
Only right eigenvectors are computed.
job = 'L'job='L'
Only left eigenvectors are computed.
job = 'B'job='B'
Both left and right eigenvectors are computed.
Constraint: job = 'R'job='R', 'L''L' or 'B''B'.
2:     eigsrc – string (length ≥ 1)
Indicates whether the eigenvalues of HH (stored in wr and wi) were found using nag_lapack_dhseqr (f08pe).
eigsrc = 'Q'eigsrc='Q'
The eigenvalues of HH were found using nag_lapack_dhseqr (f08pe); thus if HH has any zero subdiagonal elements (and so is block triangular), then the jjth eigenvalue can be assumed to be an eigenvalue of the block containing the jjth row/column. This property allows the function to perform inverse iteration on just one diagonal block.
eigsrc = 'N'eigsrc='N'
No such assumption is made and the function performs inverse iteration using the whole matrix.
Constraint: eigsrc = 'Q'eigsrc='Q' or 'N''N'.
3:     initv – string (length ≥ 1)
Indicates whether you are supplying initial estimates for the selected eigenvectors.
initv = 'N'initv='N'
No initial estimates are supplied.
initv = 'U'initv='U'
Initial estimates are supplied in vl and/or vr.
Constraint: initv = 'N'initv='N' or 'U''U'.
4:     select( : :) – logical array
Note: the dimension of the array select must be at least max (1,n)max(1,n).
Specifies which eigenvectors are to be computed. To obtain the real eigenvector corresponding to the real eigenvalue wr(j)wrj, select(j)selectj must be set true. To select the complex eigenvector corresponding to the complex eigenvalue (wr(j),wi(j))(wrj,wij) with complex conjugate (wr(j + 1),wi(j + 1)wrj+1,wij+1), select(j)selectj and/or select(j + 1)selectj+1 must be set true; the eigenvector corresponding to the first eigenvalue in the pair is computed.
5:     h(ldh, : :) – double array
The first dimension of the array h must be at least max (1,n)max(1,n)
The second dimension of the array must be at least max (1,n)max(1,n)
The nn by nn upper Hessenberg matrix HH.
6:     wr( : :) – double array
7:     wi( : :) – double array
Note: the dimension of the arrays wr and wi must be at least max (1,n)max(1,n).
The real and imaginary parts, respectively, of the eigenvalues of the matrix HH. Complex conjugate pairs of values must be stored in consecutive elements of the arrays. If eigsrc = 'Q'eigsrc='Q', the arrays must be exactly as returned by nag_lapack_dhseqr (f08pe).
8:     vl(ldvl, : :) – double array
The first dimension, ldvl, of the array vl must satisfy
  • if job = 'L'job='L' or 'B''B', ldvl max (1,n) ldvl max(1,n) ;
  • if job = 'R'job='R', ldvl1ldvl1.
The second dimension of the array must be at least max (1,mm)max(1,mm) if job = 'L'job='L' or 'B''B' and at least 11 if job = 'R'job='R'
If initv = 'U'initv='U' and job = 'L'job='L' or 'B''B', vl must contain starting vectors for inverse iteration for the left eigenvectors. Each starting vector must be stored in the same column or columns as will be used to store the corresponding eigenvector (see below).
If initv = 'N'initv='N', vl need not be set.
9:     vr(ldvr, : :) – double array
The first dimension, ldvr, of the array vr must satisfy
  • if job = 'R'job='R' or 'B''B', ldvr max (1,n) ldvr max(1,n) ;
  • if job = 'L'job='L', ldvr1ldvr1.
The second dimension of the array must be at least max (1,mm)max(1,mm) if job = 'R'job='R' or 'B''B' and at least 11 if job = 'L'job='L'
If initv = 'U'initv='U' and job = 'R'job='R' or 'B''B', vr must contain starting vectors for inverse iteration for the right eigenvectors. Each starting vector must be stored in the same column or columns as will be used to store the corresponding eigenvector (see below).
If initv = 'N'initv='N', vr need not be set.
10:   mm – int64int32nag_int scalar
The number of columns in the arrays vl and/or vr . The actual number of columns required, mm, is obtained by counting 11 for each selected real eigenvector and 22 for each selected complex eigenvector (see select); 0mn0mn.
Constraint: mmmmmm.

Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The first dimension of the array h and the second dimension of the array h. (An error is raised if these dimensions are not equal.)
nn, the order of the matrix HH.
Constraint: n0n0.

Input Parameters Omitted from the MATLAB Interface

ldh ldvl ldvr work

Output Parameters

1:     select( : :) – logical array
Note: the dimension of the array select must be at least max (1,n)max(1,n).
If a complex eigenvector was selected as specified above, then select(j)selectj is set to true and select(j + 1)selectj+1 to false.
2:     wr( : :) – double array
Note: the dimension of the arrays wr and wi must be at least max (1,n)max(1,n).
Some elements of wr may be modified, as close eigenvalues are perturbed slightly in searching for independent eigenvectors.
3:     vl(ldvl, : :) – double array
The first dimension, ldvl, of the array vl will be
  • if job = 'L'job='L' or 'B''B', ldvl max (1,n) ldvl max(1,n) ;
  • if job = 'R'job='R', ldvl1ldvl1.
The second dimension of the array will be max (1,mm)max(1,mm) if job = 'L'job='L' or 'B''B' and at least 11 if job = 'R'job='R'
If job = 'L'job='L' or 'B''B', vl contains the computed left eigenvectors (as specified by select). The eigenvectors are stored consecutively in the columns of the array, in the same order as their eigenvalues. Corresponding to each selected real eigenvalue is a real eigenvector, occupying one column. Corresponding to each selected complex eigenvalue is a complex eigenvector, occupying two columns: the first column holds the real part and the second column holds the imaginary part.
If job = 'R'job='R', vl is not referenced.
4:     vr(ldvr, : :) – double array
The first dimension, ldvr, of the array vr will be
  • if job = 'R'job='R' or 'B''B', ldvr max (1,n) ldvr max(1,n) ;
  • if job = 'L'job='L', ldvr1ldvr1.
The second dimension of the array will be max (1,mm)max(1,mm) if job = 'R'job='R' or 'B''B' and at least 11 if job = 'L'job='L'
If job = 'R'job='R' or 'B''B', vr contains the computed right eigenvectors (as specified by select). The eigenvectors are stored consecutively in the columns of the array, in the same order as their eigenvalues. Corresponding to each selected real eigenvalue is a real eigenvector, occupying one column. Corresponding to each selected complex eigenvalue is a complex eigenvector, occupying two columns: the first column holds the real part and the second column holds the imaginary part.
If job = 'L'job='L', vr is not referenced.
5:     m – int64int32nag_int scalar
mm, the number of columns of vl and/or vr required to store the selected eigenvectors.
6:     ifaill( : :) – int64int32nag_int array
Note: the dimension of the array ifaill must be at least max (1,mm)max(1,mm) if job = 'L'job='L' or 'B''B' and at least 11 if job = 'R'job='R'.
If job = 'L'job='L' or 'B''B', then ifaill(i) = 0ifailli=0 if the selected left eigenvector converged and ifaill(i) = j > 0ifailli=j>0 if the eigenvector stored in the iith column of vl (corresponding to the jjth eigenvalue as held in (wr(j),wi(j))(wrj,wij) failed to converge. If the iith and (i + 1)(i+1)th columns of vl contain a selected complex eigenvector, then ifaill(i)ifailli and ifaill(i + 1)ifailli+1 are set to the same value.
If job = 'R'job='R', ifaill is not referenced.
7:     ifailr( : :) – int64int32nag_int array
Note: the dimension of the array ifailr must be at least max (1,mm)max(1,mm) if job = 'R'job='R' or 'B''B' and at least 11 if job = 'L'job='L'.
If job = 'R'job='R' or 'B''B', then ifailr(i) = 0ifailri=0 if the selected right eigenvector converged and ifailr(i) = j > 0ifailri=j>0 if the eigenvector stored in the iith row or column of vr (corresponding to the jjth eigenvalue as held in (wr(j),wi(j))(wrj,wij)) failed to converge. If the iith and (i + 1)(i+1)th rows or columns of vr contain a selected complex eigenvector, then ifailr(i)ifailri and ifailr(i + 1)ifailri+1 are set to the same value.
If job = 'L'job='L', ifailr is not referenced.
8:     info – int64int32nag_int scalar
info = 0info=0 unless the function detects an error (see Section [Error Indicators and Warnings]).

Error Indicators and Warnings

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

  info = iinfo=-i
If info = iinfo=-i, parameter ii had an illegal value on entry. The parameters are numbered as follows:
1: job, 2: eigsrc, 3: initv, 4: select, 5: n, 6: h, 7: ldh, 8: wr, 9: wi, 10: vl, 11: ldvl, 12: vr, 13: ldvr, 14: mm, 15: m, 16: work, 17: ifaill, 18: ifailr, 19: info.
It is possible that info refers to a parameter that is omitted from the MATLAB interface. This usually indicates that an error in one of the other input parameters has caused an incorrect value to be inferred.
W INFO > 0INFO>0
If info = iinfo=i, then ii eigenvectors (as indicated by the parameters ifaill and/or ifailr above) failed to converge. The corresponding columns of vl and/or vr contain no useful information.

Accuracy

Each computed right eigenvector xixi is the exact eigenvector of a nearby matrix A + EiA+Ei, such that Ei = O(ε)AEi=O(ε)A. Hence the residual is small:
Axiλixi = O(ε) A .
Axi - λixi = O(ε) A .
However, eigenvectors corresponding to close or coincident eigenvalues may not accurately span the relevant subspaces.
Similar remarks apply to computed left eigenvectors.

Further Comments

The complex analogue of this function is nag_lapack_zhsein (f08px).

Example

function nag_lapack_dhsein_example
job = 'Right';
eigsrc = 'QR';
initv = 'No initial vectors';
select = [false;
     true;
     true;
     true];
h = [0.35, -0.1159524296205035, -0.3886010343233214, -0.2941840753473021;
     -0.5140038910358558, 0.1224867524602574, 0.1003597896821503, 0.1125618799705319;
     -0.7284721282927631, 0.6442636185270625, -0.1357001717571131, -0.09768162270493326;
     0.4139046183481608, -0.1665445794905699, 0.4262443722078449, 0.1632134192968561];
wr = [0.7994821225862088;
     -0.09941245329507449;
     -0.09941245329507449;
     -0.1006572159960586];
wi = [0;
     0.4007924719897544;
     -0.4007924719897544;
     0];
vl = [0];
vr = [0, 0, -1.699371337890631, 0;
     -1.699234008789067, -1.594946615289293e-45, 0, 0;
     0, 0, 0, 0;
     0, 0, -1.700016023545669, -1.699966430664062];
mm = int64(4);
[selectOut, wrOut, vlOut, vrOut, m, ifaill, ifailr, info] = ...
    nag_lapack_dhsein(job, eigsrc, initv, select, h, wr, wi, vl, vr, mm)
 

selectOut =

     0
     1
     0
     1


wrOut =

    0.7995
   -0.0994
   -0.0994
   -0.1007


vlOut =

     0


vrOut =

   -0.3857   -0.0158    0.1493         0
   -0.0289   -0.4061    0.1179         0
   -0.7944    0.0843   -0.6191         0
    0.4500    0.5500    1.0000   -1.7000


m =

                    3


ifaill =

                    0


ifailr =

                    0
                    0
                    0
                    0


info =

                    0


function f08pk_example
job = 'Right';
eigsrc = 'QR';
initv = 'No initial vectors';
select = [false;
     true;
     true;
     true];
h = [0.35, -0.1159524296205035, -0.3886010343233214, -0.2941840753473021;
     -0.5140038910358558, 0.1224867524602574, 0.1003597896821503, 0.1125618799705319;
     -0.7284721282927631, 0.6442636185270625, -0.1357001717571131, -0.09768162270493326;
     0.4139046183481608, -0.1665445794905699, 0.4262443722078449, 0.1632134192968561];
wr = [0.7994821225862088;
     -0.09941245329507449;
     -0.09941245329507449;
     -0.1006572159960586];
wi = [0;
     0.4007924719897544;
     -0.4007924719897544;
     0];
vl = [0];
vr = [0, 0, -1.699371337890631, 0;
     -1.699234008789067, -1.594946615289293e-45, 0, 0;
     0, 0, 0, 0;
     0, 0, -1.700016023545669, -1.699966430664062];
mm = int64(4);
[selectOut, wrOut, vlOut, vrOut, m, ifaill, ifailr, info] = ...
    f08pk(job, eigsrc, initv, select, h, wr, wi, vl, vr, mm)
 

selectOut =

     0
     1
     0
     1


wrOut =

    0.7995
   -0.0994
   -0.0994
   -0.1007


vlOut =

     0


vrOut =

   -0.3857   -0.0158    0.1493         0
   -0.0289   -0.4061    0.1179         0
   -0.7944    0.0843   -0.6191         0
    0.4500    0.5500    1.0000   -1.7000


m =

                    3


ifaill =

                    0


ifailr =

                    0
                    0
                    0
                    0


info =

                    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