nag_dhsein (f08pkc) (PDF version)
f08 Chapter Contents
f08 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_dhsein (f08pkc)

+ Contents

    1  Purpose
    7  Accuracy
    9  Example

1  Purpose

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

2  Specification

#include <nag.h>
#include <nagf08.h>
void  nag_dhsein (Nag_OrderType order, Nag_SideType side, Nag_EigValsSourceType eig_source, Nag_InitVeenumtype initv, Nag_Boolean select[], Integer n, const double h[], Integer pdh, double wr[], const double wi[], double vl[], Integer pdvl, double vr[], Integer pdvr, Integer mm, Integer *m, Integer ifaill[], Integer ifailr[], NagError *fail)

3  Description

nag_dhsein (f08pkc) computes left and/or right eigenvectors of a real upper Hessenberg matrix H, corresponding to selected eigenvalues.
The right eigenvector x, and the left eigenvector y, corresponding to an eigenvalue λ, are defined by:
Hx = λx   and   yHH = λyH   or  HTy = λ-y .
Note that even though H is real, λ, x and y may be complex. If x is an eigenvector corresponding to a complex eigenvalue λ, then the complex conjugate vector x- 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 x, maxxi = 1 , and for a complex eigenvector, max Rexi + Imxi = 1 .
If H has been formed by reduction of a real general matrix A to upper Hessenberg form, then the eigenvectors of H may be transformed to eigenvectors of A by a call to nag_dormhr (f08ngc).

4  References

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

5  Arguments

1:     orderNag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by order=Nag_RowMajor. See Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2:     sideNag_SideTypeInput
On entry: indicates whether left and/or right eigenvectors are to be computed.
side=Nag_RightSide
Only right eigenvectors are computed.
side=Nag_LeftSide
Only left eigenvectors are computed.
side=Nag_BothSides
Both left and right eigenvectors are computed.
Constraint: side=Nag_RightSide, Nag_LeftSide or Nag_BothSides.
3:     eig_sourceNag_EigValsSourceTypeInput
On entry: indicates whether the eigenvalues of H (stored in wr and wi) were found using nag_dhseqr (f08pec).
eig_source=Nag_HSEQRSource
The eigenvalues of H were found using nag_dhseqr (f08pec); thus if H has any zero subdiagonal elements (and so is block triangular), then the jth eigenvalue can be assumed to be an eigenvalue of the block containing the jth row/column. This property allows the function to perform inverse iteration on just one diagonal block.
eig_source=Nag_NotKnown
No such assumption is made and the function performs inverse iteration using the whole matrix.
Constraint: eig_source=Nag_HSEQRSource or Nag_NotKnown.
4:     initvNag_InitVeenumtypeInput
On entry: indicates whether you are supplying initial estimates for the selected eigenvectors.
initv=Nag_NoVec
No initial estimates are supplied.
initv=Nag_UserVec
Initial estimates are supplied in vl and/or vr.
Constraint: initv=Nag_NoVec or Nag_UserVec.
5:     select[dim]Nag_BooleanInput/Output
Note: the dimension, dim, of the array select must be at least max1,n.
On entry: specifies which eigenvectors are to be computed. To obtain the real eigenvector corresponding to the real eigenvalue wr[j-1], select[j-1] must be set Nag_TRUE. To select the complex eigenvector corresponding to the complex eigenvalue wr[j-1],wi[j-1] with complex conjugate (wr[j],wi[j]), select[j-1] and/or select[j] must be set Nag_TRUE; the eigenvector corresponding to the first eigenvalue in the pair is computed.
On exit: if a complex eigenvector was selected as specified above, then select[j-1] is set to Nag_TRUE and select[j] to Nag_FALSE.
6:     nIntegerInput
On entry: n, the order of the matrix H.
Constraint: n0.
7:     h[dim]const doubleInput
Note: the dimension, dim, of the array h must be at least max1,pdh×n.
The i,jth element of the matrix H is stored in
  • h[j-1×pdh+i-1] when order=Nag_ColMajor;
  • h[i-1×pdh+j-1] when order=Nag_RowMajor.
On entry: the n by n upper Hessenberg matrix H.
8:     pdhIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array h.
Constraint: pdhmax1,n.
9:     wr[dim]doubleInput/Output
10:   wi[dim]const doubleInput
Note: the dimension, dim, of the arrays wr and wi must be at least max1,n.
On entry: the real and imaginary parts, respectively, of the eigenvalues of the matrix H. Complex conjugate pairs of values must be stored in consecutive elements of the arrays. If eig_source=Nag_HSEQRSource, the arrays must be exactly as returned by nag_dhseqr (f08pec).
On exit: some elements of wr may be modified, as close eigenvalues are perturbed slightly in searching for independent eigenvectors.
11:   vl[dim]doubleInput/Output
Note: the dimension, dim, of the array vl must be at least
  • max1,pdvl×mm when side=Nag_LeftSide or Nag_BothSides and order=Nag_ColMajor;
  • max1,n×pdvl when side=Nag_LeftSide or Nag_BothSides and order=Nag_RowMajor;
  • 1 when side=Nag_RightSide.
The i,jth element of the matrix is stored in
  • vl[j-1×pdvl+i-1] when order=Nag_ColMajor;
  • vl[i-1×pdvl+j-1] when order=Nag_RowMajor.
On entry: if initv=Nag_UserVec and side=Nag_LeftSide or Nag_BothSides, vl must contain starting vectors for inverse iteration for the left eigenvectors. Each starting vector must be stored in the same rows or columns as will be used to store the corresponding eigenvector (see below).
If initv=Nag_NoVec, vl need not be set.
On exit: if side=Nag_LeftSide or Nag_BothSides, vl contains the computed left eigenvectors (as specified by select). The eigenvectors are stored consecutively in the rows or columns of the array (depending on the value of order), in the same order as their eigenvalues. Corresponding to each selected real eigenvalue is a real eigenvector, occupying one row or column. Corresponding to each selected complex eigenvalue is a complex eigenvector, occupying two rows or columns: the first row or column holds the real part and the second row or column holds the imaginary part.
If side=Nag_RightSide, vl is not referenced.
12:   pdvlIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array vl.
Constraints:
  • if order=Nag_ColMajor,
    • if side=Nag_LeftSide or Nag_BothSides, pdvl max1,n ;
    • if side=Nag_RightSide, pdvl1;
  • if order=Nag_RowMajor,
    • if side=Nag_LeftSide or Nag_BothSides, pdvlmax1,mm;
    • if side=Nag_RightSide, pdvl1.
13:   vr[dim]doubleInput/Output
Note: the dimension, dim, of the array vr must be at least
  • max1,pdvr×mm when side=Nag_RightSide or Nag_BothSides and order=Nag_ColMajor;
  • max1,n×pdvr when side=Nag_RightSide or Nag_BothSides and order=Nag_RowMajor;
  • 1 when side=Nag_LeftSide.
The i,jth element of the matrix is stored in
  • vr[j-1×pdvr+i-1] when order=Nag_ColMajor;
  • vr[i-1×pdvr+j-1] when order=Nag_RowMajor.
On entry: if initv=Nag_UserVec and side=Nag_RightSide or Nag_BothSides, vr must contain starting vectors for inverse iteration for the right eigenvectors. Each starting vector must be stored in the same rows or columns as will be used to store the corresponding eigenvector (see below).
If initv=Nag_NoVec, vr need not be set.
On exit: if side=Nag_RightSide or Nag_BothSides, vr contains the computed right eigenvectors (as specified by select). The eigenvectors are stored consecutively in the rows or columns of the array (depending on the order argument), in the same order as their eigenvalues. Corresponding to each selected real eigenvalue is a real eigenvector, occupying one row or column. Corresponding to each selected complex eigenvalue is a complex eigenvector, occupying two rows or columns: the first row or column holds the real part and the second row or column holds the imaginary part.
If side=Nag_LeftSide, vr is not referenced.
14:   pdvrIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array vr.
Constraints:
  • if order=Nag_ColMajor,
    • if side=Nag_RightSide or Nag_BothSides, pdvr max1,n ;
    • if side=Nag_LeftSide, pdvr1;
  • if order=Nag_RowMajor,
    • if side=Nag_RightSide or Nag_BothSides, pdvrmax1,mm;
    • if side=Nag_LeftSide, pdvr1.
15:   mmIntegerInput
On entry: the number of columns in the arrays vl and/or vr if order=Nag_ColMajor or the number of rows in the arrays if order=Nag_RowMajor. The actual number of rows or columns required, required_rowcol, is obtained by counting 1 for each selected real eigenvector and 2 for each selected complex eigenvector (see select); 0required_rowcoln.
Constraint: mmrequired_rowcol.
16:   mInteger *Output
On exit: required_rowcol, the number of rows or columns of vl and/or vr required to store the selected eigenvectors.
17:   ifaill[dim]IntegerOutput
Note: the dimension, dim, of the array ifaill must be at least
  • max1,mm when side=Nag_LeftSide or Nag_BothSides;
  • 1 when side=Nag_RightSide.
On exit: if side=Nag_LeftSide or Nag_BothSides, then ifaill[i-1]=0 if the selected left eigenvector converged and ifaill[i-1]=j0 if the eigenvector stored in the ith row or column of vl (corresponding to the jth eigenvalue as held in wr[j-1],wi[j-1] failed to converge. If the ith and i+1th rows or columns of vl contain a selected complex eigenvector, then ifaill[i-1] and ifaill[i] are set to the same value.
If side=Nag_RightSide, ifaill is not referenced.
18:   ifailr[dim]IntegerOutput
Note: the dimension, dim, of the array ifailr must be at least
  • max1,mm when side=Nag_RightSide or Nag_BothSides;
  • 1 when side=Nag_LeftSide.
On exit: if side=Nag_RightSide or Nag_BothSides, then ifailr[i-1]=0 if the selected right eigenvector converged and ifailr[i-1]=j0 if the eigenvector stored in the ith row or column of vr (corresponding to the jth eigenvalue as held in wr[j-1],wi[j-1]) failed to converge. If the ith and i+1th rows or columns of vr contain a selected complex eigenvector, then ifailr[i-1] and ifailr[i] are set to the same value.
If side=Nag_LeftSide, ifailr is not referenced.
19:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_CONVERGENCE
value eigenvectors (as indicated by arguments ifaill and/or ifailr) failed to converge. The corresponding columns of vl and/or vr contain no useful information.
NE_ENUM_INT_2
On entry, side=value, pdvl=value, mm=value.
Constraint: if side=Nag_LeftSide or Nag_BothSides, pdvlmax1,mm;
if side=Nag_RightSide, pdvl1.
On entry, side=value, pdvl=value and n=value.
Constraint: if side=Nag_LeftSide or Nag_BothSides, pdvl max1,n ;
if side=Nag_RightSide, pdvl1.
On entry, side=value, pdvr=value, mm=value.
Constraint: if side=Nag_RightSide or Nag_BothSides, pdvrmax1,mm;
if side=Nag_LeftSide, pdvr1.
On entry, side=value, pdvr=value and n=value.
Constraint: if side=Nag_RightSide or Nag_BothSides, pdvr max1,n ;
if side=Nag_LeftSide, pdvr1.
NE_INT
On entry, mm=value.
Constraint: mmrequired_rowcol, where required_rowcol is obtained by counting 1 for each selected real eigenvector and 2 for each selected complex eigenvector.
On entry, n=value.
Constraint: n0.
On entry, pdh=value.
Constraint: pdh>0.
On entry, pdvl=value.
Constraint: pdvl>0.
On entry, pdvr=value.
Constraint: pdvr>0.
NE_INT_2
On entry, pdh=value and n=value.
Constraint: pdhmax1,n.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.

7  Accuracy

Each computed right eigenvector xi is the exact eigenvector of a nearby matrix A+Ei, such that Ei=OεA. Hence the residual is small:
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.

8  Further Comments

The complex analogue of this function is nag_zhsein (f08pxc).

9  Example

See Section 9 in nag_dormhr (f08ngc).

nag_dhsein (f08pkc) (PDF version)
f08 Chapter Contents
f08 Chapter Introduction
NAG C Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012