?ggevx
Computes the generalized eigenvalues, and, optionally, the left and/or right generalized eigenvectors.
Syntax
FORTRAN 77:

call sggevx(balanc, jobvl, jobvr, sense, n, a, lda, b, ldb, alphar, alphai, beta, vl, ldvl, vr, ldvr, ilo, ihi, lscale, rscale, abnrm, bbnrm, rconde, rcondv, work, lwork, iwork, bwork, info)
call dggevx(balanc, jobvl, jobvr, sense, n, a, lda, b, ldb, alphar, alphai, beta, vl, ldvl, vr, ldvr, ilo, ihi, lscale, rscale, abnrm, bbnrm, rconde, rcondv, work, lwork, iwork, bwork, info)
call cggevx(balanc, jobvl, jobvr, sense, n, a, lda, b, ldb, alpha, beta, vl, ldvl, vr, ldvr, ilo, ihi, lscale, rscale, abnrm, bbnrm, rconde, rcondv, work, lwork, rwork, iwork, bwork, info)
call zggevx(balanc, jobvl, jobvr, sense, n, a, lda, b, ldb, alpha, beta, vl, ldvl, vr, ldvr, ilo, ihi, lscale, rscale, abnrm, bbnrm, rconde, rcondv, work, lwork, rwork, iwork, bwork, info)
Fortran 95:

call ggevx(a, b, alphar, alphai, beta [,vl] [,vr] [,balanc] [,ilo] [,ihi] [, lscale] [,rscale] [,abnrm] [,bbnrm] [,rconde] [,rcondv] [,info])
call ggevx(a, b, alpha, beta [, vl] [,vr] [,balanc] [,ilo] [,ihi] [,lscale] [, rscale] [,abnrm] [,bbnrm] [,rconde] [,rcondv] [,info])
C:

lapack_int LAPACKE_sggevx( int matrix_layout, char balanc, char jobvl, char jobvr, char sense, lapack_int n, float* a, lapack_int lda, float* b, lapack_int ldb, float* alphar, float* alphai, float* beta, float* vl, lapack_int ldvl, float* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, float* lscale, float* rscale, float* abnrm, float* bbnrm, float* rconde, float* rcondv );
lapack_int LAPACKE_dggevx( int matrix_layout, char balanc, char jobvl, char jobvr, char sense, lapack_int n, double* a, lapack_int lda, double* b, lapack_int ldb, double* alphar, double* alphai, double* beta, double* vl, lapack_int ldvl, double* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, double* lscale, double* rscale, double* abnrm, double* bbnrm, double* rconde, double* rcondv );
lapack_int LAPACKE_cggevx( int matrix_layout, char balanc, char jobvl, char jobvr, char sense, lapack_int n, lapack_complex_float* a, lapack_int lda, lapack_complex_float* b, lapack_int ldb, lapack_complex_float* alpha, lapack_complex_float* beta, lapack_complex_float* vl, lapack_int ldvl, lapack_complex_float* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, float* lscale, float* rscale, float* abnrm, float* bbnrm, float* rconde, float* rcondv );
lapack_int LAPACKE_zggevx( int matrix_layout, char balanc, char jobvl, char jobvr, char sense, lapack_int n, lapack_complex_double* a, lapack_int lda, lapack_complex_double* b, lapack_int ldb, lapack_complex_double* alpha, lapack_complex_double* beta, lapack_complex_double* vl, lapack_int ldvl, lapack_complex_double* vr, lapack_int ldvr, lapack_int* ilo, lapack_int* ihi, double* lscale, double* rscale, double* abnrm, double* bbnrm, double* rconde, double* rcondv );
Description
The routine computes for a pair of nbyn real/complex nonsymmetric matrices (A,B), the generalized eigenvalues, and optionally, the left and/or right generalized eigenvectors.
Optionally also, it computes a balancing transformation to improve the conditioning of the eigenvalues and eigenvectors (ilo, ihi, lscale, rscale, abnrm, and bbnrm), reciprocal condition numbers for the eigenvalues (rconde), and reciprocal condition numbers for the right eigenvectors (rcondv).
A generalized eigenvalue for a pair of matrices (A,B) is a scalar λ or a ratio alpha / beta = λ
, such that A  λ*B
is singular. It is usually represented as the pair (alpha, beta), as there is a reasonable interpretation for beta=0
and even for both being zero. The right generalized eigenvector v(j)
corresponding to the generalized eigenvalue λ(j)
of (A,B) satisfies
A*v(j) = λ(j)*B*v(j)
.
The left generalized eigenvector u(j)
corresponding to the generalized eigenvalue λ(j)
of (A,B) satisfies
u(j)^{H}*A = λ(j)*u(j)^{H}*B
where u(j)^{H}
denotes the conjugate transpose of u(j)
.
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.
 balanc

CHARACTER*1. Must be 'N', 'P', 'S', or 'B'. Specifies the balance option to be performed.
If
balanc = 'N'
, do not diagonally scale or permute;If
balanc = 'P'
, permute only;If
balanc = 'S'
, scale only;If
balanc = 'B'
, both permute and scale.Computed reciprocal condition numbers will be for the matrices after balancing and/or permuting. Permuting does not change condition numbers (in exact arithmetic), but balancing does.
 jobvl

CHARACTER*1. Must be 'N' or 'V'.
If
jobvl = 'N'
, the left generalized eigenvectors are not computed;If
jobvl = 'V'
, the left generalized eigenvectors are computed.  jobvr

CHARACTER*1. Must be 'N' or 'V'.
If
jobvr = 'N'
, the right generalized eigenvectors are not computed;If
jobvr = 'V'
, the right generalized eigenvectors are computed.  sense

CHARACTER*1. Must be 'N', 'E', 'V', or 'B'. Determines which reciprocal condition number are computed.
If
sense = 'N'
, none are computed;If
sense = 'E'
, computed for eigenvalues only;If
sense = 'V'
, computed for eigenvectors only;If
sense = 'B'
, computed for eigenvalues and eigenvectors.  n

INTEGER. The order of the matrices A, B, vl, and vr (
n ≥ 0
).  a, b, work

REAL for sggevx
DOUBLE PRECISION for dggevx
COMPLEX for cggevx
DOUBLE COMPLEX for zggevx.
Arrays:
a(lda,*) is an array containing the nbyn matrix A (first of the pair of matrices).
The second dimension of a must be at least max(1, n).
b(ldb,*) is an array containing the nbyn matrix B (second of the pair of matrices).
The second dimension of b must be at least max(1, n).
work is a workspace array, its dimension
max(1, lwork)
.  lda

INTEGER. The leading dimension of the array a.
Must be at least max(1, n).
 ldb

INTEGER. The leading dimension of the array b.
Must be at least max(1, n).
 ldvl, ldvr

INTEGER. The leading dimensions of the output matrices vl and vr, respectively.
Constraints:
ldvl ≥ 1
. Ifjobvl = 'V'
,ldvl ≥ max(1, n)
.ldvr ≥ 1
. Ifjobvr = 'V'
,ldvr ≥ max(1, n)
.  lwork

INTEGER.
The dimension of the array work.
lwork ≥ max(1, 2*n)
;For real flavors:
If
balanc = 'S'
, or 'B', orjobvl = 'V'
, orjobvr = 'V'
, thenlwork ≥ max(1, 6*n)
;if
sense = 'E'
, or 'B', thenlwork ≥ max(1, 10*n)
;if
sense = 'V'
, or 'B',lwork ≥ (2n^{2}+ 8*n+16)
.For complex flavors:
if
sense = 'E'
,lwork ≥ max(1, 4*n)
;if
sense = 'V'
, or 'B',lwork ≥max(1, 2*n^{2}+ 2*n)
.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.  rwork

REAL for cggevx
DOUBLE PRECISION for zggevx
Workspace array, DIMENSION at least
max(1, 6*n)
ifbalanc = 'S'
, or 'B', and at leastmax(1, 2*n)
otherwise.This array is used in complex flavors only.
 iwork

INTEGER.
Workspace array, DIMENSION at least (n+6) for real flavors and at least (n+2) for complex flavors.
Not referenced if
sense = 'E'
.  bwork

LOGICAL. Workspace array, DIMENSION at least max(1, n).
Not referenced if
sense = 'N'
.
Output Parameters
 a, b

On exit, these arrays have been overwritten.
If
jobvl = 'V'
orjobvr = 'V'
or both, then a contains the first part of the real Schur form of the "balanced" versions of the input A and B, and b contains its second part.  alphar, alphai

REAL for sggevx;
DOUBLE PRECISION for dggevx.
Arrays, DIMENSION at least max(1, n) each. Contain values that form generalized eigenvalues in real flavors.
See beta.
 alpha

COMPLEX for cggevx;
DOUBLE COMPLEX for zggevx.
Array, DIMENSION at least max(1, n). Contain values that form generalized eigenvalues in complex flavors. See beta.
 beta

REAL for sggevx
DOUBLE PRECISION for dggevx
COMPLEX for cggevx
DOUBLE COMPLEX for zggevx.
Array, DIMENSION at least max(1, n).
For real flavors:
On exit, (alphar(j) + alphai(j)*i)/beta(j), j=1,..., n, will be the generalized eigenvalues.
If alphai(j) is zero, then the jth eigenvalue is real; if positive, then the jth and (j+1)st eigenvalues are a complex conjugate pair, with alphai(j+1) negative.
For complex flavors:
On exit, alpha(j)/beta(j), j=1,..., n, will be the generalized eigenvalues.
See also Application Notes below.  vl, vr

REAL for sggevx
DOUBLE PRECISION for dggevx
COMPLEX for cggevx
DOUBLE COMPLEX for zggevx.
Arrays:
vl(ldvl,*); the second dimension of vl must be at least max(1, n).
If
jobvl = 'V'
, the left generalized eigenvectorsu(j)
are stored one after another in the columns of vl, in the same order as their eigenvalues. Each eigenvector will be scaled so the largest component have abs(Re) + abs(Im) = 1.If
jobvl = 'N'
, vl is not referenced.For real flavors:
If the jth eigenvalue is real, then
u(j) = vl(:,j)
, the jth column of vl.If the jth and (j+1)st eigenvalues form a complex conjugate pair, then
u(j) = vl(:,j) + i*vl(:,j+1)
andu(j+1) = vl(:,j)  i*vl(:,j+1)
, wherei = sqrt(1)
.For complex flavors:
u(j) = vl(:,j)
, the jth column of vl.vr(ldvr,*); the second dimension of vr must be at least max(1, n).
If
jobvr = 'V'
, the right generalized eigenvectors v(j) are stored one after another in the columns of vr, in the same order as their eigenvalues. Each eigenvector will be scaled so the largest component have abs(Re) + abs(Im) = 1.If
jobvr = 'N'
, vr is not referenced.For real flavors:
If the jth eigenvalue is real, then
v(j) = vr(:,j)
, the jth column of vr.If the jth and (j+1)st eigenvalues form a complex conjugate pair, then
v(j) = vr(:,j) + i*vr(:,j+1)
andv(j+1) = vr(:,j)  i*vr(:,j+1)
.For complex flavors:
v(j) = vr(:,j)
, the jth column of vr.  ilo, ihi

INTEGER. ilo and ihi are integer values such that on exit
A(i,j) = 0
andB(i,j) = 0
ifi > j
andj = 1,..., ilo1
ori = ihi+1,..., n
.If
balanc = 'N'
or 'S',ilo = 1
andihi = n
.  lscale, rscale

REAL for singleprecision flavors
DOUBLE PRECISION for doubleprecision flavors.
Arrays, DIMENSION at least max(1, n) each.
lscale contains details of the permutations and scaling factors applied to the left side of A and B.
If
PL(j)
is the index of the row interchanged with row j, andDL(j)
is the scaling factor applied to row j, thenlscale(j) = PL(j)
, forj = 1,..., ilo1
= DL(j)
, forj = ilo,...,ihi
= PL(j)
forj = ihi+1,..., n
.The order in which the interchanges are made is n to ihi+1, then 1 to ilo1.
rscale contains details of the permutations and scaling factors applied to the right side of A and B.
If
PR(j)
is the index of the column interchanged with column j, andDR(j)
is the scaling factor applied to column j, thenrscale(j) = PR(j)
, forj = 1,..., ilo1
= DR(j)
, forj = ilo,...,ihi
= PR(j)
forj = ihi+1,..., n
.The order in which the interchanges are made is n to ihi+1, then 1 to ilo1.
 abnrm, bbnrm

REAL for singleprecision flavors
DOUBLE PRECISION for doubleprecision flavors.
The onenorms of the balanced matrices A and B, respectively.
 rconde, rcondv

REAL for single precision flavors DOUBLE PRECISION for double precision flavors.
Arrays, DIMENSION at least max(1, n) each.
If
sense = 'E'
, or 'B', rconde contains the reciprocal condition numbers of the eigenvalues, stored in consecutive elements of the array. For a complex conjugate pair of eigenvalues two consecutive elements of rconde are set to the same value. Thus rconde(j), rcondv(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).If
sense = 'N'
, or 'V', rconde is not referenced.If
sense = 'V'
, or 'B', rcondv contains the estimated reciprocal condition numbers of the eigenvectors, stored in consecutive elements of the array. For a complex eigenvector two consecutive elements of rcondv are set to the same value.If the eigenvalues cannot be reordered to compute rcondv(j), rcondv(j) is set to 0; this can only occur when the true value would be very small anyway.
If
sense = 'N'
, or 'E', rcondv is not referenced.  work(1)

On exit, if
info = 0
, then work(1) returns the required minimal size of lwork.  info

INTEGER.
If
info = 0
, the execution is successful.If
info = i
, the ith parameter had an illegal value.If
info = i
, andi ≤ n
:the QZ iteration failed. No eigenvectors have been calculated, but alphar(j), alphai(j) (for real flavors), or alpha(j) (for complex flavors), and beta(j),
j=info+1,..., n
should be correct.i > n
: errors that usually indicate LAPACK problems:i = n+1
: other than QZ iteration failed in hgeqz;i = n+2
: error return from tgevc.
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 ggevx interface are the following:
 a

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

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

Holds the vector of length n. Used in real flavors only.
 alphai

Holds the vector of length n. Used in real flavors only.
 alpha

Holds the vector of length n. Used in complex flavors only.
 beta

Holds the vector of length n.
 vl

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

Holds the matrix VR of size (n, n).
 lscale

Holds the vector of length n.
 rscale

Holds the vector of length n.
 rconde

Holds the vector of length n.
 rcondv

Holds the vector of length n.
 balanc

Must be 'N', 'B', or 'P'. The default value is 'N'.
 jobvl

Restored based on the presence of the argument vl as follows:
jobvl = 'V'
, if vl is present,jobvl = 'N'
, if vl is omitted.  jobvr

Restored based on the presence of the argument vr as follows:
jobvr = 'V'
, if vr is present,jobvr = 'N'
, if vr is omitted.  sense

Restored based on the presence of arguments rconde and rcondv as follows:
sense = 'B'
, if both rconde and rcondv are present,sense = 'E'
, if rconde is present and rcondv omitted,sense = 'V'
, if rconde is omitted and rcondv present,sense = 'N'
, if both rconde and rcondv are omitted.
Application Notes
If you are in doubt how much workspace to supply, use a generous value of lwork for the first run or set lwork = 1
.
If you choose the first option and set any of admissible lwork sizes, which is no less than the minimal value described, 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 you set lwork = 1
, 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 you set lwork to less than the minimal required value and not 1, the routine returns immediately with an error exit and does not provide any information on the recommended workspace.
The quotients alphar(j)/beta(j) and alphai(j)/beta(j) may easily over or underflow, and beta(j) may even be zero. Thus, you should avoid simply computing the ratio. However, alphar and alphai (for real flavors) or alpha (for complex flavors) will be always less than and usually comparable with norm(A) in magnitude, and beta always less than and usually comparable with norm(B).