# NAG FL Interfacef08yyf (ztgsna)

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

f08yyf estimates condition numbers for specified eigenvalues and/or eigenvectors of a complex matrix pair in generalized Schur form.

## 2Specification

Fortran Interface
 Subroutine f08yyf ( job, n, a, lda, b, ldb, vl, ldvl, vr, ldvr, s, dif, mm, m, work, info)
 Integer, Intent (In) :: n, lda, ldb, ldvl, ldvr, mm, lwork Integer, Intent (Inout) :: iwork(*) Integer, Intent (Out) :: m, info Real (Kind=nag_wp), Intent (Inout) :: s(*), dif(*) Complex (Kind=nag_wp), Intent (In) :: a(lda,*), b(ldb,*), vl(ldvl,*), vr(ldvr,*) Complex (Kind=nag_wp), Intent (Out) :: work(max(1,lwork)) Logical, Intent (In) :: select(*) Character (1), Intent (In) :: job, howmny
#include <nag.h>
 void f08yyf_ (const char *job, const char *howmny, const logical sel[], const Integer *n, const Complex a[], const Integer *lda, const Complex b[], const Integer *ldb, const Complex vl[], const Integer *ldvl, const Complex vr[], const Integer *ldvr, double s[], double dif[], const Integer *mm, Integer *m, Complex work[], const Integer *lwork, Integer iwork[], Integer *info, const Charlen length_job, const Charlen length_howmny)
The routine may be called by the names f08yyf, nagf_lapackeig_ztgsna or its LAPACK name ztgsna.

## 3Description

f08yyf estimates condition numbers for specified eigenvalues and/or right eigenvectors of an $n×n$ matrix pair $\left(S,T\right)$ in generalized Schur form. The routine actually returns estimates of the reciprocals of the condition numbers in order to avoid possible overflow.
The pair $\left(S,T\right)$ are in generalized Schur form if $S$ and $T$ are upper triangular as returned, for example, by f08xpf or f08xqf, or f08xsf with ${\mathbf{job}}=\text{'S'}$. The diagonal elements define the generalized eigenvalues $\left({\alpha }_{\mathit{i}},{\beta }_{\mathit{i}}\right)$, for $\mathit{i}=1,2,\dots ,n$, of the pair $\left(S,T\right)$ and the eigenvalues are given by
 $λi = αi / βi ,$
so that
 $βi S xi = αi T xi or S xi = λi T xi ,$
where ${x}_{i}$ is the corresponding (right) eigenvector.
If $S$ and $T$ are the result of a generalized Schur factorization of a matrix pair $\left(A,B\right)$
 $A = QSZH , B = QTZH$
then the eigenvalues and condition numbers of the pair $\left(S,T\right)$ are the same as those of the pair $\left(A,B\right)$.
Let $\left(\alpha ,\beta \right)\ne \left(0,0\right)$ be a simple generalized eigenvalue of $\left(A,B\right)$. Then the reciprocal of the condition number of the eigenvalue $\lambda =\alpha /\beta$ is defined as
 $s(λ)= ( |yHAx| 2 + |yHBx| 2 ) 1/2 (‖x‖2‖y‖2) ,$
where $x$ and $y$ are the right and left eigenvectors of $\left(A,B\right)$ corresponding to $\lambda$. If both $\alpha$ and $\beta$ are zero, then $\left(A,B\right)$ is singular and $s\left(\lambda \right)=-1$ is returned.
If $U$ and $V$ are unitary transformations such that
 $UH (A,B) V= (S,T) = ( α * 0 S22 ) ( β * 0 T22 ) ,$
where ${S}_{22}$ and ${T}_{22}$ are $\left(n-1\right)×\left(n-1\right)$ matrices, then the reciprocal condition number is given by
 $Dif(x) ≡ Dif(y) = Dif((α,β),(S22,T22)) = σmin (Z) ,$
where ${\sigma }_{\mathrm{min}}\left(Z\right)$ denotes the smallest singular value of the $2\left(n-1\right)×2\left(n-1\right)$ matrix
 $Z = ( α⊗I −1⊗S22 β⊗I −1⊗T22 )$
and $\otimes$ is the Kronecker product.
See Sections 2.4.8 and 4.11 of Anderson et al. (1999) and Kågström and Poromaa (1996) for further details and information.

## 4References

Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia https://www.netlib.org/lapack/lug
Kågström B and Poromaa P (1996) LAPACK-style algorithms and software for solving the generalized Sylvester equation and estimating the separation between regular matrix pairs ACM Trans. Math. Software 22 78–103

## 5Arguments

1: $\mathbf{job}$Character(1) Input
On entry: indicates whether condition numbers are required for eigenvalues and/or eigenvectors.
${\mathbf{job}}=\text{'E'}$
Condition numbers for eigenvalues only are computed.
${\mathbf{job}}=\text{'V'}$
Condition numbers for eigenvectors only are computed.
${\mathbf{job}}=\text{'B'}$
Condition numbers for both eigenvalues and eigenvectors are computed.
Constraint: ${\mathbf{job}}=\text{'E'}$, $\text{'V'}$ or $\text{'B'}$.
2: $\mathbf{howmny}$Character(1) Input
On entry: indicates how many condition numbers are to be computed.
${\mathbf{howmny}}=\text{'A'}$
Condition numbers for all eigenpairs are computed.
${\mathbf{howmny}}=\text{'S'}$
Condition numbers for selected eigenpairs (as specified by select) are computed.
Constraint: ${\mathbf{howmny}}=\text{'A'}$ or $\text{'S'}$.
3: $\mathbf{select}\left(*\right)$Logical array Input
Note: the dimension of the array select must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$ if ${\mathbf{howmny}}=\text{'S'}$, and at least $1$ otherwise.
On entry: specifies the eigenpairs for which condition numbers are to be computed if ${\mathbf{howmny}}=\text{'S'}$. To select condition numbers for the eigenpair corresponding to the eigenvalue ${\lambda }_{j}$, ${\mathbf{select}}\left(j\right)$ must be set to .TRUE..
If ${\mathbf{howmny}}=\text{'A'}$, select is not referenced.
4: $\mathbf{n}$Integer Input
On entry: $n$, the order of the matrix pair $\left(S,T\right)$.
Constraint: ${\mathbf{n}}\ge 0$.
5: $\mathbf{a}\left({\mathbf{lda}},*\right)$Complex (Kind=nag_wp) array Input
Note: the second dimension of the array a must be at least ${\mathbf{n}}$.
On entry: the upper triangular matrix $S$.
6: $\mathbf{lda}$Integer Input
On entry: the first dimension of the array a as declared in the (sub)program from which f08yyf is called.
Constraint: ${\mathbf{lda}}\ge {\mathbf{n}}$.
7: $\mathbf{b}\left({\mathbf{ldb}},*\right)$Complex (Kind=nag_wp) array Input
Note: the second dimension of the array b must be at least ${\mathbf{n}}$.
On entry: the upper triangular matrix $T$.
8: $\mathbf{ldb}$Integer Input
On entry: the first dimension of the array b as declared in the (sub)program from which f08yyf is called.
Constraint: ${\mathbf{ldb}}\ge {\mathbf{n}}$.
9: $\mathbf{vl}\left({\mathbf{ldvl}},*\right)$Complex (Kind=nag_wp) array Input
Note: the second dimension of the array vl must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{mm}}\right)$ if ${\mathbf{job}}=\text{'E'}$ or $\text{'B'}$.
On entry: if ${\mathbf{job}}=\text{'E'}$ or $\text{'B'}$, vl must contain left eigenvectors of $\left(S,T\right)$, corresponding to the eigenpairs specified by howmny and select. The eigenvectors must be stored in consecutive columns of vl, as returned by f08wqf or f08yxf.
If ${\mathbf{job}}=\text{'V'}$, vl is not referenced.
10: $\mathbf{ldvl}$Integer Input
On entry: the first dimension of the array vl as declared in the (sub)program from which f08yyf is called.
Constraints:
• if ${\mathbf{job}}=\text{'E'}$ or $\text{'B'}$, ${\mathbf{ldvl}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• otherwise ${\mathbf{ldvl}}\ge 1$.
11: $\mathbf{vr}\left({\mathbf{ldvr}},*\right)$Complex (Kind=nag_wp) array Input
Note: the second dimension of the array vr must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{mm}}\right)$ if ${\mathbf{job}}=\text{'E'}$ or $\text{'B'}$.
On entry: if ${\mathbf{job}}=\text{'E'}$ or $\text{'B'}$, vr must contain right eigenvectors of $\left(S,T\right)$, corresponding to the eigenpairs specified by howmny and select. The eigenvectors must be stored in consecutive columns of vr, as returned by f08wqf or f08yxf.
If ${\mathbf{job}}=\text{'V'}$, vr is not referenced.
12: $\mathbf{ldvr}$Integer Input
On entry: the first dimension of the array vr as declared in the (sub)program from which f08yyf is called.
Constraints:
• if ${\mathbf{job}}=\text{'E'}$ or $\text{'B'}$, ${\mathbf{ldvr}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• otherwise ${\mathbf{ldvr}}\ge 1$.
13: $\mathbf{s}\left(*\right)$Real (Kind=nag_wp) array Output
Note: the dimension of the array s must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{mm}}\right)$ if ${\mathbf{job}}=\text{'E'}$ or $\text{'B'}$.
On exit: if ${\mathbf{job}}=\text{'E'}$ or $\text{'B'}$, the reciprocal condition numbers of the selected eigenvalues, stored in consecutive elements of the array.
If ${\mathbf{job}}=\text{'V'}$, s is not referenced.
14: $\mathbf{dif}\left(*\right)$Real (Kind=nag_wp) array Output
Note: the dimension of the array dif must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{mm}}\right)$ if ${\mathbf{job}}=\text{'V'}$ or $\text{'B'}$.
On exit: if ${\mathbf{job}}=\text{'V'}$ or $\text{'B'}$, the estimated reciprocal condition numbers of the selected eigenvectors, stored in consecutive elements of the array. If the eigenvalues cannot be reordered to compute ${\mathbf{dif}}\left(j\right)$, ${\mathbf{dif}}\left(j\right)$ is set to $0$; this can only occur when the true value would be very small anyway.
If ${\mathbf{job}}=\text{'E'}$, dif is not referenced.
15: $\mathbf{mm}$Integer Input
On entry: the number of elements in the arrays s and dif.
Constraints:
• if ${\mathbf{howmny}}=\text{'A'}$, ${\mathbf{mm}}\ge {\mathbf{n}}$;
• otherwise ${\mathbf{mm}}\ge \text{​ the number of selected eigenvalues}$.
16: $\mathbf{m}$Integer Output
On exit: the number of elements of the arrays s and dif used to store the specified condition numbers; for each selected eigenvalue one element is used.
If ${\mathbf{howmny}}=\text{'A'}$, m is set to n.
17: $\mathbf{work}\left(\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{lwork}}\right)\right)$Complex (Kind=nag_wp) array Workspace
On exit: if ${\mathbf{info}}={\mathbf{0}}$, the real part of ${\mathbf{work}}\left(1\right)$ contains the minimum value of lwork required for optimal performance.
18: $\mathbf{lwork}$Integer Input
On entry: the dimension of the array work as declared in the (sub)program from which f08yyf is called.
If ${\mathbf{lwork}}=-1$, a workspace query is assumed; the routine only calculates the minimum size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued.
Constraints:
if ${\mathbf{lwork}}\ne -1$,
• if ${\mathbf{job}}=\text{'V'}$ or $\text{'B'}$, ${\mathbf{lwork}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,2×{\mathbf{n}}×{\mathbf{n}}\right)$;
• otherwise ${\mathbf{lwork}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
19: $\mathbf{iwork}\left(*\right)$Integer array Workspace
Note: the dimension of the array iwork must be at least $\left({\mathbf{n}}+2\right)$.
If ${\mathbf{job}}=\text{'E'}$, iwork is not referenced.
20: $\mathbf{info}$Integer Output
On exit: ${\mathbf{info}}=0$ unless the routine detects an error (see Section 6).

## 6Error Indicators and Warnings

${\mathbf{info}}<0$
If ${\mathbf{info}}=-i$, argument $i$ had an illegal value. An explanatory message is output, and execution of the program is terminated.

Not applicable.

## 8Parallelism and Performance

f08yyf 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 routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

An approximate asymptotic error bound on the chordal distance between the computed eigenvalue $\stackrel{~}{\lambda }$ and the corresponding exact eigenvalue $\lambda$ is
 $χ(λ~,λ) ≤ ε‖(A,B)‖F / S(λ)$
where $\epsilon$ is the machine precision.
An approximate asymptotic error bound for the right or left computed eigenvectors $\stackrel{~}{x}$ or $\stackrel{~}{y}$ corresponding to the right and left eigenvectors $x$ and $y$ is given by
 $θ(z~,z) ≤ ε ‖(A,B)‖F / Dif .$
The real analogue of this routine is f08ylf.

## 10Example

This example estimates condition numbers and approximate error estimates for all the eigenvalues and right eigenvectors of the pair $\left(S,T\right)$ given by
 $S = ( 4.0+4.0i 1.0+1.0i 1.0+1.0i 2.0-1.0i 0.0i+0.0 2.0+1.0i 1.0+1.0i 1.0+1.0i 0.0i+0.0 0.0i+0.0 2.0-1.0i 1.0+1.0i 0.0i+0.0 0.0i+0.0 0.0i+0.0 6.0-2.0i )$
and
 $T = ( 2.0 1.0+1.0i 1.0+1.0i 3.0-1.0i 0.0 1.0i+0.0 2.0+1.0i 1.0+1.0i 0.0 0.0i+0.0 1.0i+0.0 1.0+1.0i 0.0 0.0i+0.0 0.0i+0.0 2.0i+0.0 ) .$
The eigenvalues and eigenvectors are computed by calling f08yxf.

### 10.1Program Text

Program Text (f08yyfe.f90)

### 10.2Program Data

Program Data (f08yyfe.d)

### 10.3Program Results

Program Results (f08yyfe.r)