# NAG CL Interfacef08qxc (ztrevc)

Settings help

CL Name Style:

## 1Purpose

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

## 2Specification

 #include
 void f08qxc (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)
The function may be called by the names: f08qxc, nag_lapackeig_ztrevc or nag_ztrevc.

## 3Description

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 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.125em}{0ex}}\left(|\mathrm{Re}\left({x}_{i}\right)|+|\mathrm{Im}{x}_{i}|\right)=1$.

## 4References

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

## 5Arguments

1: $\mathbf{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 ${\mathbf{order}}=\mathrm{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: ${\mathbf{order}}=\mathrm{Nag_RowMajor}$ or $\mathrm{Nag_ColMajor}$.
2: $\mathbf{side}$Nag_SideType Input
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: $\mathbf{how_many}$Nag_HowManyType Input
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: $\mathbf{select}\left[\mathit{dim}\right]$const Nag_Boolean Input
Note: the dimension, dim, of the array select must be at least
• ${\mathbf{n}}$ when ${\mathbf{how_many}}=\mathrm{Nag_ComputeSelected}$;
• otherwise select may be NULL.
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 and may be NULL.
5: $\mathbf{n}$Integer Input
On entry: $n$, the order of the matrix $T$.
Constraint: ${\mathbf{n}}\ge 0$.
6: $\mathbf{t}\left[\mathit{dim}\right]$Complex Input/Output
Note: the dimension, dim, of the array t must be at least ${\mathbf{pdt}}×{\mathbf{n}}$.
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×n$ upper triangular matrix $T$, as returned by f08psc.
On exit: is used as internal workspace prior to being restored and hence is unchanged.
7: $\mathbf{pdt}$Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array t.
Constraints:
• if ${\mathbf{order}}=\mathrm{Nag_ColMajor}$, ${\mathbf{pdt}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$, ${\mathbf{pdt}}\ge {\mathbf{n}}$.
8: $\mathbf{vl}\left[\mathit{dim}\right]$Complex Input/Output
Note: the dimension, dim, of the array vl must be at least
• ${\mathbf{pdvl}}×{\mathbf{mm}}$ when ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_BothSides}$ and ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{n}}×{\mathbf{pdvl}}$ when ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_BothSides}$ and ${\mathbf{order}}=\mathrm{Nag_RowMajor}$;
• otherwise vl may be NULL.
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×n$ matrix $Q$ (usually the matrix of Schur vectors returned by 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 and may be NULL.
9: $\mathbf{pdvl}$Integer Input
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 {\mathbf{n}}$;
• if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, vl may be NULL;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$,
• if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_BothSides}$, ${\mathbf{pdvl}}\ge {\mathbf{mm}}$;
• if ${\mathbf{side}}=\mathrm{Nag_RightSide}$, vl may be NULL.
10: $\mathbf{vr}\left[\mathit{dim}\right]$Complex Input/Output
Note: the dimension, dim, of the array vr must be at least
• ${\mathbf{pdvr}}×{\mathbf{mm}}$ when ${\mathbf{side}}=\mathrm{Nag_RightSide}$ or $\mathrm{Nag_BothSides}$ and ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{n}}×{\mathbf{pdvr}}$ when ${\mathbf{side}}=\mathrm{Nag_RightSide}$ or $\mathrm{Nag_BothSides}$ and ${\mathbf{order}}=\mathrm{Nag_RowMajor}$;
• otherwise vr may be NULL.
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×n$ matrix $Q$ (usually the matrix of Schur vectors returned by 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 and may be NULL.
11: $\mathbf{pdvr}$Integer Input
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 {\mathbf{n}}$;
• if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, vr may be NULL;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$,
• if ${\mathbf{side}}=\mathrm{Nag_RightSide}$ or $\mathrm{Nag_BothSides}$, ${\mathbf{pdvr}}\ge {\mathbf{mm}}$;
• if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, vr may be NULL.
12: $\mathbf{mm}$Integer Input
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{m}$, is $n$ if ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$ or $\mathrm{Nag_BackTransform}$; if ${\mathbf{how_many}}=\mathrm{Nag_ComputeSelected}$, $\mathit{m}$ is the number of selected eigenvectors (see select), in which case $0\le \mathit{m}\le n$.
Constraints:
• if ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$ or $\mathrm{Nag_BackTransform}$, ${\mathbf{mm}}\ge {\mathbf{n}}$;
• otherwise ${\mathbf{mm}}\ge \mathit{m}$.
13: $\mathbf{m}$Integer * Output
On exit: $\mathit{m}$, the number of selected eigenvectors. If ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$ or $\mathrm{Nag_BackTransform}$, m is set to $n$.
14: $\mathbf{fail}$NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

## 6Error 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.
On entry, argument $⟨\mathit{\text{value}}⟩$ had an illegal value.
NE_ENUM_INT
On entry, ${\mathbf{side}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{mm}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{mm}}>0$.
NE_ENUM_INT_2
On entry, ${\mathbf{how_many}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{mm}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: if ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$ or $\mathrm{Nag_BackTransform}$, ${\mathbf{mm}}\ge {\mathbf{n}}$;
otherwise ${\mathbf{mm}}\ge \mathit{m}$.
On entry, ${\mathbf{side}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{pdvl}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{mm}}=⟨\mathit{\text{value}}⟩$.
Constraint: if ${\mathbf{side}}=\mathrm{Nag_LeftSide}$ or $\mathrm{Nag_BothSides}$, ${\mathbf{pdvl}}\ge {\mathbf{mm}}$.
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 {\mathbf{n}}$.
On entry, ${\mathbf{side}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{pdvr}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{mm}}=⟨\mathit{\text{value}}⟩$.
Constraint: if ${\mathbf{side}}=\mathrm{Nag_RightSide}$ or $\mathrm{Nag_BothSides}$, ${\mathbf{pdvr}}\ge {\mathbf{mm}}$.
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 {\mathbf{n}}$.
NE_INT
On entry, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{n}}>0$.
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)$.
On entry, ${\mathbf{pdt}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{pdt}}\ge {\mathbf{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.

## 7Accuracy

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) ε ‖T‖2 sepi$
where ${\mathit{sep}}_{i}$ is the reciprocal condition number of ${x}_{i}$.
The condition number ${\mathit{sep}}_{i}$ may be computed by calling f08qyc.