f08 Chapter Contents
f08 Chapter Introduction
NAG Library Manual

# NAG Library Function Documentnag_dtrevc (f08qkc)

## 1  Purpose

nag_dtrevc (f08qkc) computes selected left and/or right eigenvectors of a real upper quasi-triangular matrix.

## 2  Specification

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

## 3  Description

nag_dtrevc (f08qkc) computes left and/or right eigenvectors of a real upper quasi-triangular matrix $T$ in canonical Schur form. Such a matrix arises from the Schur factorization of a real general matrix, as computed by nag_dhseqr (f08pec), 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 ​ TTy = λ-y .$
Note that even though $T$ is real, $\lambda$, $x$ and $y$ may be complex. If $x$ is an eigenvector corresponding to a complex eigenvalue $\lambda$, then the complex conjugate vector $\stackrel{-}{x}$ is the eigenvector corresponding to the complex conjugate eigenvalue $\stackrel{-}{\lambda }$.
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 an orthogonal matrix from the Schur factorization of a matrix $A$ as $A=QT{Q}^{\mathrm{T}}$; 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, for a real eigenvector $x$, $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(\left|{x}_{i}\right|\right)=1$, and for a complex eigenvector, $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(\left|\mathrm{Re}\left({x}_{i}\right)\right|+\left|\mathrm{Im}\left({x}_{i}\right)\right|\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 $\mathrm{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}$]Nag_BooleanInput/Output
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 real eigenvector corresponding to the real eigenvalue ${\lambda }_{j}$, ${\mathbf{select}}\left[j-1\right]$ must be set Nag_TRUE. To select the complex eigenvector corresponding to a complex conjugate pair of eigenvalues ${\lambda }_{j}$ and ${\lambda }_{j+1}$, ${\mathbf{select}}\left[j-1\right]$ and/or ${\mathbf{select}}\left[j\right]$ 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 ${\mathbf{select}}\left[j-1\right]$ is set to Nag_TRUE and ${\mathbf{select}}\left[j\right]$ to Nag_FALSE.
If ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$ or $\mathrm{Nag_BackTransform}$, select is not referenced and may be NULL.
5:     nIntegerInput
On entry: $n$, the order of the matrix $T$.
Constraint: ${\mathbf{n}}\ge 0$.
6:     t[$\mathit{dim}$]const doubleInput
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$ by $n$ upper quasi-triangular matrix $T$ in canonical Schur form, as returned by nag_dhseqr (f08pec).
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}$]doubleInput/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$ by $n$ matrix $Q$ (usually the matrix of Schur vectors returned by nag_dhseqr (f08pec)).
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 of the array, in the same order as their eigenvalues. Corresponding to each real eigenvalue is a real eigenvector, occupying one row or column. Corresponding to each complex conjugate pair of eigenvalues, 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 ${\mathbf{side}}=\mathrm{Nag_RightSide}$, vl is not referenced and may be NULL.
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 {\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:   vr[$\mathit{dim}$]doubleInput/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$ by $n$ matrix $Q$ (usually the matrix of Schur vectors returned by nag_dhseqr (f08pec)).
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 of the array, in the same order as their eigenvalues. Corresponding to each real eigenvalue is a real eigenvector, occupying one row or column. Corresponding to each complex conjugate pair of eigenvalues, 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 ${\mathbf{side}}=\mathrm{Nag_LeftSide}$, vr is not referenced and may be NULL.
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 {\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:   mmIntegerInput
On entry: the number of rows or columns in the arrays vl and/or vr. The precise number of rows or columns required (depending on the value of order), $\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 obtained by counting $1$ for each selected real eigenvector and $2$ for each selected complex eigenvector (see select), in which case $0\le \mathit{required_rowcol}\le n$.
Constraints:
• if ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$ or $\mathrm{Nag_BackTransform}$, ${\mathbf{mm}}\ge {\mathbf{n}}$;
• otherwise ${\mathbf{mm}}\ge \mathit{required_rowcol}$.
13:   mInteger *Output
On exit: $\mathit{required_rowcol}$, the number of rows or columns of vl and/or vr actually used to store the computed 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{mm}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{how_many}}=⟨\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{required_rowcol}$.
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 {\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}}⟩$, ${\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}}\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_dtrsna (f08qlc).

## 8  Parallelism and Performance

nag_dtrevc (f08qkc) is not threaded by NAG in any implementation.
nag_dtrevc (f08qkc) 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.