f08 Chapter Contents
f08 Chapter Introduction
NAG C Library Manual

NAG Library Function Documentnag_zhsein (f08pxc)

1  Purpose

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

2  Specification

 #include #include
 void nag_zhsein (Nag_OrderType order, Nag_SideType side, Nag_EigValsSourceType eig_source, Nag_InitVeenumtype initv, const Nag_Boolean select[], Integer n, const Complex h[], Integer pdh, Complex w[], Complex vl[], Integer pdvl, Complex vr[], Integer pdvr, Integer mm, Integer *m, Integer ifaill[], Integer ifailr[], NagError *fail)

3  Description

nag_zhsein (f08pxc) computes left and/or right eigenvectors of a complex upper Hessenberg matrix $H$, corresponding to selected eigenvalues.
The right eigenvector $x$, and the left eigenvector $y$, corresponding to an eigenvalue $\lambda$, are defined by:
The eigenvectors are computed by inverse iteration. They are scaled so that $\mathrm{max}\phantom{\rule{0.25em}{0ex}}\left|\mathrm{Re}\left({x}_{i}\right)\right|+\left|\mathrm{Im}{x}_{i}\right|=1$.
If $H$ has been formed by reduction of a complex general matrix $A$ to upper Hessenberg form, then the eigenvectors of $H$ may be transformed to eigenvectors of $A$ by a call to nag_zunmhr (f08nuc).

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 ${\mathbf{order}}=\mathrm{Nag_RowMajor}$. See Section 3.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or Nag_ColMajor.
2:     sideNag_SideTypeInput
On entry: indicates whether left and/or right eigenvectors are to be computed.
${\mathbf{side}}=\mathrm{Nag_RightSide}$
Only right eigenvectors are computed.
${\mathbf{side}}=\mathrm{Nag_LeftSide}$
Only left eigenvectors are computed.
${\mathbf{side}}=\mathrm{Nag_BothSides}$
Both left and right eigenvectors are computed.
Constraint: ${\mathbf{side}}=\mathrm{Nag_RightSide}$, $\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_BothSides}$.
3:     eig_sourceNag_EigValsSourceTypeInput
On entry: indicates whether the eigenvalues of $H$ (stored in w) were found using nag_zhseqr (f08psc).
${\mathbf{eig_source}}=\mathrm{Nag_HSEQRSource}$
The eigenvalues of $H$ were found using nag_zhseqr (f08psc); thus if $H$ has any zero subdiagonal elements (and so is block triangular), then the $j$th eigenvalue can be assumed to be an eigenvalue of the block containing the $j$th row/column. This property allows the function to perform inverse iteration on just one diagonal block.
${\mathbf{eig_source}}=\mathrm{Nag_NotKnown}$
No such assumption is made and the function performs inverse iteration using the whole matrix.
Constraint: ${\mathbf{eig_source}}=\mathrm{Nag_HSEQRSource}$ or $\mathrm{Nag_NotKnown}$.
4:     initvNag_InitVeenumtypeInput
On entry: indicates whether you are supplying initial estimates for the selected eigenvectors.
${\mathbf{initv}}=\mathrm{Nag_NoVec}$
No initial estimates are supplied.
${\mathbf{initv}}=\mathrm{Nag_UserVec}$
Initial estimates are supplied in vl and/or vr.
Constraint: ${\mathbf{initv}}=\mathrm{Nag_NoVec}$ or $\mathrm{Nag_UserVec}$.
5:     select[$\mathit{dim}$]const Nag_BooleanInput
Note: the dimension, dim, of the array select must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: specifies which eigenvectors are to be computed. To select the eigenvector corresponding to the eigenvalue ${\mathbf{w}}\left[j-1\right]$, ${\mathbf{select}}\left[j-1\right]$ must be set to Nag_TRUE.
6:     nIntegerInput
On entry: $n$, the order of the matrix $H$.
Constraint: ${\mathbf{n}}\ge 0$.
7:     h[$\mathit{dim}$]const ComplexInput
Note: the dimension, dim, of the array h must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdh}}×{\mathbf{n}}\right)$.
The $\left(i,j\right)$th element of the matrix $H$ is stored in
• ${\mathbf{h}}\left[\left(j-1\right)×{\mathbf{pdh}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{h}}\left[\left(i-1\right)×{\mathbf{pdh}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{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: ${\mathbf{pdh}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
9:     w[$\mathit{dim}$]ComplexInput/Output
Note: the dimension, dim, of the array w must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the eigenvalues of the matrix $H$. If ${\mathbf{eig_source}}=\mathrm{Nag_HSEQRSource}$, the array must be exactly as returned by nag_zhseqr (f08psc).
On exit: the real parts of some elements of w may be modified, as close eigenvalues are perturbed slightly in searching for independent eigenvectors.
10:   vl[$\mathit{dim}$]ComplexInput/Output
Note: the dimension, dim, of the array vl must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdvl}}×{\mathbf{mm}}\right)$ when ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_BothSides}$ and ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdvl}}\right)$ when ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_BothSides}$ and ${\mathbf{order}}=\mathrm{Nag_RowMajor}$;
• $1$ when ${\mathbf{side}}=\mathrm{Nag_RightSide}$.
The $\left(i,j\right)$th element of the matrix is stored in
• ${\mathbf{vl}}\left[\left(j-1\right)×{\mathbf{pdvl}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{vl}}\left[\left(i-1\right)×{\mathbf{pdvl}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: if ${\mathbf{initv}}=\mathrm{Nag_UserVec}$ and ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_BothSides}$, vl must contain starting vectors for inverse iteration for the left eigenvectors. Each starting vector must be stored in the same row or column as will be used to store the corresponding eigenvector (see below).
If ${\mathbf{initv}}=\mathrm{Nag_NoVec}$, vl need not be set.
On exit: if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{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.
If ${\mathbf{side}}=\mathrm{Nag_RightSide}$, vl is not referenced.
11:   pdvlIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array vl.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$,
• if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_BothSides}$, ${\mathbf{pdvl}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{pdvl}}\ge 1$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$,
• if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_BothSides}$, ${\mathbf{pdvl}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{mm}}\right)$;
• if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{pdvl}}\ge 1$.
12:   vr[$\mathit{dim}$]ComplexInput/Output
Note: the dimension, dim, of the array vr must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdvr}}×{\mathbf{mm}}\right)$ when ${\mathbf{side}}=\mathrm{Nag_RightSide}$ or $\mathrm{Nag_BothSides}$ and ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×{\mathbf{pdvr}}\right)$ when ${\mathbf{side}}=\mathrm{Nag_RightSide}$ or $\mathrm{Nag_BothSides}$ and ${\mathbf{order}}=\mathrm{Nag_RowMajor}$;
• $1$ when ${\mathbf{side}}=\mathrm{Nag_LeftSide}$.
The $\left(i,j\right)$th element of the matrix is stored in
• ${\mathbf{vr}}\left[\left(j-1\right)×{\mathbf{pdvr}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{vr}}\left[\left(i-1\right)×{\mathbf{pdvr}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: if ${\mathbf{initv}}=\mathrm{Nag_UserVec}$ and ${\mathbf{side}}=\mathrm{Nag_RightSide}$ or $\mathrm{Nag_BothSides}$, vr must contain starting vectors for inverse iteration for the right eigenvectors. Each starting vector must be stored in the same row or column as will be used to store the corresponding eigenvector (see below).
If ${\mathbf{initv}}=\mathrm{Nag_NoVec}$, vr need not be set.
On exit: if ${\mathbf{side}}=\mathrm{Nag_RightSide}$ or $\mathrm{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 value of order), in the same order as their eigenvalues.
If ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, vr is not referenced.
13:   pdvrIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array vr.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$,
• if ${\mathbf{side}}=\mathrm{Nag_RightSide}$ or $\mathrm{Nag_BothSides}$, ${\mathbf{pdvr}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{pdvr}}\ge 1$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$,
• if ${\mathbf{side}}=\mathrm{Nag_RightSide}$ or $\mathrm{Nag_BothSides}$, ${\mathbf{pdvr}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{mm}}\right)$;
• if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{pdvr}}\ge 1$.
14:   mmIntegerInput
On entry: the number of columns in the arrays vl and/or vr if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$ or the number of rows in the arrays if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$. The actual number of rows or columns required, $\mathit{required_rowcol}$, is obtained by counting $1$ for each selected real eigenvector and $2$ for each selected complex eigenvector (see select); $0\le \mathit{required_rowcol}\le n$.
Constraint: ${\mathbf{mm}}\ge \mathit{required_rowcol}$.
15:   mInteger *Output
On exit: $\mathit{required_rowcol}$, the number of selected eigenvectors.
16:   ifaill[$\mathit{dim}$]IntegerOutput
Note: the dimension, dim, of the array ifaill must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{mm}}\right)$ when ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_BothSides}$;
• $1$ when ${\mathbf{side}}=\mathrm{Nag_RightSide}$.
On exit: if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_BothSides}$, then ${\mathbf{ifaill}}\left[i-1\right]=0$ if the selected left eigenvector converged and ${\mathbf{ifaill}}\left[i-1\right]=j\ge 0$ if the eigenvector stored in the $i$th row or column of vl (corresponding to the $j$th eigenvalue) failed to converge.
If ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ifaill is not referenced.
17:   ifailr[$\mathit{dim}$]IntegerOutput
Note: the dimension, dim, of the array ifailr must be at least
• $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{mm}}\right)$ when ${\mathbf{side}}=\mathrm{Nag_RightSide}$ or $\mathrm{Nag_BothSides}$;
• $1$ when ${\mathbf{side}}=\mathrm{Nag_LeftSide}$.
On exit: if ${\mathbf{side}}=\mathrm{Nag_RightSide}$ or $\mathrm{Nag_BothSides}$, then ${\mathbf{ifailr}}\left[i-1\right]=0$ if the selected right eigenvector converged and ${\mathbf{ifailr}}\left[i-1\right]=j\ge 0$ if the eigenvector stored in the $i$th column of vr (corresponding to the $j$th eigenvalue) failed to converge.
If ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ifailr is not referenced.
18:   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.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_CONVERGENCE
$〈\mathit{\text{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, ${\mathbf{side}}=〈\mathit{\text{value}}〉$, ${\mathbf{pdvl}}=〈\mathit{\text{value}}〉$, ${\mathbf{mm}}=〈\mathit{\text{value}}〉$.
Constraint: if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_BothSides}$, ${\mathbf{pdvl}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{mm}}\right)$;
if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{pdvl}}\ge 1$.
On entry, ${\mathbf{side}}=〈\mathit{\text{value}}〉$, ${\mathbf{pdvl}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_BothSides}$, ${\mathbf{pdvl}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, ${\mathbf{pdvl}}\ge 1$.
On entry, ${\mathbf{side}}=〈\mathit{\text{value}}〉$, ${\mathbf{pdvr}}=〈\mathit{\text{value}}〉$, ${\mathbf{mm}}=〈\mathit{\text{value}}〉$.
Constraint: if ${\mathbf{side}}=\mathrm{Nag_RightSide}$ or $\mathrm{Nag_BothSides}$, ${\mathbf{pdvr}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{mm}}\right)$;
if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{pdvr}}\ge 1$.
On entry, ${\mathbf{side}}=〈\mathit{\text{value}}〉$, ${\mathbf{pdvr}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: if ${\mathbf{side}}=\mathrm{Nag_RightSide}$ or $\mathrm{Nag_BothSides}$, ${\mathbf{pdvr}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, ${\mathbf{pdvr}}\ge 1$.
NE_INT
On entry, ${\mathbf{mm}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{mm}}\ge \mathit{required_rowcol}$, where $\mathit{required_rowcol}$ is the number of selected eigenvectors.
On entry, ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{n}}\ge 0$.
On entry, ${\mathbf{pdh}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdh}}>0$.
On entry, ${\mathbf{pdvl}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdvl}}>0$.
On entry, ${\mathbf{pdvr}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdvr}}>0$.
NE_INT_2
On entry, ${\mathbf{pdh}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdh}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
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 ${x}_{i}$ is the exact eigenvector of a nearby matrix $A+{E}_{i}$, such that $‖{E}_{i}‖=\mathit{O}\left(\epsilon \right)‖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.