complexGEeigen(3)

πŸ“¦
version 3.11.0 Β· 2 versions
, in debian bookworm

✨ NAME ✨

okay so this is complexGEeigen(3) β€” a LAPACK manual page, bestie πŸ’– and the official name line is complexGEeigen - complex. that's it, that's the whole name. one word. complex. iconic behavior honestly πŸ’…

it's the landing page for a whole group of complex eigenvalue driver routines for GE matrices β€” ten of them, all starting with c, all ready to ruin your afternoon / change your life πŸ¦‹


🌈 SYNOPSIS 🌈

πŸŽ€ Functions πŸŽ€

  • cgees β€” CGEES computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE matrices
subroutine cgees (JOBVS, SORT, SELECT, N, A, LDA, SDIM, W, VS, LDVS,
    WORK, LWORK, RWORK, BWORK, INFO)
  • cgeesx β€” CGEESX computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE matrices
subroutine cgeesx (JOBVS, SORT, SELECT, SENSE, N, A, LDA, SDIM, W, VS,
    LDVS, RCONDE, RCONDV, WORK, LWORK, RWORK, BWORK, INFO)
  • cgeev β€” CGEEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices
subroutine cgeev (JOBVL, JOBVR, N, A, LDA, W, VL, LDVL, VR, LDVR, WORK,
    LWORK, RWORK, INFO)
  • cgeevx β€” CGEEVX computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices
subroutine cgeevx (BALANC, JOBVL, JOBVR, SENSE, N, A, LDA, W, VL, LDVL,
    VR, LDVR, ILO, IHI, SCALE, ABNRM, RCONDE, RCONDV, WORK, LWORK,
    RWORK, INFO)
  • cgges β€” CGGES computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE matrices
subroutine cgges (JOBVSL, JOBVSR, SORT, SELCTG, N, A, LDA, B, LDB, SDIM,
    ALPHA, BETA, VSL, LDVSL, VSR, LDVSR, WORK, LWORK, RWORK, BWORK,
    INFO)
  • cgges3 β€” CGGES3 computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE matrices (blocked algorithm)
subroutine cgges3 (JOBVSL, JOBVSR, SORT, SELCTG, N, A, LDA, B, LDB,
    SDIM, ALPHA, BETA, VSL, LDVSL, VSR, LDVSR, WORK, LWORK, RWORK,
    BWORK, INFO)
  • cggesx β€” CGGESX computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE matrices
subroutine cggesx (JOBVSL, JOBVSR, SORT, SELCTG, SENSE, N, A, LDA, B,
    LDB, SDIM, ALPHA, BETA, VSL, LDVSL, VSR, LDVSR, RCONDE, RCONDV,
    WORK, LWORK, RWORK, IWORK, LIWORK, BWORK, INFO)
  • cggev β€” CGGEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices
subroutine cggev (JOBVL, JOBVR, N, A, LDA, B, LDB, ALPHA, BETA, VL,
    LDVL, VR, LDVR, WORK, LWORK, RWORK, INFO)
  • cggev3 β€” CGGEV3 computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices (blocked algorithm)
subroutine cggev3 (JOBVL, JOBVR, N, A, LDA, B, LDB, ALPHA, BETA, VL,
    LDVL, VR, LDVR, WORK, LWORK, RWORK, INFO)
  • cggevx β€” CGGEVX computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices
subroutine 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)

πŸ’– Detailed Description πŸ’–

This is the group of complex eigenvalue driver functions for GE matrices. periodt. 🫢

like, that's the whole vibe β€” every routine on this page is a driver, they all deal with complex matrices, and they're all about eigenvalues. the rest is just ✨ details ✨ (and there are so many details, bestie).


πŸ‘‘ Function Documentation πŸ‘‘

🌸 subroutine cgees 🌸

subroutine cgees (character JOBVS, character SORT, external SELECT, integer
    N, complex, dimension( lda, * ) A, integer LDA, integer SDIM, complex,
    dimension( * ) W, complex, dimension( ldvs, * ) VS, integer LDVS,
    complex, dimension( * ) WORK, integer LWORK, real, dimension( * ) RWORK,
    logical, dimension( * ) BWORK, integer INFO)

CGEES computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE matrices.

πŸ“ Purpose πŸ“

CGEES computes, for an N-by-N complex nonsymmetric matrix A, the eigenvalues, the Schur form T, and β€” if you ask nicely β€” the matrix of Schur vectors Z. that gives you the Schur factorization A = Z*T*(Z**H) ✨

optionally, it also orders the eigenvalues on the diagonal of the Schur form so that the selected eigenvalues end up at the top left πŸ‘‘ the leading columns of Z then form an orthonormal basis for the invariant subspace corresponding to those selected eigenvalues.

and for the record: a complex matrix is in Schur form if it is upper triangular. that's the whole rule. no cap. πŸ’…

🧚 Parameters 🧚

  • JOBVS β€” JOBVS is CHARACTER*1
    • = 'N': Schur vectors are not computed;
    • = 'V': Schur vectors are computed.
  • SORT β€” SORT is CHARACTER*1. says whether or not we're ordering the eigenvalues on the diagonal of the Schur form.
    • = 'N': Eigenvalues are not ordered;
    • = 'S': Eigenvalues are ordered (see SELECT).
  • SELECT β€” SELECT is a LOGICAL FUNCTION of one COMPLEX argument. SELECT must be declared EXTERNAL in the calling subroutine.
    • If SORT = 'S', SELECT is used to select eigenvalues to order to the top left of the Schur form.
    • IF SORT = 'N', SELECT is not referenced.
    • The eigenvalue W(j) is selected if SELECT(W(j)) is true.
  • N β€” N is INTEGER. the order of the matrix A. N >= 0.
  • A β€” A is COMPLEX array, dimension (LDA,N). on entry, the N-by-N matrix A. on exit, A has been overwritten by its Schur form T 😭 (she's gone, bestie, but she left you T).
  • LDA β€” LDA is INTEGER. the leading dimension of the array A. LDA >= max(1,N).
  • SDIM β€” SDIM is INTEGER
    • If SORT = 'N', SDIM = 0.
    • If SORT = 'S', SDIM = number of eigenvalues for which SELECT is true.
  • W β€” W is COMPLEX array, dimension (N). W contains the computed eigenvalues, in the same order that they appear on the diagonal of the output Schur form T.
  • VS β€” VS is COMPLEX array, dimension (LDVS,N)
    • If JOBVS = 'V', VS contains the unitary matrix Z of Schur vectors.
    • If JOBVS = 'N', VS is not referenced.
  • LDVS β€” LDVS is INTEGER. the leading dimension of the array VS. LDVS >= 1; if JOBVS = 'V', LDVS >= N.
  • WORK β€” WORK is COMPLEX array, dimension (MAX(1,LWORK)). on exit, if INFO = 0, WORK(1) returns the optimal LWORK.
  • LWORK β€” LWORK is INTEGER. the dimension of the array WORK. LWORK >= max(1,2*N). for good performance, LWORK must generally be larger.
    • 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 β€” RWORK is REAL array, dimension (N)
  • BWORK β€” BWORK is LOGICAL array, dimension (N). not referenced if SORT = 'N'.
  • INFO β€” INFO is INTEGER
    • = 0: successful exit πŸŽ‰
    • < 0: if INFO = -i, the i-th argument had an illegal value.
    • > 0: if INFO = i, and i is
      • <= N: the QR algorithm failed to compute all the eigenvalues; elements 1:ILO-1 and i+1:N of W contain those eigenvalues which have converged; if JOBVS = 'V', VS contains the matrix which reduces A to its partially converged Schur form.
      • = N+1: the eigenvalues could not be reordered because some eigenvalues were too close to separate (the problem is very ill-conditioned);
      • = N+2: after reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the Schur form no longer satisfy SELECT = .TRUE.. This could also be caused by underflow due to scaling.

πŸ‘‘ Author πŸ‘‘

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.


🌸 subroutine cgeesx 🌸

subroutine cgeesx (character JOBVS, character SORT, external SELECT,
    character SENSE, integer N, complex, dimension( lda, * ) A, integer LDA,
    integer SDIM, complex, dimension( * ) W, complex, dimension( ldvs, * )
    VS, integer LDVS, real RCONDE, real RCONDV, complex, dimension( * )
    WORK, integer LWORK, real, dimension( * ) RWORK, logical, dimension( * )
    BWORK, integer INFO)

CGEESX computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE matrices.

πŸ“ Purpose πŸ“

CGEESX computes, for an N-by-N complex nonsymmetric matrix A, the eigenvalues, the Schur form T, and β€” optionally β€” the matrix of Schur vectors Z. boom: Schur factorization A = Z*T*(Z**H) ✨

optionally it also orders the eigenvalues on the diagonal of the Schur form so the selected ones are at the top left; computes a reciprocal condition number for the average of the selected eigenvalues (RCONDE); and computes a reciprocal condition number for the right invariant subspace corresponding to the selected eigenvalues (RCONDV). the leading columns of Z form an orthonormal basis for this invariant subspace. she does a lot πŸ’…

for further explanation of the reciprocal condition numbers RCONDE and RCONDV, see Section 4.10 of the LAPACK Users' Guide (where these quantities are called s and sep respectively) πŸ“š

reminder, bestie: a complex matrix is in Schur form if it is upper triangular.

🧚 Parameters 🧚

  • JOBVS β€” JOBVS is CHARACTER*1
    • = 'N': Schur vectors are not computed;
    • = 'V': Schur vectors are computed.
  • SORT β€” SORT is CHARACTER*1. Specifies whether or not to order the eigenvalues on the diagonal of the Schur form.
    • = 'N': Eigenvalues are not ordered;
    • = 'S': Eigenvalues are ordered (see SELECT).
  • SELECT β€” SELECT is a LOGICAL FUNCTION of one COMPLEX argument. SELECT must be declared EXTERNAL in the calling subroutine.
    • If SORT = 'S', SELECT is used to select eigenvalues to order to the top left of the Schur form.
    • If SORT = 'N', SELECT is not referenced.
    • An eigenvalue W(j) is selected if SELECT(W(j)) is true.
  • SENSE β€” SENSE is CHARACTER*1. Determines which reciprocal condition numbers are computed.
    • = 'N': None are computed;
    • = 'E': Computed for average of selected eigenvalues only;
    • = 'V': Computed for selected right invariant subspace only;
    • = 'B': Computed for both.
    • If SENSE = 'E', 'V' or 'B', SORT must equal 'S'.
  • N β€” N is INTEGER. The order of the matrix A. N >= 0.
  • A
  • A β€” COMPLEX array, dimension (LDA, N). On entry, the N-by-N matrix A. On exit, A is overwritten by its Schur form T. (yeah bestie, it eats your input, that's just the deal πŸ’€)
  • LDA β€” INTEGER. The leading dimension of the array A. Rule of the house: LDA >= max(1,N).
  • SDIM β€” INTEGER.
    • If SORT = 'N', then SDIM = 0.
    • If SORT = 'S', then SDIM = number of eigenvalues for which SELECT is true.
  • W β€” COMPLEX array, dimension (N). W holds the computed eigenvalues, in the same order that they appear on the diagonal of the output Schur form T. πŸ‘‘
  • VS β€” COMPLEX array, dimension (LDVS,N). If JOBVS = 'V', VS contains the unitary matrix Z of Schur vectors. If JOBVS = 'N', VS is not referenced. (not even a little bit, she's off the clock πŸ™ˆ)
  • LDVS β€” INTEGER. The leading dimension of the array VS. LDVS >= 1, and if JOBVS = 'V', LDVS >= N.
  • RCONDE β€” REAL. If SENSE = 'E' or 'B', RCONDE contains the reciprocal condition number for the average of the selected eigenvalues. Not referenced if SENSE = 'N' or 'V'.
  • RCONDV β€” REAL. If SENSE = 'V' or 'B', RCONDV contains the reciprocal condition number for the selected right invariant subspace. Not referenced if SENSE = 'N' or 'E'.
  • WORK β€” COMPLEX array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) returns the optimal LWORK. ✨
  • LWORK β€” INTEGER. The dimension of the array WORK. LWORK >= max(1,2*N). Also, if SENSE = 'E' or 'V' or 'B', LWORK >= 2*SDIM*(N-SDIM), where SDIM is the number of selected eigenvalues computed by this routine. Note that 2*SDIM*(N-SDIM) <= N*N/2. Note also that an error is only returned if LWORK < max(1,2*N), but if SENSE = 'E' or 'V' or 'B' this may not be large enough. For good performance, LWORK must generally be larger. If LWORK = -1, then a workspace query is assumed; the routine only calculates upper bound on the optimal size of the array WORK, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA.
  • RWORK β€” REAL array, dimension (N).
  • BWORK β€” LOGICAL array, dimension (N). Not referenced if SORT = 'N'.
  • INFO β€” INTEGER, the final vibe check:
    • = 0: successful exit 🌈
    • < 0: if INFO = -i, the i-th argument had an illegal value.
    • > 0: if INFO = i, and i is
      • <= N: the QR algorithm failed to compute all the eigenvalues; elements 1:ILO-1 and i+1:N of W contain those eigenvalues which have converged; if JOBVS = 'V', VS contains the transformation which reduces A to its partially converged Schur form.
      • = N+1: the eigenvalues could not be reordered because some eigenvalues were too close to separate (the problem is very ill-conditioned);
      • = N+2: after reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the Schur form no longer satisfy SELECT=.TRUE. This could also be caused by underflow due to scaling.

🌸 Author 🌸

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

πŸ’… subroutine cgeev πŸ’…

subroutine cgeev (character JOBVL, character JOBVR, integer N, complex, dimension( lda, * ) A, integer LDA, complex, dimension( * ) W, complex, dimension( ldvl, * ) VL, integer LDVL, complex, dimension( ldvr, * ) VR, integer LDVR, complex, dimension( * ) WORK, integer LWORK, real, dimension( * ) RWORK, integer INFO)

CGEEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices

✨ Purpose ✨

CGEEV computes, for an N-by-N complex nonsymmetric matrix A, the eigenvalues and β€” if you ask nicely β€” the left and/or right eigenvectors.

The right eigenvector v(j) of A satisfies

A * v(j) = lambda(j) * v(j)

where lambda(j) is its eigenvalue.

The left eigenvector u(j) of A satisfies

u(j)**H * A = lambda(j) * u(j)**H

where u(j)**H denotes the conjugate transpose of u(j).

The computed eigenvectors are normalized to have Euclidean norm equal to 1 and largest component real. πŸŽ€

πŸ¦‹ Parameters πŸ¦‹

  • JOBVL β€” CHARACTER*1.
    • = 'N': left eigenvectors of A are not computed;
    • = 'V': left eigenvectors of are computed.
  • JOBVR β€” CHARACTER*1.
    • = 'N': right eigenvectors of A are not computed;
    • = 'V': right eigenvectors of A are computed.
  • N β€” INTEGER. The order of the matrix A. N >= 0.
  • A β€” COMPLEX array, dimension (LDA,N). On entry, the N-by-N matrix A. On exit, A has been overwritten. (again. she's gone. poof πŸ’€)
  • LDA β€” INTEGER. The leading dimension of the array A. LDA >= max(1,N).
  • W β€” COMPLEX array, dimension (N). W contains the computed eigenvalues.
  • VL β€” COMPLEX array, dimension (LDVL,N). If 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 JOBVL = 'N', VL is not referenced. And the math? u(j) = VL(:,j), the j-th column of VL.
  • LDVL β€” INTEGER. The leading dimension of the array VL. LDVL >= 1; if JOBVL = 'V', LDVL >= N.
  • VR β€” COMPLEX array, dimension (LDVR,N). If 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 JOBVR = 'N', VR is not referenced. And: v(j) = VR(:,j), the j-th column of VR.
  • LDVR β€” INTEGER. The leading dimension of the array VR. LDVR >= 1; if JOBVR = 'V', LDVR >= N.
  • WORK β€” COMPLEX array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) returns the optimal LWORK. ✨
  • LWORK β€” INTEGER. The dimension of the array WORK. LWORK >= max(1,2*N). For good performance, LWORK must generally be larger. 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 array, dimension (2*N).
  • INFO β€” INTEGER.
    • = 0: successful exit 🌈
    • < 0: if INFO = -i, the i-th argument had an illegal value.
    • > 0: if INFO = i, the QR algorithm failed to compute all the eigenvalues, and no eigenvectors have been computed; elements i+1:N of W contain eigenvalues which have converged.

🌸 Author 🌸

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

πŸ‘‘ subroutine cgeevx πŸ‘‘

subroutine cgeevx (character BALANC, character JOBVL, character JOBVR, character SENSE, integer N, complex, dimension( lda, * ) A, integer LDA, complex, dimension( * ) W, complex, dimension( ldvl, * ) VL, integer LDVL, complex, dimension( ldvr, * ) VR, integer LDVR, integer ILO, integer IHI, real, dimension( * ) SCALE, real ABNRM, real, dimension( * ) RCONDE, real, dimension( * ) RCONDV, complex, dimension( * ) WORK, integer LWORK, real, dimension( * ) RWORK, integer INFO)

CGEEVX computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices

✨ Purpose ✨

CGEEVX computes, for an N-by-N complex nonsymmetric matrix A, the eigenvalues and β€” optionally β€” the left and/or right eigenvectors.

Optionally also, it computes a balancing transformation to improve the conditioning of the eigenvalues and eigenvectors (ILO, IHI, SCALE, and ABNRM), reciprocal condition numbers for the eigenvalues (RCONDE), and reciprocal condition numbers for the right eigenvectors (RCONDV). She does it all, no cap. πŸ’…

The right eigenvector v(j) of A satisfies

A * v(j) = lambda(j) * v(j)

where lambda(j) is its eigenvalue.

The left eigenvector u(j) of A satisfies

u(j)**H * A = lambda(j) * u(j)**H

where u(j)**H denotes the conjugate transpose of u(j).

The computed eigenvectors are normalized to have Euclidean norm equal to 1 and largest component real. πŸŽ€

Balancing a matrix means permuting the rows and columns to make it more nearly upper triangular, and applying a diagonal similarity transformation D * A * D**(-1), where D is a diagonal matrix, to make its rows and columns closer in norm and the condition numbers of its eigenvalues and eigenvectors smaller. The computed reciprocal condition numbers correspond to the balanced matrix. Permuting rows and columns will not change the condition numbers (in exact arithmetic) but diagonal scaling will. For further explanation of balancing, see section 4.10.2 of the LAPACK Users' Guide. πŸ“š

πŸ¦‹ Parameters πŸ¦‹

  • BALANC β€”
  • BALANC β€” okay so this is a CHARACTER*1 and it's basically the glow-up instruction for your matrix. It tells the routine how to diagonally scale and/or permute the input matrix so its eigenvalues are less of a hot mess (better conditioning, bestie πŸ’…). Here's the tea:
    • 'N': do not diagonally scale or permute. literally leave it alone, no touchy.
    • 'P': perform permutations to make the matrix more nearly upper triangular. do not diagonally scale.
    • 'S': diagonally scale the matrix, ie. replace A by D*A*D**(-1), where D is a diagonal matrix chosen to make the rows and columns of A more equal in norm. do not permute.
    • 'B': both diagonally scale and permute A. both? periodt.

Computed reciprocal condition numbers will be for the matrix after balancing and/or permuting. Permuting does not change condition numbers (in exact arithmetic), but balancing does. no cap.

  • JOBVL β€” CHARACTER*1. left eigenvector check.
    • 'N': left eigenvectors of A are not computed.
    • 'V': left eigenvectors of A are computed.
If SENSE = 'E' or 'B', JOBVL must = 'V'. the way that is mandatory, bestie. no skipping.
  • JOBVR β€” CHARACTER*1. right eigenvector check.
    • 'N': right eigenvectors of A are not computed.
    • 'V': right eigenvectors of A are computed.
If SENSE = 'E' or 'B', JOBVR must = 'V'. same energy.
  • SENSE β€” CHARACTER*1. Determines which reciprocal condition numbers get computed. condition number menu.
    • 'N': none are computed. nada.
    • 'E': computed for eigenvalues only.
    • 'V': computed for right eigenvectors only.
    • 'B': computed for eigenvalues and right eigenvectors. both, we love an overachiever.
If SENSE = 'E' or 'B', both left and right eigenvectors must also be computed (JOBVL = 'V' and JOBVR = 'V'). so don't forget.
  • N β€” INTEGER. The order of the matrix A. N >= 0. zero is valid, bestie. she can be empty.
  • A β€” COMPLEX array, dimension (LDA,N).
    • On entry, the N-by-N matrix A.
    • On exit, A has been overwritten. If JOBVL = 'V' or JOBVR = 'V', A contains the Schur form of the balanced version of the matrix A. she's changed, and honestly? iconic.
  • LDA β€” INTEGER. The leading dimension of the array A. LDA >= max(1,N). math check, no cap.
  • W β€” COMPLEX array, dimension (N). W contains the computed eigenvalues. ✨ the main characters ✨
  • VL β€” COMPLEX array, dimension (LDVL,N).
    • If 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 JOBVL = 'N', VL is not referenced.
    • u(j) = VL(:,j), the j-th column of VL. iykyk.
  • LDVL β€” INTEGER. The leading dimension of the array VL. LDVL >= 1; if JOBVL = 'V', LDVL >= N. don't skimp on the leading dimension.
  • VR β€” COMPLEX array, dimension (LDVR,N).
    • If 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 JOBVR = 'N', VR is not referenced.
    • v(j) = VR(:,j), the j-th column of VR. iykyk again.
  • LDVR β€” INTEGER. The leading dimension of the array VR. LDVR >= 1; if JOBVR = 'V', LDVR >= N. same rules apply.
  • ILO β€” INTEGER. (that's it, just an integer bestie. she's chill.)
  • IHI β€” INTEGER. ILO and IHI are integer values determined when A was balanced. The balanced A(i,j) = 0 if I > J and J = 1,...,ILO-1 or I = IHI+1,...,N. structural tea, periodt.
  • SCALE β€” REAL array, dimension (N). Details of the permutations and scaling factors applied when balancing A. If P(j) is the index of the row and column interchanged with row and column j, and D(j) is the scaling factor applied to row and column j, then
SCALE(J) = P(J),    for J = 1,...,ILO-1
         = D(J),    for J = ILO,...,IHI
         = P(J)     for J = IHI+1,...,N.

The order in which the interchanges are made is N to IHI+1, then 1 to ILO-1. order matters, bestie. don't come for me.

  • ABNRM β€” REAL. The one-norm of the balanced matrix (the maximum of the sum of absolute values of elements of any column). math moment, but make it fashion.
  • RCONDE β€” REAL array, dimension (N). RCONDE(j) is the reciprocal condition number of the j-th eigenvalue. condition number tea, but for eigenvalues.
  • RCONDV β€” REAL array, dimension (N). RCONDV(j) is the reciprocal condition number of the j-th right eigenvector. right eigenvector condition number, specifically.
  • WORK β€” COMPLEX array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) returns the optimal LWORK. workspace lore, she's telling you how much room she needs.
  • LWORK β€” INTEGER. The dimension of the array WORK. If SENSE = 'N' or 'E', LWORK >= max(1,2*N), and if SENSE = 'V' or 'B', LWORK >= N*N+2*N. For good performance, LWORK must generally be larger. bigger is better, apparently.
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. so if you pass -1, it's just asking "how much space?" and no error, periodt.
  • RWORK β€” REAL array, dimension (2*N). real work, real values. she's not complex.
  • INFO β€” INTEGER.
    • = 0: successful exit. slay, we love a successful exit.
    • < 0: if INFO = -i, the i-th argument had an illegal value. oops, illegal value. not iconic.
    • > 0: if INFO = i, the QR algorithm failed to compute all the eigenvalues, and no eigenvectors or condition numbers have been computed; elements 1:ILO-1 and i+1:N of W contain eigenvalues which have converged. big oof. QR algorithm said "not today".

πŸ‘‘ Author πŸ‘‘

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

the icons who wrote this. we stan.


πŸ’… subroutine cgges πŸ’…

subroutine cgges (character JOBVSL, character JOBVSR, character SORT,
    external SELCTG, integer N, complex, dimension( lda, * ) A, integer LDA,
    complex, dimension( ldb, * ) B, integer LDB, integer SDIM, complex,
    dimension( * ) ALPHA, complex, dimension( * ) BETA, complex, dimension(
    ldvsl, * ) VSL, integer LDVSL, complex, dimension( ldvsr, * ) VSR,
    integer LDVSR, complex, dimension( * ) WORK, integer LWORK, real,
    dimension( * ) RWORK, logical, dimension( * ) BWORK, integer INFO)

CGGES computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE matrices. it's giving generalized Schur energy, and we're obsessed.

🎯 Purpose 🎯

okay so CGGES computes for a pair of N-by-N complex nonsymmetric matrices (A,B), the generalized eigenvalues, the generalized complex Schur form (S, T), and optionally left and/or right Schur vectors (VSL and VSR). This gives the generalized Schur factorization

(A,B) = ( (VSL)*S*(VSR)**H, (VSL)*T*(VSR)**H )

where (VSR)**H is the conjugate-transpose of VSR. conjugate-transpose, periodt.

Optionally, it also orders the eigenvalues so that a selected cluster of eigenvalues appears in the leading diagonal blocks of the upper triangular matrix S and the upper triangular matrix T. The leading columns of VSL and VSR then form an unitary basis for the corresponding left and right eigenspaces (deflating subspaces). unitary basis, deflating subspaces, we love to see it.

(If only the generalized eigenvalues are needed, use the driver CGGEV instead, which is faster.) faster? okay noted, bestie.

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, and even for both being zero. beta=0 is valid, bestie. and both zero? also valid. periodt.

A pair of matrices (S,T) is in generalized complex Schur form if S and T are upper triangular and, in addition, the diagonal elements of T are non-negative real numbers. ✨

πŸŽ€ Parameters πŸŽ€

  • JOBVSL β€” CHARACTER*1.
    • 'N': do not compute the left Schur vectors.
    • 'V': compute the left Schur vectors.
  • JOBVSR β€” CHARACTER*1.
    • 'N': do not compute the right Schur vectors.
    • 'V': compute the right Schur vectors.
  • SORT β€” CHARACTER*1. Specifies whether or not to order the eigenvalues on the diagonal of the generalized Schur form.
    • 'N': eigenvalues are not ordered.
    • 'S': eigenvalues are ordered (see SELCTG).
  • SELCTG β€” SELCTG is a LOGICAL FUNCTION of two COMPLEX arguments. SELCTG must be declared EXTERNAL in the calling subroutine. If SORT = 'N', SELCTG is not referenced. If SORT = 'S', SELCTG is used to select eigenvalues to sort to the top left of the Schur form. An eigenvalue ALPHA(j)/BETA(j) is selected if SELCTG(ALPHA(j),BETA(j)) is true.
Note that a selected complex eigenvalue may no longer satisfy SELCTG(ALPHA(j),BETA(j)) = .TRUE. after ordering, since ordering may change the value of complex eigenvalues (especially if the eigenvalue is ill-conditioned), in this case INFO is set to N+2 (See INFO below). ill-conditioned tea, be careful bestie. ordering can change things.
  • N β€” INTEGER. The order of the matrices A, B, VSL, and VSR. N >= 0. zero is still valid.
  • A β€” COMPLEX array, dimension (LDA, N).
    • On entry, the first of the pair of matrices.
    • On exit, A has been overwritten by its generalized Schur form S. she's transformed.
  • LDA β€” INTEGER. The leading dimension of A. LDA >= max(1,N). math check again.
  • B β€” COMPLEX array, dimension (LDB, N).
    • On entry, the second of the pair of matrices.
    • On exit, B has been overwritten by its generalized Schur form T. also transformed.
  • LDB β€” INTEGER. The leading dimension of B. LDB >= max(1,N). same rule.
  • SDIM β€” INTEGER. If SORT = 'N', SDIM = 0. If SORT = 'S', SDIM = number of eigenvalues (after sorting) for which SELCTG is true. count 'em up.
  • ALPHA β€” COMPLEX array, dimension (N). alpha, the first half of the eigenvalue pair.
  • BETA
  • BETA β€” bestie, this is a COMPLEX array, dimension (N). On exit, ALPHA(j)/BETA(j), j=1,...,N, will be the generalized eigenvalues. ALPHA(j), j=1,...,N and BETA(j), j=1,...,N are the diagonals of the complex Schur form (A,B) output by CGGES. The BETA(j) will be non-negative real. πŸ’…
Note: the quotients ALPHA(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, ALPHA will be always less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B). 😭
  • VSL β€” COMPLEX array, dimension (LDVSL,N). If JOBVSL = 'V', VSL will contain the left Schur vectors. Not referenced if JOBVSL = 'N'. ✨
  • LDVSL β€” INTEGER. The leading dimension of the matrix VSL. LDVSL >= 1, and if JOBVSL = 'V', LDVSL >= N. πŸ’–
  • VSR β€” COMPLEX array, dimension (LDVSR,N). If JOBVSR = 'V', VSR will contain the right Schur vectors. Not referenced if JOBVSR = 'N'. πŸ¦‹
  • LDVSR β€” INTEGER. The leading dimension of the matrix VSR. LDVSR >= 1, and if JOBVSR = 'V', LDVSR >= N. 🌸
  • WORK β€” COMPLEX array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) returns the optimal LWORK. πŸ’…
  • LWORK β€” INTEGER. The dimension of the array WORK. LWORK >= max(1,2*N). For good performance, LWORK must generally be larger. 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 array, dimension (8*N). πŸ“
  • BWORK β€” LOGICAL array, dimension (N). Not referenced if SORT = 'N'. 🧚
  • INFO β€” INTEGER.
    • = 0: successful exit. βœ…
    • < 0: if INFO = -i, the i-th argument had an illegal value. πŸ’€
    • =1,...,N: The QZ iteration failed. (A,B) are not in Schur form, but ALPHA(j) and BETA(j) should be correct for j=INFO+1,...,N. 😭
    • > N:
      • =N+1: other than QZ iteration failed in CHGEQZ. πŸ’₯
      • =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 CTGSEN. 🚩

Author

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd. πŸ‘‘


subroutine cgges3

subroutine cgges3 (character JOBVSL, character JOBVSR, character SORT,
    external SELCTG, integer N, complex, dimension( lda, * ) A, integer LDA,
    complex, dimension( ldb, * ) B, integer LDB, integer SDIM, complex,
    dimension( * ) ALPHA, complex, dimension( * ) BETA, complex, dimension(
    ldvsl, * ) VSL, integer LDVSL, complex, dimension( ldvsr, * ) VSR,
    integer LDVSR, complex, dimension( * ) WORK, integer LWORK, real,
    dimension( * ) RWORK, logical, dimension( * ) BWORK, integer INFO)

CGGES3 computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE matrices (blocked algorithm). πŸ”₯

Purpose

CGGES3 computes for a pair of N-by-N complex nonsymmetric matrices (A,B), the generalized eigenvalues, the generalized complex Schur form (S, T), and optionally left and/or right Schur vectors (VSL and VSR). This gives the generalized Schur factorization

(A,B) = ( (VSL)*S*(VSR)**H, (VSL)*T*(VSR)**H )

where (VSR)**H is the conjugate-transpose of VSR. πŸ’–

Optionally, it also orders the eigenvalues so that a selected cluster of eigenvalues appears in the leading diagonal blocks of the upper triangular matrix S and the upper triangular matrix T. The leading columns of VSL and VSR then form an unitary basis for the corresponding left and right eigenspaces (deflating subspaces). ✨

(If only the generalized eigenvalues are needed, use the driver CGGEV instead, which is faster.) 🏎️

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, and even for both being zero. πŸ€”

A pair of matrices (S,T) is in generalized complex Schur form if S and T are upper triangular and, in addition, the diagonal elements of T are non-negative real numbers. πŸ’…

Parameters

  • JOBVSL β€” CHARACTER*1
    • = 'N': do not compute the left Schur vectors; 🚫
    • = 'V': compute the left Schur vectors. βœ…
  • JOBVSR β€” CHARACTER*1
    • = 'N': do not compute the right Schur vectors; 🚫
    • = 'V': compute the right Schur vectors. βœ…
  • SORT β€” CHARACTER*1. Specifies whether or not to order the eigenvalues on the diagonal of the generalized Schur form.
    • = 'N': Eigenvalues are not ordered; 🚫
    • = 'S': Eigenvalues are ordered (see SELCTG). βœ…
  • SELCTG β€” SELCTG is a LOGICAL FUNCTION of two COMPLEX arguments. SELCTG must be declared EXTERNAL in the calling subroutine. If SORT = 'N', SELCTG is not referenced. If SORT = 'S', SELCTG is used to select eigenvalues to sort to the top left of the Schur form. An eigenvalue ALPHA(j)/BETA(j) is selected if SELCTG(ALPHA(j),BETA(j)) is true. Note that a selected complex eigenvalue may no longer satisfy SELCTG(ALPHA(j),BETA(j)) = .TRUE. after ordering, since ordering may change the value of complex eigenvalues (especially if the eigenvalue is ill-conditioned), in this case INFO is set to N+2 (See INFO below). 😬
  • N β€” INTEGER. The order of the matrices A, B, VSL, and VSR. N >= 0. πŸ”’
  • A β€” COMPLEX array, dimension (LDA, N). On entry, the first of the pair of matrices. On exit, A has been overwritten by its generalized Schur form S. ✨
  • LDA β€” INTEGER. The leading dimension of A. LDA >= max(1,N). πŸ’–
  • B β€” COMPLEX array, dimension (LDB, N). On entry, the second of the pair of matrices. On exit, B has been overwritten by its generalized Schur form T. πŸ¦‹
  • LDB β€” INTEGER. The leading dimension of B. LDB >= max(1,N). 🌸
  • SDIM β€” INTEGER. If SORT = 'N', SDIM = 0. If SORT = 'S', SDIM = number of eigenvalues (after sorting) for which SELCTG is true. πŸ“
  • ALPHA β€” COMPLEX array, dimension (N). πŸ“
  • BETA β€” COMPLEX array, dimension (N). On exit, ALPHA(j)/BETA(j), j=1,...,N, will be the generalized eigenvalues. ALPHA(j), j=1,...,N and BETA(j), j=1,...,N are the diagonals of the complex Schur form (A,B) output by CGGES3. The BETA(j) will be non-negative real.
Note: the quotients ALPHA(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, ALPHA will be always less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B). 😭
  • VSL β€” COMPLEX array, dimension (LDVSL,N). If JOBVSL = 'V', VSL will contain the left Schur vectors. Not referenced if JOBVSL = 'N'. ✨
  • LDVSL β€” INTEGER. The leading dimension of the matrix VSL. LDVSL >= 1, and if JOBVSL = 'V', LDVSL >= N. πŸ’–
  • VSR β€” COMPLEX array, dimension (LDVSR,N). If JOBVSR = 'V', VSR will contain the right Schur vectors. Not referenced if JOBVSR = 'N'. πŸ¦‹
  • LDVSR β€” INTEGER. The leading dimension of the matrix VSR. LDVSR >= 1, and if JOBVSR = 'V', LDVSR >= N. 🌸
  • WORK β€” COMPLEX array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) returns the optimal LWORK. πŸ’…
  • LWORK β€” INTEGER. The dimension of the array WORK. 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 array, dimension (8*N). πŸ“
  • BWORK β€” LOGICAL array, dimension (N). Not referenced if SORT = 'N'. 🧚
  • INFO β€” INTEGER.
    • = 0: successful exit. βœ…
    • < 0: if INFO = -i, the i-th argument had an illegal value. πŸ’€
    • =1,...,N: The QZ iteration failed. (A,B) are not in Schur form, but ALPHA(j) and BETA(j) should be correct for j=INFO+1,...,N. 😭
    • > N:
      • =N+1: other than QZ iteration failed in CLAQZ0. πŸ’₯
      • =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 CTGSEN. 🚩

Author

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.

πŸŽ€ Parameters πŸŽ€

  • JOBVSL β€” CHARACTER*1, bestie, listen up:
    • 'N' β†’ do not compute the left Schur vectors
    • 'V' β†’ compute the left Schur vectors, slay πŸ’…
  • JOBVSR β€” CHARACTER*1 again:
    • 'N' β†’ do not compute the right Schur vectors
    • 'V' β†’ compute the right Schur vectors ✨
  • SORT β€” CHARACTER*1. It decides whether we're ordering the eigenvalues on the diagonal of the generalized Schur form or just letting them vibe:
    • 'N' β†’ eigenvalues are not ordered
    • 'S' β†’ eigenvalues are ordered (peep SELCTG)
  • SELCTG β€” it's a LOGICAL FUNCTION of two COMPLEX arguments, and you must declare it EXTERNAL in the calling subroutine. If SORT = 'N', SELCTG is not referenced at all (she's off the clock). If SORT = 'S', SELCTG is what picks which eigenvalues get sorted to the top left of the Schur form. Heads up though: a selected complex eigenvalue might not still satisfy SELCTG(ALPHA(j),BETA(j)) = .TRUE. after ordering, because ordering can literally change the value of complex eigenvalues (especially when the eigenvalue is ill-conditioned 😭). When that happens, INFO gets set to N+3 β€” more on that down in INFO.
  • SENSE β€” CHARACTER*1, and she's the one who decides which reciprocal condition numbers we're computing:
    • 'N' β†’ none of them, we're good
    • 'E' β†’ computed for the average of the selected eigenvalues only
    • 'V' β†’ computed for the selected deflating subspaces only
    • 'B' β†’ both, we're doing the most πŸ’–

If SENSE = 'E', 'V', or 'B', then SORT must equal 'S'. No exceptions, periodt.

  • N β€” INTEGER. The order of the matrices A, B, VSL, and VSR. Constraint: N >= 0.
  • A β€” COMPLEX array, dimension (LDA, N). On entry she's the first of the pair of matrices. On exit, A has been overwritten by its generalized Schur form S (gone, replaced, iconic behaviour honestly).
  • LDA β€” INTEGER. The leading dimension of A. You need LDA >= max(1,N).
  • B β€” COMPLEX array, dimension (LDB, N). On entry, the second of the pair. On exit, B has been overwritten by its generalized Schur form T πŸ¦‹
  • LDB β€” INTEGER. The leading dimension of B. LDB >= max(1,N).
  • SDIM β€” INTEGER:
    • If SORT = 'N', then SDIM = 0.
    • If SORT = 'S', then SDIM = the number of eigenvalues (after sorting) for which SELCTG is true.
  • ALPHA β€” COMPLEX array, dimension (N).
  • BETA β€” COMPLEX array, dimension (N). On exit, ALPHA(j)/BETA(j), j=1,...,N, are gonna be your generalized eigenvalues. ALPHA(j) and BETA(j), j=1,...,N are the diagonals of the complex Schur form (S,T). And BETA(j) will be non-negative real ✨
Note: the quotients ALPHA(j)/BETA(j) may easily over- or underflow, and BETA(j) may even be zero. So like… please do not naively compute the ratio alpha/beta, bestie, that's not the move. That said, ALPHA will always be less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B).
  • VSL β€” COMPLEX array, dimension (LDVSL,N). If JOBVSL = 'V', VSL will contain the left Schur vectors. Not referenced if JOBVSL = 'N'.
  • LDVSL β€” INTEGER. The leading dimension of the matrix VSL. LDVSL >= 1, and if JOBVSL = 'V', then LDVSL >= N.
  • VSR β€” COMPLEX array, dimension (LDVSR,N). If JOBVSR = 'V', VSR will contain the right Schur vectors. Not referenced if JOBVSR = 'N'.
  • LDVSR β€” INTEGER. The leading dimension of the matrix VSR. LDVSR >= 1, and if JOBVSR = 'V', then LDVSR >= N.
  • RCONDE β€” REAL array, dimension ( 2 ). If SENSE = 'E' or 'B', then RCONDE(1) and RCONDE(2) contain the reciprocal condition numbers for the average of the selected eigenvalues. Not referenced if SENSE = 'N' or 'V'.
  • RCONDV β€” REAL array, dimension ( 2 ). If SENSE = 'V' or 'B', then RCONDV(1) and RCONDV(2) contain the reciprocal condition number for the selected deflating subspaces. Not referenced if SENSE = 'N' or 'E'.
  • WORK β€” COMPLEX array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, then WORK(1) returns the optimal LWORK πŸ‘‘
  • LWORK β€” INTEGER. The dimension of the array WORK.
    • If N = 0, then LWORK >= 1, else if SENSE = 'E', 'V', or 'B', then LWORK >= MAX(1,2*N,2*SDIM*(N-SDIM)), else LWORK >= MAX(1,2*N).
    • Note that 2*SDIM*(N-SDIM) <= N*N/2.
    • Also note: an error is only returned if LWORK < MAX(1,2*N), but if SENSE = 'E' or '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, returns these values as the first entries of the WORK and IWORK arrays, and no error message related to LWORK or LIWORK is issued by XERBLA.

  • RWORK β€” REAL array, dimension ( 8*N ). Real workspace, just hanging out.
  • IWORK β€” INTEGER array, dimension (MAX(1,LIWORK)). On exit, if INFO = 0, then IWORK(1) returns the minimum LIWORK.
  • LIWORK β€” INTEGER. The dimension of the array WORK. If SENSE = 'N' or N = 0, then LIWORK >= 1, otherwise LIWORK >= N+2.

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, returns these values as the first entries of the WORK and IWORK arrays, and no error message related to LWORK or LIWORK is issued by XERBLA.

  • BWORK β€” LOGICAL array, dimension (N). Not referenced if SORT = 'N'.
  • INFO β€” INTEGER, the vibe report:
    • = 0: successful exit πŸŽ‰
    • < 0: if INFO = -i, the i-th argument had an illegal value 😬
    • = 1,...,N: the QZ iteration failed. (A,B) are not in Schur form, but ALPHA(j) and BETA(j) should be correct for j=INFO+1,...,N.
    • > N:
      • =N+1: other than QZ iteration failed in CHGEQZ
      • =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 CTGSEN.

✨ Author ✨

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

🌈 subroutine cggev 🌈

subroutine cggev (character JOBVL, character JOBVR, integer N, complex,
     dimension( lda, * ) A, integer LDA, complex, dimension( ldb, * ) B,
     integer LDB, complex, dimension( * ) ALPHA, complex, dimension( * )
     BETA, complex, dimension( ldvl, * ) VL, integer LDVL, complex,
     dimension( ldvr, * ) VR, integer LDVR, complex, dimension( * ) WORK,
     integer LWORK, real, dimension( * ) RWORK, integer INFO)

CGGEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices πŸ’…

Purpose:

CGGEV computes for a pair of N-by-N complex nonsymmetric matrices (A,B), the generalized eigenvalues, and optionally, the left and/or right generalized eigenvectors. and that's where we're at, bestie β€” more coming ✨

okay so 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's usually written as the pair (alpha,beta), because there's a totally reasonable interpretation for beta=0, and even for both of them being zero. no cap.

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 eigenvalues 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). πŸ’… literally the whole vibe of the function right there.


✨ Parameters ✨

bestie these are the inputs and outputs, read them carefully, they WILL bite you if you get the leading dimensions wrong 🫢

JOBVL

JOBVL is CHARACTER*1

  • = 'N': do not compute the left generalized eigenvectors;
  • = 'V': compute the left generalized eigenvectors.

JOBVR

JOBVR is CHARACTER*1

  • = 'N': do not compute the right generalized eigenvectors;
  • = 'V': compute the right generalized eigenvectors.

N

N is INTEGER

The order of the matrices A, B, VL, and VR. N >= 0. 🌸

A

A is COMPLEX array, dimension (LDA, N)

On entry, the matrix A in the pair (A,B). On exit, A has been overwritten. (yes, gone, bye, she's not coming back 😭)

LDA

LDA is INTEGER

The leading dimension of A. LDA >= max(1,N).

B

B is COMPLEX array, dimension (LDB, N)

On entry, the matrix B in the pair (A,B). On exit, B has been overwritten. (also gone, sorry bestie 🫠)

LDB

LDB is INTEGER

The leading dimension of B. LDB >= max(1,N).

ALPHA

ALPHA is COMPLEX array, dimension (N)

BETA

BETA is COMPLEX array, dimension (N)

On exit, ALPHA(j)/BETA(j), j=1,...,N, will be the generalized eigenvalues.

⚠️ Note: the quotients ALPHA(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, ALPHA will be always less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B).

so like… do NOT just divide them, okay? she said what she said πŸ™ˆ

VL

VL is COMPLEX array, dimension (LDVL,N)

If JOBVL = 'V', the left generalized eigenvectors u(j) are stored one after another in the columns of VL, in the same order as their eigenvalues.

Each eigenvector is scaled so the largest component has abs(real part) + abs(imag. part) = 1.

Not referenced if JOBVL = 'N'. (she's just sitting there, unbothered, ignored ✨)

LDVL

LDVL is INTEGER

The leading dimension of the matrix VL. LDVL >= 1, and if JOBVL = 'V', LDVL >= N.

VR

VR is COMPLEX array, dimension (LDVR,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 is scaled so the largest component has abs(real part) + abs(imag. part) = 1.

Not referenced if JOBVR = 'N'. (same energy, different matrix πŸ’œ)

LDVR

LDVR is INTEGER

The leading dimension of the matrix VR. LDVR >= 1, and if JOBVR = 'V', LDVR >= N.

WORK

WORK is COMPLEX array, dimension (MAX(1,LWORK))

On exit, if INFO = 0, WORK(1) returns the optimal LWORK. πŸ‘‘

LWORK

LWORK is INTEGER

The dimension of the array WORK. LWORK >= max(1,2*N). For good performance, LWORK must generally be larger.

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.

the LWORK = -1 thing is the "hey what size should I even be" cheat code and honestly it's iconic ✨

RWORK

RWORK is REAL array, dimension (8*N)

INFO

INFO is INTEGER

  • = 0: successful exit πŸŽ‰
  • < 0: if INFO = -i, the i-th argument had an illegal value.
  • =1,...,N: The QZ iteration failed. No eigenvectors have been calculated, but ALPHA(j) and BETA(j) should be correct for j=INFO+1,...,N.
  • > N: =N+1: other then QZ iteration failed in CHGEQZ, =N+2: error return from CTGEVC.
πŸ’€ INFO > 0 means something went sideways. read it, don't ignore it, she's telling you exactly where it broke.

πŸ‘‘ Author πŸ‘‘

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

🌈 subroutine cggev3 🌈

subroutine cggev3 (character JOBVL, character JOBVR, integer N, complex,
    dimension( lda, * ) A, integer LDA, complex, dimension( ldb, * ) B,
    integer LDB, complex, dimension( * ) ALPHA, complex, dimension( * )
    BETA, complex, dimension( ldvl, * ) VL, integer LDVL, complex,
    dimension( ldvr, * ) VR, integer LDVR, complex, dimension( * ) WORK,
    integer LWORK, real, dimension( * ) RWORK, integer INFO)

CGGEV3 computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices (blocked algorithm) β€” yes bestie, it's the blocked one, she's the same girl as CGGEV but she does it in blocks and she's faster. πŸ’…πŸ”₯


πŸ¦‹ Purpose πŸ¦‹

CGGEV3 computes for a pair of N-by-N complex nonsymmetric matrices (A,B), the generalized eigenvalues, and optionally, the left and/or right generalized eigenvectors. πŸŽ€

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 eigenvalues 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 🌸

same squad, same rules, one tiny difference in LWORK β€” eyes open, bestie πŸ‘€

JOBVL

JOBVL is CHARACTER*1

  • = 'N': do not compute the left generalized eigenvectors;
  • = 'V': compute the left generalized eigenvectors.

JOBVR

JOBVR is CHARACTER*1

  • = 'N': do not compute the right generalized eigenvectors;
  • = 'V': compute the right generalized eigenvectors.

N

N is INTEGER

The order of the matrices A, B, VL, and VR. N >= 0.

A

A is COMPLEX array, dimension (LDA, N)

On entry, the matrix A in the pair (A,B). On exit, A has been overwritten. (again!! she eats your matrix every single time 😭)

LDA

LDA is INTEGER

The leading dimension of A. LDA >= max(1,N).

B

B is COMPLEX array, dimension (LDB, N)

On entry, the matrix B in the pair (A,B). On exit, B has been overwritten.

LDB

LDB is INTEGER

The leading dimension of B. LDB >= max(1,N).

ALPHA

ALPHA is COMPLEX array, dimension (N)

BETA

BETA is COMPLEX array, dimension (N)

On exit, ALPHA(j)/BETA(j), j=1,...,N, will be the generalized eigenvalues.

⚠️ Note: the quotients ALPHA(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, ALPHA will be always less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B).

VL

VL is COMPLEX array, dimension (LDVL,N)

If JOBVL = 'V', the left generalized eigenvectors u(j) are stored one after another in the columns of VL, in the same order as their eigenvalues.

Each eigenvector is scaled so the largest component has abs(real part) + abs(imag. part) = 1.

Not referenced if JOBVL = 'N'.

LDVL

LDVL is INTEGER

The leading dimension of the matrix VL. LDVL >= 1, and if JOBVL = 'V', LDVL >= N.

VR

VR is COMPLEX array, dimension (LDVR,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 is scaled so the largest component has abs(real part) + abs(imag. part) = 1.

Not referenced if JOBVR = 'N'.

LDVR

LDVR is INTEGER

The leading dimension of the matrix VR. LDVR >= 1, and if JOBVR = 'V', LDVR >= N.

WORK

WORK is COMPLEX array, dimension (MAX(1,LWORK))

On exit, if INFO = 0, WORK(1) returns the optimal LWORK. ✨

LWORK

LWORK is INTEGER

The dimension of the array WORK.

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.

heads up bestie: this is the one spot where CGGEV3 differs from the other one β€” no LWORK >= max(1,2*N) line here, so don't go quoting it like it's in this version πŸ‘€

RWORK

RWORK is REAL array, dimension (8*N)

INFO

INFO is INTEGER

  • = 0: successful exit πŸŽ‰
  • < 0: if INFO = -i, the i-th argument had an illegal value.
  • =1,...,N: The QZ iteration failed. No eigenvectors have been calculated, but ALPHA(j) and BETA(j) should be correct for j=INFO+1,...,N.
  • > N: =N+1: other then QZ iteration failed in CHGEQZ, =N+2: error return from CTGEVC.

πŸ’œ Author πŸ’œ

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.
   subroutine cggevx (character BALANC, character JOBVL, character JOBVR,
       character SENSE, integer N, complex, dimension( lda, * ) A, integer LDA,
       complex, dimension( ldb, * ) B, integer LDB, complex, dimension( * )
       ALPHA, complex, dimension( * ) BETA, complex, dimension( ldvl, * ) VL,
       integer LDVL, complex, dimension( ldvr, * ) VR, integer LDVR, integer
       ILO, integer IHI, real, dimension( * ) LSCALE, real, dimension( * )
       RSCALE, real ABNRM, real BBNRM, real, dimension( * ) RCONDE, real,
       dimension( * ) RCONDV, complex, dimension( * ) WORK, integer LWORK,
       real, dimension( * ) RWORK, integer, dimension( * ) IWORK, logical,
       dimension( * ) BWORK, integer INFO)

CGGEVX computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices πŸ’…


🎯 Purpose 🎯

CGGEVX computes, for a pair of N-by-N complex nonsymmetric matrices (A,B), the generalized eigenvalues β€” and optionally the left and/or right generalized eigenvectors. Bestie, it's giving full service πŸ’–

It can optionally also compute a balancing transformation to improve the conditioning of the eigenvalues and eigenvectors β€” that's ILO, IHI, LSCALE, RSCALE, ABNRM, and BBNRM β€” plus reciprocal condition numbers for the eigenvalues (RCONDE) and reciprocal condition numbers for the right eigenvectors (RCONDV). So many little gifts 🎁

So what even is a generalized eigenvalue for a pair of matrices (A,B)? It's a scalar lambda, or a ratio alpha/beta = lambda, such that A - lambda*B is singular. It's usually represented as the pair (alpha,beta), because there's a reasonable interpretation for beta=0, and even for both being zero. Iconic, honestly 🫢

The right eigenvector v(j) corresponding to the eigenvalue lambda(j) of (A,B) satisfies

                 A * v(j) = lambda(j) * B * v(j) .

The left eigenvector u(j) corresponding to the 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). Periodt ✨


🌸 Parameters 🌸

  • BALANC β€” is CHARACTER*1. Specifies 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. iykyk πŸ’€

  • JOBVL β€” is CHARACTER*1
    • = 'N': do not compute the left generalized eigenvectors;
    • = 'V': compute the left generalized eigenvectors.
  • JOBVR β€” is CHARACTER*1
    • = 'N': do not compute the right generalized eigenvectors;
    • = 'V': compute the right generalized eigenvectors.
  • SENSE β€” is CHARACTER*1. Determines which reciprocal condition numbers are computed.
    • = 'N': none are computed;
    • = 'E': computed for eigenvalues only;
    • = 'V': computed for eigenvectors only;
    • = 'B': computed for eigenvalues and eigenvectors.
  • N β€” is INTEGER. The order of the matrices A, B, VL, and VR. N >= 0.
  • A β€” is COMPLEX array, dimension (LDA, N). On entry, the matrix A in the pair (A,B). On exit, A has been overwritten. If JOBVL='V' or JOBVR='V' or both, then A contains the first part of the complex Schur form of the 'balanced' versions of the input A and B. She's been through some things πŸ’…
  • LDA β€” is INTEGER. The leading dimension of A. LDA >= max(1,N).
  • B β€” is COMPLEX array, dimension (LDB, N). On entry, the matrix B in the pair (A,B). On exit, B has been overwritten. If JOBVL='V' or JOBVR='V' or both, then B contains the second part of the complex Schur form of the 'balanced' versions of the input A and B.
  • LDB β€” is INTEGER. The leading dimension of B. LDB >= max(1,N).
  • ALPHA β€” is COMPLEX array, dimension (N)
  • BETA β€” is COMPLEX array, dimension (N). On exit, ALPHA(j)/BETA(j), j=1,...,N, will be the generalized eigenvalues.
⚠️ Note: the quotient ALPHA(j)/BETA(j) may easily over- or underflow, and BETA(j) may even be zero. So please, bestie, do not naively compute the ratio ALPHA/BETA. πŸ™ˆ However, ALPHA will be always less than and usually comparable with norm(A) in magnitude, and BETA always less than and usually comparable with norm(B). So like, it's fine, it's fine.
  • VL β€” is COMPLEX array, dimension (LDVL,N). If JOBVL = 'V', the left generalized eigenvectors u(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 will have abs(real part) + abs(imag. part) = 1. Not referenced if JOBVL = 'N'.
  • LDVL β€” is INTEGER. The leading dimension of the matrix VL. LDVL >= 1, and if JOBVL = 'V', LDVL >= N.
  • VR β€” is COMPLEX array, dimension (LDVR,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 will have abs(real part) + abs(imag. part) = 1. Not referenced if JOBVR = 'N'.
  • LDVR β€” is INTEGER. The leading dimension of the matrix VR. LDVR >= 1, and if JOBVR = 'V', LDVR >= N.
  • ILO β€” is INTEGER
  • IHI β€” is INTEGER. ILO and IHI are integer values such that on exit A(i,j) = 0 and B(i,j) = 0 if i > j and j = 1,...,ILO-1 or i = IHI+1,...,N. If BALANC = 'N' or 'S', ILO = 1 and IHI = N.
  • LSCALE β€” is REAL array, dimension (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 = 1,...,ILO-1
                               = DL(j)  for j = ILO,...,IHI
                               = PL(j)  for j = IHI+1,...,N.

The order in which the interchanges are made is N to IHI+1, then 1 to ILO-1.

  • RSCALE β€” is REAL array, dimension (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 = 1,...,ILO-1
                               = DR(j)  for j = ILO,...,IHI
                               = PR(j)  for j = IHI+1,...,N

The order in which the interchanges are made is N to IHI+1, then 1 to ILO-1.

  • ABNRM β€” is REAL. The one-norm of the balanced matrix A.
  • BBNRM β€” is REAL. The one-norm of the balanced matrix B.
  • RCONDE β€” is REAL array, dimension (N). If SENSE = 'E' or 'B', the reciprocal condition numbers of the eigenvalues, stored in consecutive elements of the array. If SENSE = 'N' or 'V', RCONDE is not referenced.
  • RCONDV β€” is REAL array, dimension (N). If SENSE = 'V' or 'B', the estimated reciprocal condition numbers of the eigenvectors, stored in consecutive elements of the array. 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 β€” is COMPLEX array, dimension (MAX(1,LWORK)). On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
  • LWORK β€” is INTEGER. The dimension of the array WORK. LWORK >= max(1,2*N). If SENSE = 'E', LWORK >= max(1,4*N). If SENSE = 'V' or 'B', LWORK >= max(1,2*N*N+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. Sneaky but legal 🧚

  • RWORK β€” is REAL array, dimension (lrwork). lrwork must be at least max(1,6*N) if BALANC = 'S' or 'B', and at least max(1,2*N) otherwise. Real workspace.
  • IWORK β€” is INTEGER array, dimension (N+2). If SENSE = 'E', IWORK is not referenced.
  • BWORK β€” is LOGICAL array, dimension (N). If SENSE = 'N', BWORK is not referenced.
  • INFO β€” is INTEGER
    • = 0: successful exit πŸŽ‰
    • < 0: if INFO = -i, the i-th argument had an illegal value.
    • = 1,...,N: The QZ iteration failed. No eigenvectors have been calculated, but ALPHA(j) and BETA(j) should be correct for j=INFO+1,...,N. 😭
    • > N: =N+1: other than QZ iteration failed in CHGEQZ. =N+2: error return from CTGEVC.

πŸ‘‘ Author πŸ‘‘

Univ. of Tennessee

Univ. of California Berkeley

Univ. of Colorado Denver

NAG Ltd.


🌈 Further Details 🌈

Okay so lowkey the glow-up part of all this β€” balancing a matrix pair (A,B) β€” happens in two lil steps and I need you to hold both:

  1. first, permuting rows and columns to isolate eigenvalues
  2. second, applying diagonal similarity transformation to the rows and columns to make the rows and columns as close in norm as possible

And here's the tea bestie πŸ«–: the computed reciprocal condition numbers correspond to the balanced matrix. Permuting rows and columns will not change the condition numbers (in exact arithmetic) but diagonal scaling will. Not me being dramatic, that's just literally what it says. πŸ’…

Wanna go deeper on balancing? The original says: for further explanation of balancing, see section 4.11.1.2 of LAPACK Users' Guide. Go read it, it's giving academic icon behavior. πŸ“š


πŸ¦‹ The Error Bounds (aka the "how wrong am I tho" section) πŸ¦‹

An approximate error bound on the chordal distance between the i-th computed generalized eigenvalue w and the corresponding exact eigenvalue lambda is

chord(w, lambda) <= EPS * norm(ABNRM, BBNRM) / RCONDE(I)

An approximate error bound for the angle between the i-th computed eigenvector VL(i) or VR(i) is given by

EPS * norm(ABNRM, BBNRM) / DIF(i)

For further explanation of the reciprocal condition numbers RCONDE and RCONDV, see section 4.11 of LAPACK Users' Guide. Bestie I promise the Users' Guide is not that scary, it's giving ✨reference material✨ and honestly kind of iconic for it.


πŸŽ€ AUTHOR πŸŽ€

Generated automatically by Doxygen for LAPACK from the source code.

No human hand wrote this one, it's a bot's baby fr fr πŸ€–πŸ’–

πŸ’œ bestie we made it to the end πŸ’œ

That's the whole page, every last crumb, no cap. This lil beauty lives in LAPACK and it's Version 3.11.0, dated Sun Nov 27 2022 β€” that's the source/version and date from the footer, mmkay? Periodt. Go balance something responsibly, drink water, and remember: RCONDE and RCONDV are your friends. πŸŒΈπŸ¦‹βœ¨πŸ‘‘

πŸ“¦ where this page comes from