?tgsna
Estimates reciprocal condition numbers for specified eigenvalues and/or eigenvectors of a pair of matrices in generalized real Schur canonical form.
Syntax
FORTRAN 77:

call stgsna(job, howmny, select, n, a, lda, b, ldb, vl, ldvl, vr, ldvr, s, dif, mm, m, work, lwork, iwork, info)
call dtgsna(job, howmny, select, n, a, lda, b, ldb, vl, ldvl, vr, ldvr, s, dif, mm, m, work, lwork, iwork, info)
call ctgsna(job, howmny, select, n, a, lda, b, ldb, vl, ldvl, vr, ldvr, s, dif, mm, m, work, lwork, iwork, info)
call ztgsna(job, howmny, select, n, a, lda, b, ldb, vl, ldvl, vr, ldvr, s, dif, mm, m, work, lwork, iwork, info)
Fortran 95:

call tgsna(a, b [,s] [,dif] [,vl] [,vr] [,select] [,m] [,info])
C:

lapack_int LAPACKE_stgsna( int matrix_layout, char job, char howmny, const lapack_logical* select, lapack_int n, const float* a, lapack_int lda, const float* b, lapack_int ldb, const float* vl, lapack_int ldvl, const float* vr, lapack_int ldvr, float* s, float* dif, lapack_int mm, lapack_int* m );
lapack_int LAPACKE_dtgsna( int matrix_layout, char job, char howmny, const lapack_logical* select, lapack_int n, const double* a, lapack_int lda, const double* b, lapack_int ldb, const double* vl, lapack_int ldvl, const double* vr, lapack_int ldvr, double* s, double* dif, lapack_int mm, lapack_int* m );
lapack_int LAPACKE_ctgsna( int matrix_layout, char job, char howmny, const lapack_logical* select, lapack_int n, const lapack_complex_float* a, lapack_int lda, const lapack_complex_float* b, lapack_int ldb, const lapack_complex_float* vl, lapack_int ldvl, const lapack_complex_float* vr, lapack_int ldvr, float* s, float* dif, lapack_int mm, lapack_int* m );
lapack_int LAPACKE_ztgsna( int matrix_layout, char job, char howmny, const lapack_logical* select, lapack_int n, const lapack_complex_double* a, lapack_int lda, const lapack_complex_double* b, lapack_int ldb, const lapack_complex_double* vl, lapack_int ldvl, const lapack_complex_double* vr, lapack_int ldvr, double* s, double* dif, lapack_int mm, lapack_int* m );
Description
The real flavors stgsna/dtgsna of this routine estimate reciprocal condition numbers for specified eigenvalues and/or eigenvectors of a matrix pair (A, B) in generalized real Schur canonical form (or of any matrix pair (Q*A*Z^{T}, Q*B*Z^{T}) with orthogonal matrices Q and Z.
(A, B) must be in generalized real Schur form (as returned by gges/gges), that is, A is block upper triangular with 1by1 and 2by2 diagonal blocks. B is upper triangular.
The complex flavors ctgsna/ztgsna estimate reciprocal condition numbers for specified eigenvalues and/or eigenvectors of a matrix pair (A, B). (A, B) must be in generalized Schur canonical form, that is, A and B are both upper triangular.
Input Parameters
The data types are given for the Fortran interface. A <datatype> placeholder, if present, is used for the C interface data types in the C interface section above. See C Interface Conventions for the C interface principal conventions and type definitions.
 job

CHARACTER*1. Specifies whether condition numbers are required for eigenvalues or eigenvectors. Must be 'E' or 'V' or 'B'.
If
job = 'E'
, for eigenvalues only (compute s ).If
job = 'V'
, for eigenvectors only (compute dif ).If
job = 'B'
, for both eigenvalues and eigenvectors (compute both s and dif).  howmny

CHARACTER*1. Must be 'A' or 'S'.
If
howmny = 'A'
, compute condition numbers for all eigenpairs.If
howmny = 'S'
, compute condition numbers for selected eigenpairs specified by the logical array select.  select

LOGICAL.
Array, DIMENSION at least max (1, n).
If
howmny = 'S'
, select specifies the eigenpairs for which condition numbers are required.If
howmny = 'A'
, select is not referenced.For real flavors:
To select condition numbers for the eigenpair corresponding to a real eigenvalue omega(j), select(j) must be set to .TRUE.; to select condition numbers corresponding to a complex conjugate pair of eigenvalues omega(j) and omega(j+1), either select(j) or select(j+1) must be set to .TRUE.
For complex flavors:
To select condition numbers for the corresponding jth eigenvalue and/or eigenvector, select(j) must be set to .TRUE..
 n

INTEGER. The order of the square matrix pair (A, B)
(n ≥ 0).
 a, b, vl, vr, work

REAL for stgsna
DOUBLE PRECISION for dtgsna
COMPLEX for ctgsna
DOUBLE COMPLEX for ztgsna.
Arrays:
a(lda,*) contains the upper quasitriangular (for real flavors) or upper triangular (for complex flavors) matrix A in the pair (A, B).
The second dimension of a must be at least max(1, n).
b(ldb,*) contains the upper triangular matrix B in the pair (A, B). The second dimension of b must be at least max(1, n).
If
job = 'E'
or 'B', vl(ldvl,*) must contain left eigenvectors of (A, B), corresponding to the eigenpairs specified by howmny and select. The eigenvectors must be stored in consecutive columns of vl, as returned by ?tgevc.If
job = 'V'
, vl is not referenced. The second dimension of vl must be at least max(1, m).If
job = 'E'
or 'B', vr(ldvr,*) must contain right eigenvectors of (A, B), corresponding to the eigenpairs specified by howmny and select. The eigenvectors must be stored in consecutive columns of vr, as returned by ?tgevc.If
work is a workspace array, its dimensionjob = 'V'
, vr is not referenced. The second dimension of vr must be at least max(1, m).max(1, lwork)
.If
job = 'E'
, work is not referenced.  lda

INTEGER. The leading dimension of a; at least max(1, n).
 ldb

INTEGER. The leading dimension of b; at least max(1, n).
 ldvl

INTEGER. The leading dimension of vl;
ldvl ≥ 1
.If
job = 'E'
or 'B', then ldvl ≥ max(1, n).  ldvr

INTEGER. The leading dimension of vr;
ldvr ≥ 1
.If
job = 'E'
or 'B', thenldvr ≥ max(1, n)
.  mm

INTEGER. The number of elements in the arrays s and dif (
mm ≥ m
).  lwork

INTEGER. The dimension of the array work.
lwork ≥ max(1, n)
.If
job = 'V'
or 'B',lwork ≥ 2*n*(n+2)+16
for real flavors, andlwork ≥ max(1, 2*n*n)
for complex flavors.If
lwork = 1
, then a workspace query is assumed; the routine only calculates the optimal 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 by xerbla. See Application Notes for details.  iwork

INTEGER. Workspace array, DIMENSION at least (n+6) for real flavors, and at least (n+2) for complex flavors.
If
job = 'E'
, iwork is not referenced.
Output Parameters
 s

REAL for singleprecision flavors
DOUBLE PRECISION for doubleprecision flavors.
Array, DIMENSION (mm ).
If
job = 'E'
or 'B', contains the reciprocal condition numbers of the selected eigenvalues, stored in consecutive elements of the array.If
job = 'V'
, s is not referenced.For real flavors:
For a complex conjugate pair of eigenvalues two consecutive elements of s are set to the same value. Thus, s(j), dif(j), and the jth columns of vl and vr all correspond to the same eigenpair (but not in general the jth eigenpair, unless all eigenpairs are selected).
 dif

REAL for singleprecision flavors
DOUBLE PRECISION for doubleprecision flavors.
Array, DIMENSION (mm ).
If
job = 'V'
or 'B', contains the estimated reciprocal condition numbers of the selected eigenvectors, stored in consecutive elements of the array.If the eigenvalues cannot be reordered to compute dif(j), dif(j) is set to 0; this can only occur when the true value would be very small anyway.
If
job = 'E'
, dif is not referenced.For real flavors:
For a complex eigenvector, two consecutive elements of dif are set to the same value.
For complex flavors:
For each eigenvalue/vector specified by select, dif stores a Frobenius normbased estimate of Difl.
 m

INTEGER. The number of elements in the arrays s and dif used to store the specified condition numbers; for each selected eigenvalue one element is used.
If
howmny = 'A'
, m is set to n.  work
(1)

work(1)
If job is not 'E' and
info = 0
, on exit,work(1)
contains the minimum value of lwork required for optimum performance. Use this lwork for subsequent runs.  info

INTEGER.
If
info = 0
, the execution is successful.If
info = i
, the ith parameter had an illegal value.
Fortran 95 Interface Notes
Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or restorable arguments, see Fortran 95 Interface Conventions.
Specific details for the routine tgsna interface are the following:
 a

Holds the matrix A of size (n,n).
 b

Holds the matrix B of size (n,n).
 s

Holds the vector of length (mm).
 dif

Holds the vector of length (mm).
 vl

Holds the matrix VL of size (n,mm).
 vr

Holds the matrix VR of size (n,mm).
 select

Holds the vector of length n.
 howmny

Restored based on the presence of the argument select as follows:
howmny = 'S'
, if select is present,howmny = 'A'
, if select is omitted.  job

Restored based on the presence of arguments s and dif as follows:
job = 'B'
, if both s and dif are present,job = 'E'
, if s is present and dif omitted,job = 'V'
, if s is omitted and dif present, Note that there will be an error condition if both s and dif are omitted.
Application Notes
If it is not clear how much workspace to supply, use a generous value of lwork for the first run, or set lwork = 1
.
In first case the routine completes the task, though probably not so fast as with a recommended workspace, and provides the recommended workspace in the first element of the corresponding array work on exit. Use this value (work(1)
) for subsequent runs.
If lwork = 1
, then the routine returns immediately and provides the recommended workspace in the first element of the corresponding array (work). This operation is called a workspace query.
Note that if lwork is less than the minimal required value and is not equal to 1, then the routine returns immediately with an error exit and does not provide any information on the recommended workspace.