complexGEeigen(3)
β¨ 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 (seeSELECT).
SELECTβSELECT is a LOGICAL FUNCTION of one COMPLEX argument.SELECTmust be declaredEXTERNALin the calling subroutine.- If
SORT = 'S',SELECTis used to select eigenvalues to order to the top left of the Schur form. - IF
SORT = 'N',SELECTis not referenced. - The eigenvalue
W(j)is selected ifSELECT(W(j))is true.
- If
NβN is INTEGER. the order of the matrixA.N >= 0.AβA is COMPLEX array, dimension (LDA,N). on entry, the N-by-N matrixA. on exit,Ahas been overwritten by its Schur formTπ (she's gone, bestie, but she left youT).LDAβLDA is INTEGER. the leading dimension of the arrayA.LDA >= max(1,N).SDIMβSDIM is INTEGER- If
SORT = 'N',SDIM = 0. - If
SORT = 'S',SDIM =number of eigenvalues for whichSELECTis true.
- If
WβW is COMPLEX array, dimension (N).Wcontains the computed eigenvalues, in the same order that they appear on the diagonal of the output Schur formT.VSβVS is COMPLEX array, dimension (LDVS,N)- If
JOBVS = 'V',VScontains the unitary matrixZof Schur vectors. - If
JOBVS = 'N',VSis not referenced.
- If
LDVSβLDVS is INTEGER. the leading dimension of the arrayVS.LDVS >= 1; ifJOBVS = 'V',LDVS >= N.WORKβWORK is COMPLEX array, dimension (MAX(1,LWORK)). on exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKβLWORK is INTEGER. the dimension of the arrayWORK.LWORK >= max(1,2*N). for good performance,LWORKmust generally be larger.- If
LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA.
- If
RWORKβRWORK is REAL array, dimension (N)BWORKβBWORK is LOGICAL array, dimension (N). not referenced ifSORT = 'N'.INFOβINFO is INTEGER= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = i, andiis<= N: the QR algorithm failed to compute all the eigenvalues; elements1:ILO-1andi+1:NofWcontain those eigenvalues which have converged; ifJOBVS = 'V',VScontains the matrix which reducesAto 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 satisfySELECT = .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 (seeSELECT).
SELECTβSELECT is a LOGICAL FUNCTION of one COMPLEX argument.SELECTmust be declaredEXTERNALin the calling subroutine.- If
SORT = 'S',SELECTis used to select eigenvalues to order to the top left of the Schur form. - If
SORT = 'N',SELECTis not referenced. - An eigenvalue
W(j)is selected ifSELECT(W(j))is true.
- If
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',SORTmust equal'S'.
NβN is INTEGER. The order of the matrixA.N >= 0.AAβCOMPLEXarray, dimension(LDA, N). On entry, the N-by-N matrixA. On exit,Ais overwritten by its Schur formT. (yeah bestie, it eats your input, that's just the deal π)LDAβINTEGER. The leading dimension of the arrayA. Rule of the house:LDA >= max(1,N).SDIMβINTEGER.- If
SORT = 'N', thenSDIM = 0. - If
SORT = 'S', thenSDIM = number of eigenvalues for which SELECT is true.
- If
WβCOMPLEXarray, dimension(N).Wholds the computed eigenvalues, in the same order that they appear on the diagonal of the output Schur formT. πVSβCOMPLEXarray, dimension(LDVS,N). IfJOBVS = 'V',VScontains the unitary matrixZof Schur vectors. IfJOBVS = 'N',VSis not referenced. (not even a little bit, she's off the clock π)LDVSβINTEGER. The leading dimension of the arrayVS.LDVS >= 1, and ifJOBVS = 'V',LDVS >= N.RCONDEβREAL. IfSENSE = 'E'or'B',RCONDEcontains the reciprocal condition number for the average of the selected eigenvalues. Not referenced ifSENSE = 'N'or'V'.RCONDVβREAL. IfSENSE = 'V'or'B',RCONDVcontains the reciprocal condition number for the selected right invariant subspace. Not referenced ifSENSE = 'N'or'E'.WORKβCOMPLEXarray, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK. β¨LWORKβINTEGER. The dimension of the arrayWORK.LWORK >= max(1,2*N). Also, ifSENSE = 'E'or'V'or'B',LWORK >= 2*SDIM*(N-SDIM), whereSDIMis the number of selected eigenvalues computed by this routine. Note that2*SDIM*(N-SDIM) <= N*N/2. Note also that an error is only returned ifLWORK < max(1,2*N), but ifSENSE = 'E'or'V'or'B'this may not be large enough. For good performance,LWORKmust generally be larger. IfLWORK = -1, then a workspace query is assumed; the routine only calculates upper bound on the optimal size of the arrayWORK, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA.RWORKβREALarray, dimension(N).BWORKβLOGICALarray, dimension(N). Not referenced ifSORT = 'N'.INFOβINTEGER, the final vibe check:= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = i, andiis<= N: the QR algorithm failed to compute all the eigenvalues; elements1:ILO-1andi+1:NofWcontain those eigenvalues which have converged; ifJOBVS = 'V',VScontains the transformation which reducesAto 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 satisfySELECT=.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 ofAare not computed;= 'V': left eigenvectors of are computed.
JOBVRβCHARACTER*1.= 'N': right eigenvectors ofAare not computed;= 'V': right eigenvectors ofAare computed.
NβINTEGER. The order of the matrixA.N >= 0.AβCOMPLEXarray, dimension(LDA,N). On entry, the N-by-N matrixA. On exit,Ahas been overwritten. (again. she's gone. poof π)LDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).WβCOMPLEXarray, dimension(N).Wcontains the computed eigenvalues.VLβCOMPLEXarray, dimension(LDVL,N). IfJOBVL = 'V', the left eigenvectorsu(j)are stored one after another in the columns ofVL, in the same order as their eigenvalues. IfJOBVL = 'N',VLis not referenced. And the math?u(j) = VL(:,j), the j-th column ofVL.LDVLβINTEGER. The leading dimension of the arrayVL.LDVL >= 1; ifJOBVL = 'V',LDVL >= N.VRβCOMPLEXarray, dimension(LDVR,N). IfJOBVR = 'V', the right eigenvectorsv(j)are stored one after another in the columns ofVR, in the same order as their eigenvalues. IfJOBVR = 'N',VRis not referenced. And:v(j) = VR(:,j), the j-th column ofVR.LDVRβINTEGER. The leading dimension of the arrayVR.LDVR >= 1; ifJOBVR = 'V',LDVR >= N.WORKβCOMPLEXarray, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK. β¨LWORKβINTEGER. The dimension of the arrayWORK.LWORK >= max(1,2*N). For good performance,LWORKmust generally be larger. IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA.RWORKβREALarray, dimension(2*N).INFOβINTEGER.= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = i, the QR algorithm failed to compute all the eigenvalues, and no eigenvectors have been computed; elementsi+1:NofWcontain 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 aCHARACTER*1and 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. replaceAbyD*A*D**(-1), whereDis a diagonal matrix chosen to make the rows and columns ofAmore equal in norm. do not permute.'B': both diagonally scale and permuteA. 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 ofAare not computed.'V': left eigenvectors ofAare computed.
IfSENSE = 'E'or'B',JOBVLmust ='V'. the way that is mandatory, bestie. no skipping.
JOBVRβCHARACTER*1. right eigenvector check.'N': right eigenvectors ofAare not computed.'V': right eigenvectors ofAare computed.
IfSENSE = 'E'or'B',JOBVRmust ='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.
IfSENSE = 'E'or'B', both left and right eigenvectors must also be computed (JOBVL = 'V'andJOBVR = 'V'). so don't forget.
NβINTEGER. The order of the matrixA.N >= 0. zero is valid, bestie. she can be empty.AβCOMPLEXarray, dimension(LDA,N).- On entry, the
N-by-NmatrixA. - On exit,
Ahas been overwritten. IfJOBVL = 'V'orJOBVR = 'V',Acontains the Schur form of the balanced version of the matrixA. she's changed, and honestly? iconic.
- On entry, the
LDAβINTEGER. The leading dimension of the arrayA.LDA >= max(1,N). math check, no cap.WβCOMPLEXarray, dimension(N).Wcontains the computed eigenvalues. β¨ the main characters β¨VLβCOMPLEXarray, dimension(LDVL,N).- If
JOBVL = 'V', the left eigenvectorsu(j)are stored one after another in the columns ofVL, in the same order as their eigenvalues. - If
JOBVL = 'N',VLis not referenced. u(j) = VL(:,j), thej-th column ofVL. iykyk.
- If
LDVLβINTEGER. The leading dimension of the arrayVL.LDVL >= 1; ifJOBVL = 'V',LDVL >= N. don't skimp on the leading dimension.VRβCOMPLEXarray, dimension(LDVR,N).- If
JOBVR = 'V', the right eigenvectorsv(j)are stored one after another in the columns ofVR, in the same order as their eigenvalues. - If
JOBVR = 'N',VRis not referenced. v(j) = VR(:,j), thej-th column ofVR. iykyk again.
- If
LDVRβINTEGER. The leading dimension of the arrayVR.LDVR >= 1; ifJOBVR = 'V',LDVR >= N. same rules apply.ILOβINTEGER. (that's it, just an integer bestie. she's chill.)IHIβINTEGER.ILOandIHIare integer values determined whenAwas balanced. The balancedA(i,j) = 0ifI > JandJ = 1,...,ILO-1orI = IHI+1,...,N. structural tea, periodt.SCALEβREALarray, dimension(N). Details of the permutations and scaling factors applied when balancingA. IfP(j)is the index of the row and column interchanged with row and columnj, andD(j)is the scaling factor applied to row and columnj, 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βREALarray, dimension(N).RCONDE(j)is the reciprocal condition number of thej-th eigenvalue. condition number tea, but for eigenvalues.RCONDVβREALarray, dimension(N).RCONDV(j)is the reciprocal condition number of thej-th right eigenvector. right eigenvector condition number, specifically.WORKβCOMPLEXarray, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK. workspace lore, she's telling you how much room she needs.LWORKβINTEGER. The dimension of the arrayWORK. IfSENSE = 'N'or'E',LWORK >= max(1,2*N), and ifSENSE = 'V'or'B',LWORK >= N*N+2*N. For good performance,LWORKmust generally be larger. bigger is better, apparently.
IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. so if you pass -1, it's just asking "how much space?" and no error, periodt.
RWORKβREALarray, dimension(2*N). real work, real values. she's not complex.INFOβINTEGER.= 0: successful exit. slay, we love a successful exit.< 0: ifINFO = -i, thei-th argument had an illegal value. oops, illegal value. not iconic.> 0: ifINFO = i, the QR algorithm failed to compute all the eigenvalues, and no eigenvectors or condition numbers have been computed; elements1:ILO-1andi+1:NofWcontain 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 (seeSELCTG).
SELCTGβSELCTGis aLOGICAL FUNCTIONof twoCOMPLEXarguments.SELCTGmust be declaredEXTERNALin the calling subroutine. IfSORT = 'N',SELCTGis not referenced. IfSORT = 'S',SELCTGis used to select eigenvalues to sort to the top left of the Schur form. An eigenvalueALPHA(j)/BETA(j)is selected ifSELCTG(ALPHA(j),BETA(j))is true.
Note that a selected complex eigenvalue may no longer satisfySELCTG(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 caseINFOis set toN+2(SeeINFObelow). ill-conditioned tea, be careful bestie. ordering can change things.
NβINTEGER. The order of the matricesA,B,VSL, andVSR.N >= 0. zero is still valid.AβCOMPLEXarray, dimension(LDA, N).- On entry, the first of the pair of matrices.
- On exit,
Ahas been overwritten by its generalized Schur formS. she's transformed.
LDAβINTEGER. The leading dimension ofA.LDA >= max(1,N). math check again.BβCOMPLEXarray, dimension(LDB, N).- On entry, the second of the pair of matrices.
- On exit,
Bhas been overwritten by its generalized Schur formT. also transformed.
LDBβINTEGER. The leading dimension ofB.LDB >= max(1,N). same rule.SDIMβINTEGER. IfSORT = 'N',SDIM = 0. IfSORT = 'S',SDIM = number of eigenvalues (after sorting) for which SELCTG is true. count 'em up.ALPHAβCOMPLEXarray, dimension(N). alpha, the first half of the eigenvalue pair.BETABETAβ bestie, this is aCOMPLEX array, dimension (N). On exit,ALPHA(j)/BETA(j),j=1,...,N, will be the generalized eigenvalues.ALPHA(j), j=1,...,NandBETA(j), j=1,...,Nare the diagonals of the complex Schur form(A,B)output byCGGES. TheBETA(j)will be non-negative real. π
Note: the quotientsALPHA(j)/BETA(j)may easily over- or underflow, andBETA(j)may even be zero. Thus, the user should avoid naively computing the ratioalpha/beta. However,ALPHAwill be always less than and usually comparable withnorm(A)in magnitude, andBETAalways less than and usually comparable withnorm(B). π
VSLβCOMPLEX array, dimension (LDVSL,N). IfJOBVSL = 'V',VSLwill contain the left Schur vectors. Not referenced ifJOBVSL = 'N'. β¨LDVSLβINTEGER. The leading dimension of the matrixVSL.LDVSL >= 1, and ifJOBVSL = 'V',LDVSL >= N. πVSRβCOMPLEX array, dimension (LDVSR,N). IfJOBVSR = 'V',VSRwill contain the right Schur vectors. Not referenced ifJOBVSR = 'N'. π¦LDVSRβINTEGER. The leading dimension of the matrixVSR.LDVSR >= 1, and ifJOBVSR = 'V',LDVSR >= N. πΈWORKβCOMPLEX array, dimension (MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK. πLWORKβINTEGER. The dimension of the arrayWORK.LWORK >= max(1,2*N). For good performance,LWORKmust generally be larger. IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. π₯RWORKβREAL array, dimension (8*N). πBWORKβLOGICAL array, dimension (N). Not referenced ifSORT = 'N'. π§INFOβINTEGER.= 0: successful exit. β< 0: ifINFO = -i, thei-th argument had an illegal value. π=1,...,N: The QZ iteration failed.(A,B)are not in Schur form, butALPHA(j)andBETA(j)should be correct forj=INFO+1,...,N. π> N:=N+1: other than QZ iteration failed inCHGEQZ. π₯=N+2: after reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the Generalized Schur form no longer satisfySELCTG=.TRUE.This could also be caused due to scaling. π=N+3: reordering failed inCTGSEN. π©
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 (seeSELCTG). β
SELCTGβSELCTGis aLOGICAL FUNCTIONof twoCOMPLEXarguments.SELCTGmust be declaredEXTERNALin the calling subroutine. IfSORT = 'N',SELCTGis not referenced. IfSORT = 'S',SELCTGis used to select eigenvalues to sort to the top left of the Schur form. An eigenvalueALPHA(j)/BETA(j)is selected ifSELCTG(ALPHA(j),BETA(j))is true. Note that a selected complex eigenvalue may no longer satisfySELCTG(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 caseINFOis set toN+2(SeeINFObelow). π¬NβINTEGER. The order of the matricesA,B,VSL, andVSR.N >= 0. π’AβCOMPLEX array, dimension (LDA, N). On entry, the first of the pair of matrices. On exit,Ahas been overwritten by its generalized Schur formS. β¨LDAβINTEGER. The leading dimension ofA.LDA >= max(1,N). πBβCOMPLEX array, dimension (LDB, N). On entry, the second of the pair of matrices. On exit,Bhas been overwritten by its generalized Schur formT. π¦LDBβINTEGER. The leading dimension ofB.LDB >= max(1,N). πΈSDIMβINTEGER. IfSORT = 'N',SDIM = 0. IfSORT = '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,...,NandBETA(j), j=1,...,Nare the diagonals of the complex Schur form(A,B)output byCGGES3. TheBETA(j)will be non-negative real.
Note: the quotientsALPHA(j)/BETA(j)may easily over- or underflow, andBETA(j)may even be zero. Thus, the user should avoid naively computing the ratioalpha/beta. However,ALPHAwill be always less than and usually comparable withnorm(A)in magnitude, andBETAalways less than and usually comparable withnorm(B). π
VSLβCOMPLEX array, dimension (LDVSL,N). IfJOBVSL = 'V',VSLwill contain the left Schur vectors. Not referenced ifJOBVSL = 'N'. β¨LDVSLβINTEGER. The leading dimension of the matrixVSL.LDVSL >= 1, and ifJOBVSL = 'V',LDVSL >= N. πVSRβCOMPLEX array, dimension (LDVSR,N). IfJOBVSR = 'V',VSRwill contain the right Schur vectors. Not referenced ifJOBVSR = 'N'. π¦LDVSRβINTEGER. The leading dimension of the matrixVSR.LDVSR >= 1, and ifJOBVSR = 'V',LDVSR >= N. πΈWORKβCOMPLEX array, dimension (MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK. πLWORKβINTEGER. The dimension of the arrayWORK. IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. π₯RWORKβREAL array, dimension (8*N). πBWORKβLOGICAL array, dimension (N). Not referenced ifSORT = 'N'. π§INFOβINTEGER.= 0: successful exit. β< 0: ifINFO = -i, thei-th argument had an illegal value. π=1,...,N: The QZ iteration failed.(A,B)are not in Schur form, butALPHA(j)andBETA(j)should be correct forj=INFO+1,...,N. π> N:=N+1: other than QZ iteration failed inCLAQZ0. π₯=N+2: after reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the Generalized Schur form no longer satisfySELCTG=.TRUE.This could also be caused due to scaling. π=N+3: reordering failed inCTGSEN. π©
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*1again:'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 (peepSELCTG)
SELCTGβ it's aLOGICAL FUNCTIONof twoCOMPLEXarguments, and you must declare itEXTERNALin the calling subroutine. IfSORT = 'N',SELCTGis not referenced at all (she's off the clock). IfSORT = 'S',SELCTGis what picks which eigenvalues get sorted to the top left of the Schur form. Heads up though: a selected complex eigenvalue might not still satisfySELCTG(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,INFOgets set toN+3β more on that down inINFO.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 matricesA,B,VSL, andVSR. Constraint:N >= 0.AβCOMPLEX array, dimension(LDA, N). On entry she's the first of the pair of matrices. On exit,Ahas been overwritten by its generalized Schur formS(gone, replaced, iconic behaviour honestly).LDAβINTEGER. The leading dimension ofA. You needLDA >= max(1,N).BβCOMPLEX array, dimension(LDB, N). On entry, the second of the pair. On exit,Bhas been overwritten by its generalized Schur formTπ¦LDBβINTEGER. The leading dimension ofB.LDB >= max(1,N).SDIMβINTEGER:- If
SORT = 'N', thenSDIM = 0. - If
SORT = 'S', thenSDIM= the number of eigenvalues (after sorting) for whichSELCTGis true.
- If
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)andBETA(j),j=1,...,Nare the diagonals of the complex Schur form(S,T). AndBETA(j)will be non-negative real β¨
Note: the quotientsALPHA(j)/BETA(j)may easily over- or underflow, andBETA(j)may even be zero. So like⦠please do not naively compute the ratioalpha/beta, bestie, that's not the move. That said,ALPHAwill always be less than and usually comparable withnorm(A)in magnitude, andBETAalways less than and usually comparable withnorm(B).
VSLβCOMPLEX array, dimension(LDVSL,N). IfJOBVSL = 'V',VSLwill contain the left Schur vectors. Not referenced ifJOBVSL = 'N'.LDVSLβINTEGER. The leading dimension of the matrixVSL.LDVSL >= 1, and ifJOBVSL = 'V', thenLDVSL >= N.VSRβCOMPLEX array, dimension(LDVSR,N). IfJOBVSR = 'V',VSRwill contain the right Schur vectors. Not referenced ifJOBVSR = 'N'.LDVSRβINTEGER. The leading dimension of the matrixVSR.LDVSR >= 1, and ifJOBVSR = 'V', thenLDVSR >= N.RCONDEβREAL array, dimension( 2 ). IfSENSE = 'E'or'B', thenRCONDE(1)andRCONDE(2)contain the reciprocal condition numbers for the average of the selected eigenvalues. Not referenced ifSENSE = 'N'or'V'.RCONDVβREAL array, dimension( 2 ). IfSENSE = 'V'or'B', thenRCONDV(1)andRCONDV(2)contain the reciprocal condition number for the selected deflating subspaces. Not referenced ifSENSE = 'N'or'E'.WORKβCOMPLEX array, dimension(MAX(1,LWORK)). On exit, ifINFO = 0, thenWORK(1)returns the optimalLWORKπLWORKβINTEGER. The dimension of the arrayWORK.- If
N = 0, thenLWORK >= 1, else ifSENSE = 'E','V', or'B', thenLWORK >= MAX(1,2*N,2*SDIM*(N-SDIM)), elseLWORK >= 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 ifSENSE = 'E'or'V'or'B'this may not be large enough.
- If
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, ifINFO = 0, thenIWORK(1)returns the minimumLIWORK.LIWORKβINTEGER. The dimension of the arrayWORK. IfSENSE = 'N'orN = 0, thenLIWORK >= 1, otherwiseLIWORK >= 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 ifSORT = 'N'.INFOβINTEGER, the vibe report:= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value π¬= 1,...,N: the QZ iteration failed.(A,B)are not in Schur form, butALPHA(j)andBETA(j)should be correct forj=INFO+1,...,N.> N:=N+1: other than QZ iteration failed inCHGEQZ=N+2: after reordering, roundoff changed values of some complex eigenvalues so that leading eigenvalues in the Generalized Schur form no longer satisfySELCTG=.TRUE.. This could also be caused due to scaling.=N+3: reordering failed inCTGSEN.
β¨ 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 quotientsALPHA(j)/BETA(j)may easily over- or underflow, andBETA(j)may even be zero. Thus, the user should avoid naively computing the ratioalpha/beta. However,ALPHAwill be always less than and usually comparable withnorm(A)in magnitude, andBETAalways less than and usually comparable withnorm(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: ifINFO = -i, the i-th argument had an illegal value.=1,...,N: The QZ iteration failed. No eigenvectors have been calculated, butALPHA(j)andBETA(j)should be correct forj=INFO+1,...,N.> N:=N+1: other then QZ iteration failed inCHGEQZ,=N+2: error return fromCTGEVC.
π 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 quotientsALPHA(j)/BETA(j)may easily over- or underflow, andBETA(j)may even be zero. Thus, the user should avoid naively computing the ratioalpha/beta. However,ALPHAwill be always less than and usually comparable withnorm(A)in magnitude, andBETAalways less than and usually comparable withnorm(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: ifINFO = -i, the i-th argument had an illegal value.=1,...,N: The QZ iteration failed. No eigenvectors have been calculated, butALPHA(j)andBETA(j)should be correct forj=INFO+1,...,N.> N:=N+1: other then QZ iteration failed inCHGEQZ,=N+2: error return fromCTGEVC.
π 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β isCHARACTER*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β isCHARACTER*1= 'N': do not compute the left generalized eigenvectors;= 'V': compute the left generalized eigenvectors.
JOBVRβ isCHARACTER*1= 'N': do not compute the right generalized eigenvectors;= 'V': compute the right generalized eigenvectors.
SENSEβ isCHARACTER*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β isINTEGER. The order of the matricesA,B,VL, andVR.N >= 0.Aβ isCOMPLEX array, dimension(LDA, N). On entry, the matrixAin the pair(A,B). On exit,Ahas been overwritten. IfJOBVL='V'orJOBVR='V'or both, thenAcontains the first part of the complex Schur form of the 'balanced' versions of the inputAandB. She's been through some things πLDAβ isINTEGER. The leading dimension ofA.LDA >= max(1,N).Bβ isCOMPLEX array, dimension(LDB, N). On entry, the matrixBin the pair(A,B). On exit,Bhas been overwritten. IfJOBVL='V'orJOBVR='V'or both, thenBcontains the second part of the complex Schur form of the 'balanced' versions of the inputAandB.LDBβ isINTEGER. The leading dimension ofB.LDB >= max(1,N).ALPHAβ isCOMPLEX array, dimension(N)BETAβ isCOMPLEX array, dimension(N). On exit,ALPHA(j)/BETA(j),j=1,...,N, will be the generalized eigenvalues.
β οΈ Note: the quotientALPHA(j)/BETA(j)may easily over- or underflow, andBETA(j)may even be zero. So please, bestie, do not naively compute the ratioALPHA/BETA. π However,ALPHAwill be always less than and usually comparable withnorm(A)in magnitude, andBETAalways less than and usually comparable withnorm(B). So like, it's fine, it's fine.
VLβ isCOMPLEX array, dimension(LDVL,N). IfJOBVL = 'V', the left generalized eigenvectorsu(j)are stored one after another in the columns ofVL, in the same order as their eigenvalues. Each eigenvector will be scaled so the largest component will haveabs(real part) + abs(imag. part) = 1. Not referenced ifJOBVL = 'N'.LDVLβ isINTEGER. The leading dimension of the matrixVL.LDVL >= 1, and ifJOBVL = 'V',LDVL >= N.VRβ isCOMPLEX array, dimension(LDVR,N). IfJOBVR = 'V', the right generalized eigenvectorsv(j)are stored one after another in the columns ofVR, in the same order as their eigenvalues. Each eigenvector will be scaled so the largest component will haveabs(real part) + abs(imag. part) = 1. Not referenced ifJOBVR = 'N'.LDVRβ isINTEGER. The leading dimension of the matrixVR.LDVR >= 1, and ifJOBVR = 'V',LDVR >= N.ILOβ isINTEGERIHIβ isINTEGER.ILOandIHIare integer values such that on exitA(i,j) = 0andB(i,j) = 0ifi > jandj = 1,...,ILO-1ori = IHI+1,...,N. IfBALANC = 'N'or'S',ILO = 1andIHI = N.LSCALEβ isREAL array, dimension(N). Details of the permutations and scaling factors applied to the left side ofAandB. IfPL(j)is the index of the row interchanged with rowj, andDL(j)is the scaling factor applied to rowj, 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β isREAL array, dimension(N). Details of the permutations and scaling factors applied to the right side ofAandB. IfPR(j)is the index of the column interchanged with columnj, andDR(j)is the scaling factor applied to columnj, 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β isREAL. The one-norm of the balanced matrixA.BBNRMβ isREAL. The one-norm of the balanced matrixB.RCONDEβ isREAL array, dimension(N). IfSENSE = 'E'or'B', the reciprocal condition numbers of the eigenvalues, stored in consecutive elements of the array. IfSENSE = 'N'or'V',RCONDEis not referenced.RCONDVβ isREAL array, dimension(N). IfSENSE = '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 computeRCONDV(j),RCONDV(j)is set to0; this can only occur when the true value would be very small anyway. IfSENSE = 'N'or'E',RCONDVis not referenced.WORKβ isCOMPLEX array, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKβ isINTEGER. The dimension of the arrayWORK.LWORK >= max(1,2*N). IfSENSE = 'E',LWORK >= max(1,4*N). IfSENSE = '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β isREAL array, dimension(lrwork).lrworkmust be at leastmax(1,6*N)ifBALANC = 'S'or'B', and at leastmax(1,2*N)otherwise. Real workspace.IWORKβ isINTEGER array, dimension(N+2). IfSENSE = 'E',IWORKis not referenced.BWORKβ isLOGICAL array, dimension(N). IfSENSE = 'N',BWORKis not referenced.INFOβ isINTEGER= 0: successful exit π< 0: ifINFO = -i, thei-th argument had an illegal value.= 1,...,N: The QZ iteration failed. No eigenvectors have been calculated, butALPHA(j)andBETA(j)should be correct forj=INFO+1,...,N. π> N:=N+1: other than QZ iteration failed inCHGEQZ.=N+2: error return fromCTGEVC.
π 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:
- first, permuting rows and columns to isolate eigenvalues
- 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
- debian bookworm: liblapack-doc 3.11.0-2 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms