SRC/cgees.f(3)
SRC/cgees.f π β¨
okay so this is a page from the Library Functions Manual (yes, the actual manual name, bestie, we're fancy), and it's all about one little subroutine that is genuinely doing the most. let's get into it π«Ά
πΈ NAME πΈ
SRC/cgees.f β the file itself, the whole vibe, the source of the legend.
π SYNOPSIS π
Functions/Subroutines
subroutine cgees (jobvs, sort, select, n, a, lda, sdim, w, vs, ldvs, work, lwork, rwork, bwork, info)β 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)
CGEES computes the eigenvalues, the Schur form, and, optionally,
the matrix of Schur vectors for GE matrices
π₯ Function/Subroutine Documentation π₯
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 β¨
bestie. listen. here's the whole point:
CGEES computes, for an N-by-N complex nonsymmetric matrix A, the eigenvalues, the Schur form T, and, optionally, the matrix of Schur vectors Z. this gives the Schur factorization A = Z*T*(Z**H). iconic behavior, honestly π
optionally, it also orders the eigenvalues on the diagonal of the Schur form so that selected eigenvalues are at the top left. and then the leading columns of Z form an orthonormal basis for the invariant subspace corresponding to the selected eigenvalues. the way that just works?? π
and for the record: a complex matrix is in Schur form if it is upper triangular. that's the rule, no cap. π
π Parameters π
JOBVSβJOBVSisCHARACTER*1= 'N': Schur vectors are not computed;= 'V': Schur vectors are computed.
SORTβSORTisCHARACTER*1, and it 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βSELECTis aLOGICAL FUNCTIONof oneCOMPLEXargument.SELECTmust be declaredEXTERNALin the calling subroutine. ifSORT = 'S',SELECTis used to select eigenvalues to order to the top left of the Schur form. IFSORT = 'N',SELECTis not referenced. the eigenvalueW(j)is selected ifSELECT(W(j))is true. main character function energy, honestly πNβNisINTEGER. it's the order of the matrixA.N >= 0. (zero is allowed, she's valid.)AβAisCOMPLEX array, dimension (LDA,N). on entry, the N-by-N matrixA. on exit,Ahas been overwritten by its Schur formT. so likeβ¦ she's been through something. that's her now. πLDAβLDAisINTEGER. the leading dimension of the arrayA.LDA >= max(1,N).SDIMβSDIMisINTEGER.- If
SORT = 'N',SDIM = 0. - If
SORT = 'S',SDIM = number of eigenvalues for which SELECT is true.
- If
WβWisCOMPLEX array, dimension (N).Wcontains the computed eigenvalues, in the same order that they appear on the diagonal of the output Schur formT. keeping the order, keeping the aesthetic πVSβVSisCOMPLEX array, dimension (LDVS,N).- If
JOBVS = 'V',VScontains the unitary matrixZof Schur vectors. - If
JOBVS = 'N',VSis not referenced.
- If
LDVSβLDVSisINTEGER. the leading dimension of the arrayVS.LDVS >= 1; ifJOBVS = 'V',LDVS >= N.WORKβWORKisCOMPLEX array, dimension (MAX(1,LWORK)). on exit, ifINFO = 0,WORK(1)returns the optimalLWORK. she reports back, she's thoughtful like that πLWORKβLWORKisINTEGER. 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. sneaky little query mode, love that for us β¨
RWORKβRWORKisREAL array, dimension (N). that's it. that's the whole description. she's just chilling. πΈBWORKβBWORKisLOGICAL array, dimension (N). not referenced ifSORT = 'N'.INFOβINFOisINTEGER, and this is the vibe check:= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = i, and i is:<= 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. (partially converged is still progress, okay π)= 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.
fr fr, read the INFO codes carefully β they're telling you exactly what went sideways and you do NOT want to guess. π₯
π Author π
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Definition at line 195 of file cgees.f.
π¦ sign-off π¦
generated automatically by Doxygen for LAPACK from the source code (yes, the robots wrote the credits, we just made them cute). this gorgeous little page is from LAPACK, Version 3.12.0, and it lives at SRC/cgees.f(3). slay, go compute something. πβ¨π
π¦ where this page comes from
- arch rolling: lapack-doc 3.12.1-2 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms