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

◆ dggesx_r()

void dggesx_r ( char  jobvsl,
char  jobvsr,
char  sort,
char  sense,
int  n,
int  lda,
double  a[],
int  ldb,
double  b[],
int *  sdim,
double  alphar[],
double  alphai[],
double  beta[],
int  ldvsl,
double  vsl[],
int  ldvsr,
double  vsr[],
double  rconde[],
double  rcondv[],
double  work[],
int  lwork,
int  iwork[],
int  liwork,
int  bwork[],
int *  info,
int *  irev 
)

(Expert driver) Generalized Schur factorization of general matrices (Reverse communication version)

Purpose
This routine computes for a pair of n x n real nonsymmetric matrices (A, B), the generalized eigenvalues, the generalized real Schur form (S, T), and optionally the left and/or right matrices of Schur vectors (VSL and VSR). This gives the generalized Schur factorization
(A, B) = ((VSL)*S*(VSR)^T, (VSL)*T*(VSR)^T)

Optionally, it also orders the eigenvalues so that a selected cluster of eigenvalues appears in the leading diagonal blocks of the upper quasi-triangular matrix S and the upper triangular matrix T; computes a reciprocal condition number for the average of the selected eigenvalues (rconde); and computes a reciprocal condition number for the right and left deflating subspaces corresponding to the selected eigenvalues (rcondv). The leading columns of VSL and VSR then form an orthonormal basis for the corresponding left and right eigenspaces (deflating subspaces).

A generalized eigenvalue for a pair of matrices (A, B) is a scalar w or a ratio alpha/beta = w, such that A - w*B is singular. It is usually represented as the pair (alpha, beta), as there is a reasonable interpretation for beta=0 or both being zero.

A pair of matrices (S, T) is in generalized real Schur form if T is upper triangular with non-negative diagonal and S is block upper triangular with 1 x 1 and 2 x 2 blocks. 1 x 1 blocks correspond to real generalized eigenvalues, while 2 x 2 blocks of S will be "standardized" by making the corresponding elements of T have the form
[ a 0 ]
[ 0 b ]
and the pair of corresponding 2 x 2 blocks in S and T will have a complex conjugate pair of generalized eigenvalues.

This routine is the reverse communication version of dggesx.
Parameters
[in]jobvsl= 'N': Do not compute the left Schur vectors.
= 'V': Compute the left Schur vectors.
[in]jobvsr= 'N': Do not compute the right Schur vectors.
= 'V': Compute the right Schur vectors.
[in]sortSpecifies whether or not to order the eigenvalues on the diagonal of the generalized Schur form.
= 'N': Eigenvalues are not ordered.
= 'S': Eigenvalues are ordered.
[in]senseDetermines which reciprocal condition numbers are computed.
= 'N': None are computed.
= 'E': Computed for average of selected eigenvalues only.
= 'V': Computed for selected deflating subspaces only.
= 'B': Computed for both.
If sense = 'E', 'V', or 'B', sort must equal 'S'.
[in]nOrder of the matrices A, B, VSL and VSR. (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] The first of the pair of matrices.
[out] a[][] has been overwritten by its generalized Schur form S.
[in]ldbLeading dimension of the two dimensional array b[][]. (ldb >= max(1, n))
[in,out]b[][]Array b[lb][ldb] (lb >= n)
[in] The second of the pair of matrices.
[out] b[][] has been overwritten by its generalized Schur form T.
[out]sdimsort = 'N': sdim = 0.
sort = 'S': sdim = number of eigenvalues (after sorting) for which bwork[i] is true. (Complex conjugate pairs for which bwork[i] is true for either eigenvalue count as 2.)
[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. alphar[j] + alphai[j]*i and beta[j], j=0, ..., n-1 are the diagonals of the complex Schur form (S, T) that would result if the 2 x 2 diagonal blocks of the real Schur form of (A, B) were further reduced to triangular form using 2 x 2 complex unitary transformations. 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]ldvslLeading dimension of the two dimensional array vsl[][]. (ldvsl >= 1 if jobvsl = 'N', ldvsl >= n if jobvsl = 'V')
[out]vsl[][]Array vsl[lvsl][ldvsl] (lvsl >= n)
jobvsl = 'V': vsl[][] will contain the left Schur vectors.
jobvsl = 'N': Not referenced.
[in]ldvsrLeading dimension of the two dimensional array vsr[][]. (ldvsr >= 1 if jobvsr = 'N', ldvsr >= n if jobvsr = 'V')
[out]vsr[][]Array vsr[lvsr][ldvsr] (lvsr >= n)
jobvsr = 'V': vsl[][] will contain the right Schur vectors.
jobvsr = 'N': Not referenced.
[out]rconde[]Array rconde[lrconde] (lrconde >= 2)
sense = 'E' or 'B': rconde[0] and rconde[1] contain the reciprocal condition numbers for the average of the selected eigenvalues.
sense = 'N' or 'V': Not referenced.
[out]rcondv[]Array rcondv[lrcondv] (lrcondv >= 2)
sense = 'V' or 'B': rcondv[0] and rcondv[1] contain the reciprocal condition numbers for the selected deflating subspaces.
sense = 'N' or 'E': 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 >= 1 if n = 0, lwork >= max(8*n, 6*n + 16, 2*sdim*(n - sdim)) if sense = 'E', 'V' or 'B', lwork >= max(8*n, 6*n + 16) otherwise. Note that 2*sdim*(n - sdim) <= n*n/2. Note also that an error is only returned if lwork < max(8*n, 6*n + 16), but if sense = 'E', 'V' or 'B' this may not be large enough)
If lwork = -1, then a workspace query is assumed. The routine only calculates the bound on the optimal size of the work[] array and the minimum size of the iwork[] array, and returns these values in work[0] and iwork[0].
[out]iwork[]Array iwork[liwork]
Integer work array.
On exit, if info = 0, iwork[0] returns the minimum liwork.
[in]liworkThe dimension of the array iwork[]. (liwork >= 1 (if sense = 'N' or n = 0), liwork >= n + 6 (otherwise))
If liwork = -1, then a workspace query is assumed. The routine only calculates the bound on the optimal size of the work[] array and the minimum size of the iwork[] array, and returns these values as the first entries of the work[] and iwork[] arrays.
[out]bwork[]Array bwork[lbwork] (lbwork >= n)
Logical work array.
Not referenced if sort = 'N'.
[out]info= 0: Successful exit
= -1: The argument jobvsl had an illegal value (jobvsl != 'V' nor 'N')
= -2: The argument jobvsr had an illegal value (jobvsr != 'V' nor 'N')
= -3: The argument sort had an illegal value (sort != 'S' 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))
= -14: The argument ldvsl had an illegal value (ldvsl too small)
= -16: The argument ldvsr had an illegal value (ldvsr too small)
= -21: The argument lwork had an illegal value (lwork too small)
= -23: The argument liwork had an illegal value (liwork too small)
= i (0 < i <= n): The QZ iteration failed. (A, B) are not in Schur form, 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: After reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the generalized Schur form no longer satisfy selctg = true. This could also be caused due to scaling.
= n+3: Reordering failed in dtgsen.
[in,out]irevControl variable for reverse communication.
[in] Before first call, irev should be initialized to zero. On succeeding calls, irev should not be altered.
[out] If irev is not zero, complete the following process and call this routine again.
= 0: Normal exit. See return code in info.
= 1, 2: In the case of sort='S', to select eigenvalues to sort to the top left of the Schur form, the user should set bwork[i] (i = 0 to n-1). Decision should be made based on the values in alphar[i], alphai[i] and beta[i] (alphar[i]/beta[i] and alphai[i]/beta[i] are real and imaginary part of the eigenvalue). Set bwork[i] = 1 to select, or bwork[i] = 0 not to select. Do not alter any variables other than bwork[].
Always irev = 0 if sort = 'N'.
Reference
LAPACK