NAG CL Interface
f08pkc (dhsein)

Settings help

CL Name Style:


1 Purpose

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>
void  f08pkc (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)
The function may be called by the names: f08pkc, nag_lapackeig_dhsein or nag_dhsein.

3 Description

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, max(|xi|) = 1 , and for a complex eigenvector, max( |Re(xi)| +|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 f08ngc.

4 References

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

5 Arguments

1: order Nag_OrderType Input
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.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2: side Nag_SideType Input
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_source Nag_EigValsSourceType Input
On entry: indicates whether the eigenvalues of H (stored in wr and wi) were found using f08pec.
eig_source=Nag_HSEQRSource
The eigenvalues of H were found using 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: initv Nag_InitVeenumtype Input
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_Boolean Input/Output
Note: the dimension, dim, of the array select must be at least max(1,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, select[j-1] is set to Nag_TRUE and select[j] to Nag_FALSE.
6: n Integer Input
On entry: n, the order of the matrix H.
Constraint: n0.
7: h[dim] const double Input
Note: the dimension, dim, of the array h must be at least max(1,pdh×n).
The (i,j)th 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×n upper Hessenberg matrix H. If a NaN is detected in h, the function will return with fail.code= NE_BAD_PARAM.
Constraint: No element of h is equal to NaN.
8: pdh Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array h.
Constraint: pdhmax(1,n).
9: wr[dim] double Input/Output
10: wi[dim] const double Input
Note: the dimension, dim, of the arrays wr and wi must be at least max(1,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 f08pec.
On exit: some elements of wr may be modified, as close eigenvalues are perturbed slightly in searching for independent eigenvectors.
11: vl[dim] double Input/Output
Note: the dimension, dim, of the array vl must be at least
  • max(1,pdvl×mm) when side=Nag_LeftSide or Nag_BothSides and order=Nag_ColMajor;
  • max(1,n×pdvl) when side=Nag_LeftSide or Nag_BothSides and order=Nag_RowMajor;
  • 1 when side=Nag_RightSide.
The (i,j)th 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: pdvl Integer Input
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, pdvln;
    • if side=Nag_RightSide, pdvl1;
  • if order=Nag_RowMajor,
    • if side=Nag_LeftSide or Nag_BothSides, pdvlmax(1,mm);
    • if side=Nag_RightSide, pdvl1.
13: vr[dim] double Input/Output
Note: the dimension, dim, of the array vr must be at least
  • max(1,pdvr×mm) when side=Nag_RightSide or Nag_BothSides and order=Nag_ColMajor;
  • max(1,n×pdvr) when side=Nag_RightSide or Nag_BothSides and order=Nag_RowMajor;
  • 1 when side=Nag_LeftSide.
The (i,j)th 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: pdvr Integer Input
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, pdvrn;
    • if side=Nag_LeftSide, pdvr1;
  • if order=Nag_RowMajor,
    • if side=Nag_RightSide or Nag_BothSides, pdvrmax(1,mm);
    • if side=Nag_LeftSide, pdvr1.
15: mm Integer Input
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, m, is obtained by counting 1 for each selected real eigenvector and 2 for each selected complex eigenvector (see select); 0mn.
Constraint: mmm.
16: m Integer * Output
On exit: m, the number of rows or columns of vl and/or vr required to store the selected eigenvectors.
17: ifaill[dim] Integer Output
Note: the dimension, dim, of the array ifaill must be at least
  • max(1,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+1)th 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] Integer Output
Note: the dimension, dim, of the array ifailr must be at least
  • max(1,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+1)th 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: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
Constraint: No element of h is equal to NaN.
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 and mm=value.
Constraint: if side=Nag_LeftSide or Nag_BothSides, pdvlmax(1,mm);
if side=Nag_RightSide, pdvl1.
On entry, side=value, pdvl=value and n=value.
Constraint: if side=Nag_LeftSide or Nag_BothSides, pdvln;
if side=Nag_RightSide, pdvl1.
On entry, side=value, pdvr=value and mm=value.
Constraint: if side=Nag_RightSide or Nag_BothSides, pdvrmax(1,mm);
if side=Nag_LeftSide, pdvr1.
On entry, side=value, pdvr=value and n=value.
Constraint: if side=Nag_RightSide or Nag_BothSides, pdvrn;
if side=Nag_LeftSide, pdvr1.
NE_INT
On entry, mm=value.
Constraint: mmm.
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: pdhmax(1,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.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

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 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
f08pkc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f08pkc 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 Further Comments

The complex analogue of this function is f08pxc.

10 Example

See f08ngc.