# NAG CL Interfacef08qyc (ztrsna)

Settings help

CL Name Style:

## 1Purpose

f08qyc estimates condition numbers for specified eigenvalues and/or right eigenvectors of a complex upper triangular matrix.

## 2Specification

 #include
 void f08qyc (Nag_OrderType order, Nag_JobType job, Nag_HowManyType how_many, const Nag_Boolean select[], Integer n, const Complex t[], Integer pdt, const Complex vl[], Integer pdvl, const Complex vr[], Integer pdvr, double s[], double sep[], Integer mm, Integer *m, NagError *fail)
The function may be called by the names: f08qyc, nag_lapackeig_ztrsna or nag_ztrsna.

## 3Description

f08qyc estimates condition numbers for specified eigenvalues and/or right eigenvectors of a complex upper triangular matrix $T$. These are the same as the condition numbers of the eigenvalues and right eigenvectors of an original matrix $A=ZT{Z}^{\mathrm{H}}$ (with unitary $Z$), from which $T$ may have been derived.
f08qyc computes the reciprocal of the condition number of an eigenvalue ${\lambda }_{i}$ as
 $si = |vHu| ‖u‖E‖v‖E ,$
where $u$ and $v$ are the right and left eigenvectors of $T$, respectively, corresponding to ${\lambda }_{i}$. This reciprocal condition number always lies between zero (i.e., ill-conditioned) and one (i.e., well-conditioned).
An approximate error estimate for a computed eigenvalue ${\lambda }_{i}$ is then given by
 $ε‖T‖ si ,$
where $\epsilon$ is the machine precision.
To estimate the reciprocal of the condition number of the right eigenvector corresponding to ${\lambda }_{i}$, the function first calls f08qtc to reorder the eigenvalues so that ${\lambda }_{i}$ is in the leading position:
 $T =Q ( λi cH 0 T22 ) QH.$
The reciprocal condition number of the eigenvector is then estimated as ${\mathit{sep}}_{i}$, the smallest singular value of the matrix $\left({T}_{22}-{\lambda }_{i}I\right)$. This number ranges from zero (i.e., ill-conditioned) to very large (i.e., well-conditioned).
An approximate error estimate for a computed right eigenvector $u$ corresponding to ${\lambda }_{i}$ is then given by
 $ε‖T‖ sepi .$

## 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{job}$Nag_JobType Input
On entry: indicates whether condition numbers are required for eigenvalues and/or eigenvectors.
${\mathbf{job}}=\mathrm{Nag_EigVals}$
Condition numbers for eigenvalues only are computed.
${\mathbf{job}}=\mathrm{Nag_EigVecs}$
Condition numbers for eigenvectors only are computed.
${\mathbf{job}}=\mathrm{Nag_DoBoth}$
Condition numbers for both eigenvalues and eigenvectors are computed.
Constraint: ${\mathbf{job}}=\mathrm{Nag_EigVals}$, $\mathrm{Nag_EigVecs}$ or $\mathrm{Nag_DoBoth}$.
3: $\mathbf{how_many}$Nag_HowManyType Input
On entry: indicates how many condition numbers are to be computed.
${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$
Condition numbers for all eigenpairs are computed.
${\mathbf{how_many}}=\mathrm{Nag_ComputeSelected}$
Condition numbers for selected eigenpairs (as specified by select) are computed.
Constraint: ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$ 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 the eigenpairs for which condition numbers are to be computed if ${\mathbf{how_many}}=\mathrm{Nag_ComputeSelected}$. To select condition numbers for the eigenpair corresponding to the eigenvalue ${\lambda }_{j}$, ${\mathbf{select}}\left[j-1\right]$ must be set to Nag_TRUE.
If ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$, 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]$const Complex Input
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.
7: $\mathbf{pdt}$Integer Input
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: $\mathbf{vl}\left[\mathit{dim}\right]$const Complex Input
Note: the dimension, dim, of the array vl must be at least
• ${\mathbf{pdvl}}×{\mathbf{mm}}$ when ${\mathbf{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$ and ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{n}}×{\mathbf{pdvl}}$ when ${\mathbf{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$ 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{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$, vl must contain the left eigenvectors of $T$ (or of any matrix $QT{Q}^{\mathrm{H}}$ with $Q$ unitary) corresponding to the eigenpairs specified by how_many and select. The eigenvectors must be stored in consecutive rows or columns (depending on the value of order) of vl, as returned by f08pxc or f08qxc.
If ${\mathbf{job}}=\mathrm{Nag_EigVecs}$, 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{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$, ${\mathbf{pdvl}}\ge {\mathbf{n}}$;
• if ${\mathbf{job}}=\mathrm{Nag_EigVecs}$, vl may be NULL;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$,
• if ${\mathbf{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$, ${\mathbf{pdvl}}\ge {\mathbf{mm}}$;
• if ${\mathbf{job}}=\mathrm{Nag_EigVecs}$, vl may be NULL.
10: $\mathbf{vr}\left[\mathit{dim}\right]$const Complex Input
Note: the dimension, dim, of the array vr must be at least
• ${\mathbf{pdvr}}×{\mathbf{mm}}$ when ${\mathbf{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$ and ${\mathbf{order}}=\mathrm{Nag_ColMajor}$;
• ${\mathbf{n}}×{\mathbf{pdvr}}$ when ${\mathbf{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$ 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{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$, vr must contain the right eigenvectors of $T$ (or of any matrix $QT{Q}^{\mathrm{H}}$ with $Q$ unitary) corresponding to the eigenpairs specified by how_many and select. The eigenvectors must be stored in consecutive rows or columns (depending on the value of order) of vr, as returned by f08pxc or f08qxc.
If ${\mathbf{job}}=\mathrm{Nag_EigVecs}$, 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{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$, ${\mathbf{pdvr}}\ge {\mathbf{n}}$;
• if ${\mathbf{job}}=\mathrm{Nag_EigVecs}$, vr may be NULL;
• if ${\mathbf{order}}=\mathrm{Nag_RowMajor}$,
• if ${\mathbf{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$, ${\mathbf{pdvr}}\ge {\mathbf{mm}}$;
• if ${\mathbf{job}}=\mathrm{Nag_EigVecs}$, vr may be NULL.
12: $\mathbf{s}\left[\mathit{dim}\right]$double Output
Note: the dimension, dim, of the array s must be at least
• ${\mathbf{mm}}$ when ${\mathbf{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$;
• otherwise s may be NULL.
On exit: the reciprocal condition numbers of the selected eigenvalues if ${\mathbf{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$, stored in consecutive elements of the array. Thus ${\mathbf{s}}\left[j-1\right]$, ${\mathbf{sep}}\left[j-1\right]$ and the $j$th rows or columns of vl and vr all correspond to the same eigenpair (but not in general the $j$th eigenpair unless all eigenpairs have been selected).
If ${\mathbf{job}}=\mathrm{Nag_EigVecs}$, s is not referenced and may be NULL.
13: $\mathbf{sep}\left[\mathit{dim}\right]$double Output
Note: the dimension, dim, of the array sep must be at least
• ${\mathbf{mm}}$ when ${\mathbf{job}}=\mathrm{Nag_EigVecs}$ or $\mathrm{Nag_DoBoth}$;
• otherwise sep may be NULL.
On exit: the estimated reciprocal condition numbers of the selected right eigenvectors if ${\mathbf{job}}=\mathrm{Nag_EigVecs}$ or $\mathrm{Nag_DoBoth}$, stored in consecutive elements of the array.
If ${\mathbf{job}}=\mathrm{Nag_EigVals}$, sep is not referenced and may be NULL.
14: $\mathbf{mm}$Integer Input
On entry: the number of elements in the arrays s and sep, and the number of rows or columns (depending on the value of order) in the arrays vl and vr (if used). The precise number required, $\mathit{m}$, is $n$ if ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$; if ${\mathbf{how_many}}=\mathrm{Nag_ComputeSelected}$, $\mathit{m}$ is the number of selected eigenpairs (see select), in which case $0\le \mathit{m}\le n$.
Constraints:
• if ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$, ${\mathbf{mm}}\ge {\mathbf{n}}$;
• otherwise ${\mathbf{mm}}\ge \mathit{m}$.
15: $\mathbf{m}$Integer * Output
On exit: $\mathit{m}$, the number of selected eigenpairs. If ${\mathbf{how_many}}=\mathrm{Nag_ComputeAll}$, m is set to $n$.
16: $\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_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}$, ${\mathbf{mm}}\ge {\mathbf{n}}$;
otherwise ${\mathbf{mm}}\ge \mathit{m}$.
On entry, ${\mathbf{job}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{pdvl}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{mm}}=⟨\mathit{\text{value}}⟩$.
Constraint: if ${\mathbf{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$, ${\mathbf{pdvl}}\ge {\mathbf{mm}}$.
On entry, ${\mathbf{job}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{pdvl}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: if ${\mathbf{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$, ${\mathbf{pdvl}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{job}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{pdvr}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{mm}}=⟨\mathit{\text{value}}⟩$.
Constraint: if ${\mathbf{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$, ${\mathbf{pdvr}}\ge {\mathbf{mm}}$.
On entry, ${\mathbf{job}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{pdvr}}=⟨\mathit{\text{value}}⟩$ and ${\mathbf{n}}=⟨\mathit{\text{value}}⟩$.
Constraint: if ${\mathbf{job}}=\mathrm{Nag_EigVals}$ or $\mathrm{Nag_DoBoth}$, ${\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.
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

The computed values ${\mathit{sep}}_{i}$ may over estimate the true value, but seldom by a factor of more than $3$.

## 8Parallelism and Performance

f08qyc 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.

The real analogue of this function is f08qlc.

## 10Example

This example computes approximate error estimates for all the eigenvalues and right eigenvectors of the matrix $T$, where
 $T = ( -6.0004-6.9999i 0.3637-0.3656i -0.1880+0.4787i 0.8785-0.2539i 0.0000+0.0000i -5.0000+2.0060i -0.0307-0.7217i -0.2290+0.1313i 0.0000+0.0000i 0.0000+0.0000i 7.9982-0.9964i 0.9357+0.5359i 0.0000+0.0000i 0.0000+0.0000i 0.0000+0.0000i 3.0023-3.9998i ) .$

### 10.1Program Text

Program Text (f08qyce.c)

### 10.2Program Data

Program Data (f08qyce.d)

### 10.3Program Results

Program Results (f08qyce.r)