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 β€” JOBVS is CHARACTER*1
    • = 'N': Schur vectors are not computed;
    • = 'V': Schur vectors are computed.
  • SORT β€” SORT is CHARACTER*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 (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. main character function energy, honestly 🌟
  • N β€” N is INTEGER. it's the order of the matrix A. N >= 0. (zero is allowed, she's valid.)
  • 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. so like… she's been through something. that's her now. πŸ’€
  • 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. keeping the order, keeping the aesthetic πŸ’…
  • 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. she reports back, she's thoughtful like that πŸŽ€
  • 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. sneaky little query mode, love that for us ✨
  • RWORK β€” RWORK is REAL array, dimension (N). that's it. that's the whole description. she's just chilling. 🌸
  • BWORK β€” BWORK is LOGICAL array, dimension (N). not referenced if SORT = 'N'.
  • INFO β€” INFO is INTEGER, and this is the 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 matrix which reduces A to 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 satisfy SELECT = .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