f08 Chapter Contents
f08 Chapter Introduction
NAG C Library Manual

# NAG Library Function Documentnag_ztrevc (f08qxc)

## 1  Purpose

nag_ztrevc (f08qxc) computes selected left and/or right eigenvectors of a complex upper triangular matrix.

## 2  Specification

 #include #include
 void nag_ztrevc (Nag_OrderType order, Nag_SideType side, Nag_HowManyType how_many, const Nag_Boolean select[], Integer n, Complex t[], Integer pdt, Complex vl[], Integer pdvl, Complex vr[], Integer pdvr, Integer mm, Integer *m, NagError *fail)

## 3  Description

nag_ztrevc (f08qxc) computes left and/or right eigenvectors of a complex upper triangular matrix $T$. Such a matrix arises from the Schur factorization of a complex general matrix, as computed by nag_zhseqr (f08psc), for example.
The right eigenvector $x$, and the left eigenvector $y$, corresponding to an eigenvalue $\lambda$, are defined by:
 $Tx = λx and yHT = λyH or ​ THy = λ-y .$
The function can compute the eigenvectors corresponding to selected eigenvalues, or it can compute all the eigenvectors. In the latter case the eigenvectors may optionally be pre-multiplied by an input matrix $Q$. Normally $Q$ is a unitary matrix from the Schur factorization of a matrix $A$ as $A=QT{Q}^{\mathrm{H}}$; if $x$ is a (left or right) eigenvector of $T$, then $Qx$ is an eigenvector of $A$.
The eigenvectors are computed by forward or backward substitution. 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$.

## 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:     how_manyNag_HowManyTypeInput
On entry: indicates how many eigenvectors are to be computed.
${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$
All eigenvectors (as specified by side) are computed.
${\mathbf{how_many}}=\mathrm{Nag_BackTransform}$
All eigenvectors (as specified by side) are computed and then pre-multiplied by the matrix $Q$ (which is overwritten).
${\mathbf{how_many}}=\mathrm{Nag_ComputeSelected}$
Selected eigenvectors (as specified by side and select) are computed.
Constraint: ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$, $\mathrm{Nag_BackTransform}$ or $\mathrm{Nag_ComputeSelected}$.
4:     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)$ when ${\mathbf{how_many}}=\mathrm{Nag_ComputeSelected}$;
• $1$ otherwise.
On entry: specifies which eigenvectors are to be computed if ${\mathbf{how_many}}=\mathrm{Nag_ComputeSelected}$. To obtain the eigenvector corresponding to the eigenvalue ${\lambda }_{j}$, ${\mathbf{select}}\left[j-1\right]$ must be set Nag_TRUE.
If ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$ or $\mathrm{Nag_BackTransform}$, select is not referenced.
5:     nIntegerInput
On entry: $n$, the order of the matrix $T$.
Constraint: ${\mathbf{n}}\ge 0$.
6:     t[$\mathit{dim}$]ComplexInput/Output
Note: the dimension, dim, of the array t must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{pdt}}×{\mathbf{n}}\right)$.
The $\left(i,j\right)$th element of the matrix $T$ is stored in
• ${\mathbf{t}}\left[\left(j-1\right)×{\mathbf{pdt}}+i-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{t}}\left[\left(i-1\right)×{\mathbf{pdt}}+j-1\right]$ when ${\mathbf{order}}=\mathrm{Nag_RowMajor}$.
On entry: the $n$ by $n$ upper triangular matrix $T$, as returned by nag_zhseqr (f08psc).
On exit: is used as internal workspace prior to being restored and hence is unchanged.
7:     pdtIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array t.
Constraint: ${\mathbf{pdt}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
8:     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{how_many}}=\mathrm{Nag_BackTransform}$ and ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_BothSides}$, vl must contain an $n$ by $n$ matrix $Q$ (usually the matrix of Schur vectors returned by nag_zhseqr (f08psc)).
If ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$ or $\mathrm{Nag_ComputeSelected}$, 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 how_many and select). The eigenvectors are stored consecutively in the rows or columns (depending on the value of order) of the array, in the same order as their eigenvalues.
If ${\mathbf{side}}=\mathrm{Nag_RightSide}$, vl is not referenced.
9:     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$.
10:   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{how_many}}=\mathrm{Nag_BackTransform}$ and ${\mathbf{side}}=\mathrm{Nag_RightSide}$ or $\mathrm{Nag_BothSides}$, vr must contain an $n$ by $n$ matrix $Q$ (usually the matrix of Schur vectors returned by nag_zhseqr (f08psc)).
If ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$ or $\mathrm{Nag_ComputeSelected}$, 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 how_many and select). The eigenvectors are stored consecutively in the rows or columns (depending on the value of order) of the array, in the same order as their eigenvalues.
If ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, vr is not referenced.
11:   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$.
12:   mmIntegerInput
On entry: the number of rows or columns (depending on the value of order) in the arrays vl and/or vr. The precise number of rows or columns required, $\mathit{required_rowcol}$, is $n$ if ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$ or $\mathrm{Nag_BackTransform}$; if ${\mathbf{how_many}}=\mathrm{Nag_ComputeSelected}$, $\mathit{required_rowcol}$ is the number of selected eigenvectors (see select), in which case $0\le \mathit{required_rowcol}\le n$.
Constraint: ${\mathbf{mm}}\ge \mathit{required_rowcol}$.
13:   mInteger *Output
On exit: $\mathit{required_rowcol}$, the number of selected eigenvectors. If ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$ or $\mathrm{Nag_BackTransform}$, m is set to $n$.
14:   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_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{pdt}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdt}}>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{pdt}}=〈\mathit{\text{value}}〉$ and ${\mathbf{n}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{pdt}}\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

If ${x}_{i}$ is an exact right eigenvector, and ${\stackrel{~}{x}}_{i}$ is the corresponding computed eigenvector, then the angle $\theta \left({\stackrel{~}{x}}_{i},{x}_{i}\right)$ between them is bounded as follows:
 $θ x~i,xi ≤ c n ε T2 sepi$
where ${\mathit{sep}}_{i}$ is the reciprocal condition number of ${x}_{i}$.
The condition number ${\mathit{sep}}_{i}$ may be computed by calling nag_ztrsna (f08qyc).