XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ dggevx()

void dggevx ( char  balanc,
char  jobvl,
char  jobvr,
char  sense,
int  n,
int  lda,
double  a[],
int  ldb,
double  b[],
double  alphar[],
double  alphai[],
double  beta[],
int  ldvl,
double  vl[],
int  ldvr,
double  vr[],
int *  ilo,
int *  ihi,
double  lscale[],
double  rscale[],
double *  abnrm,
double *  bbnrm,
double  rconde[],
double  rcondv[],
double  work[],
int  lwork,
int  iwork[],
int  bwork[],
int *  info 
)

(Expert driver) Generalized eigenvalue problem of general matrices

Purpose
This routine computes for a pair of n x n real nonsymmetric matrices (A, B) the generalized eigenvalues, and optionally, the left and/or right generalized eigenvectors.

Optionally, it also 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 lambda or a ratio alpha/beta = lambda, such that A - lambda*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 lambda(j) of (A, B) satisfies
A * v(j) = lambda(j) * B * v(j)
The left generalized eigenvector u(j) corresponding to the generalized eigenvalue lambda(j) of (A, B) satisfies
u(j)^H * A = lambda(j) * u(j)^H * B
where u(j)^H is the conjugate-transpose of u(j).
Parameters
[in]balancSpecifies the balance option to be performed.
= 'N': Do not diagonally scale or permute.
= 'P': Permute only.
= 'S': Scale only.
= 'B': Both permute and scale.
Computed reciprocal condition numbers will be for the matrices after permuting and/or balancing. Permuting does not change condition numbers (in exact arithmetic), but balancing does.
[in]jobvl= 'N': Do not compute the left generalized eigenvectors.
= 'V': Compute the left generalized eigenvectors.
[in]jobvr= 'N': Do not compute the right generalized eigenvectors.
= 'V': Compute the right generalized eigenvectors.
[in]senseDetermines which reciprocal condition numbers are computed.
= 'N': None are computed.
= 'E': Computed for eigenvalues only.
= 'V': Computed for right eigenvectors only.
= 'B': Computed for eigenvalues and right eigenvectors.
[in]nOrder of the matrices A, B, VL and VR. (n >= 0) (If n = 0, returns without computation)
[in]ldaLeading dimension of the two dimensional array a[][]. (lda >= max(1, n))
[in,out]a[][]Array a[la][lda] (la >= n)
[in] Matrix A in the pair (A, B).
[out] a[][] has been overwritten. If jobvl = 'V' or jobvr = 'V' or both, then a[][] contains the first part of the real Schur form of the "balanced" versions of the input A and B.
[in]ldbLeading dimension of the two dimensional array b[][]. (ldb >= max(1, n))
[in,out]b[][]Array b[lb][ldb] (lb >= n)
[in] Matrix B in the pair (A, B).
[out] b[][] has been overwritten. If jobvl = 'V' or jobvr = 'V' or both, then b[][] contains the second part of the real Schur form of the "balanced" versions of the input A and B.
[out]alphar[]Array alphar[lalphar] (lalphar >= n)
[out]alphai[]Array alphai[lalphai] (lalphai >= n)
[out]beta[]Array beta[lbeta] (lbeta >= n)
(alphar[j] + alphai[j]*i)/beta[j], j = 0, ..., n-1, will be the generalized eigenvalues. If alphai[j] is zero, then the j-th eigenvalue is real. If positive, then the j-th and (j+1)-st eigenvalues are a complex conjugate pair, with alphai[j+1] negative.

Note: The quotients alphar[j]/beta[j] and alphai[j]/beta[j] may easily over- or underflow, and beta[j] may even be zero. Thus, the user should avoid naively computing the ratio alpha/beta. However, alphar and alphai will be always less than and usually comparable with norm(A) in magnitude, and beta always less than and usually comparable with norm(B).
[in]ldvlLeading dimension of the two dimensional array vl[][]. (ldvl >= 1 if jobvl = 'N', ldvl >= n if jobvl = 'V')
[out]vl[][]Array vl[lvl][ldvl] (lvl >= n)
jobvl = 'V': The left eigenvectors u(j) are stored one after another in the columns of vl[][], in the same order as their eigenvalues.   If the j-th eigenvalue is real, then u(j) = vl[j][*], the j-th column of vl[][].
  If j-th and (j+1)-th eigenvalues form a complex conjugate pair, then u(j) = vl[j][*] + vl[j+1][*]*i and u(j+1) = vl[j][*] - vl[j+1][*]*i.
  Each eigenvector is scaled so the largest component has |real part| + |imaginary part| = 1.
jobvl = 'N': Not referenced.
[in]ldvrLeading dimension of the two dimensional array vr[][]. (ldvr >= 1 if jobvr = 'N', ldvr >= n if jobvr = 'V')
[out]vr[][]Array vr[lvr][ldvr] (lvr >= n)
jobvr = 'V': The right eigenvectors v(j) are stored one after another in the columns of vr[][] in the same order as their eigenvalues.
  If the j-th eigenvalue is real, then v(j) = vr[j][*], the j-th column of vr[][].
  If j-th and (j+1)-th eigenvalues form a complex conjugate pair, then v(j) = vr[j][*] + vr[j+1][*]*i and v(j+1) = vr[j][*] - vr[j+1][*]*i.
  Each eigenvector is scaled so the largest component has |real part| + |imag. part| = 1.
jobvr = 'N': Not referenced.
[out]ilo
[out]ihiilo and ihi are integer values such that on exit a[j][i] = 0 and b[j][i] = 0 if i > j and j = 0, ..., ilo-2 or i = ihi, ..., n-1.
If balanc = 'N' or 'S', ilo = 1 and ihi = n.
[out]lscale[]Array lscale[llscale] (llscale >= n)
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, and dl(j) is the scaling factor applied to row j, then
  lscale[j] = pl(j) for j = 0, ..., ilo-2
    = dl(j) for j = ilo-1, ..., ihi-1
    = pl(j) for j = ihi, ..., n-1
The order in which the interchanges are made is n-1 to ihi, then 0 to ilo-2.
[out]rscale[]Array rscale[lrscale] (lrscale >= n)
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, and dr(j) is the scaling factor applied to column j, then
  rscale[j] = pr(j) for j = 0, ..., ilo-2
    = dr(j) for j = ilo-1, ..., ihi-1
    = pr(j) for j = ihi, ..., n-1
The order in which the interchanges are made is n-1 to ihi, then 0 to ilo-2.
[out]abnrmOne-norm of the balanced matrix A.
[out]bbnrmOne-norm of the balanced matrix B.
[out]rconde[]Array rconde[lrconde] (lrconde >= n)
sense = 'E' or 'B': 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 j-th columns of vl[][] and vr[][] all correspond to the j-th eigenpair.
sense = 'N' or 'V': rconde[] is not referenced.
[out]rcondv[]Array rcondv[lrcondv] (lrcondv >= n)
sense = 'V' or 'B': 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.
sense = 'N' or 'E': rcondv is not referenced.
[out]work[]Array work[lwork]
Work array
On exit, if info = 0, work[0] returns the optimal lwork.
[in]lworkThe dimension of the array work[]. (lwork >= max(1, 6*n) (if balanc = 'S' or 'B', or jobvl = 'V', or jobvr = 'V'), lwork >= max(1, 10*n) (if sense = 'E'), lwork >= max(1, 2*n*n+8*n+16) (if sense = 'V' or 'B'), lwork >= max(1, 2*n) (otherwise))
If lwork = -1, then a workspace query is assumed. The routine only calculates the optimal size of the work[] array, and returns the value in work[0].
[out]iwork[]Array iwork[liwork] (liwork >= n + 6)
Integer work array.
If sense = 'E', not referenced.
[out]bwork[]Array bwork[lbwork] (lbwork >= n)
Logical work array.
If sense = 'N', not referenced.
[out]info= 0: Successful exit
= -1: The argument balanc had an illegal value (balanc != 'P', 'S', 'B' nor 'N')
= -2: The argument jobvl had an illegal value (jobvl != 'V' nor 'N')
= -3: The argument jobvr had an illegal value (jobvr != 'V' nor 'N')
= -4: The argument sense had an illegal value (sense != 'E', 'V', 'B' nor 'N')
= -5: The argument n had an illegal value (n < 0)
= -6: The argument lda had an illegal value (lda < max(1, n))
= -8: The argument ldb had an illegal value (ldb < max(1, n))
= -13: The argument ldvl had an illegal value (ldvl too small)
= -15: The argument ldvr had an illegal value (ldvr too small)
= -26: The argument lwork had an illegal value (lwork too small)
= i (0 < i <= n): The QZ iteration failed. No eigenvectors have been calculated, but alphar[j], alphai[j], and beta[j] should be correct for j=i, ..., n-1.
= n+1: Other than QZ iteration failed in dhgeqz
= n+2: Error return from dtgevc
Reference
LAPACK