TESTING/EIG/cchkhs.f(3)
π TESTING/EIG/cchkhs.f π
bestie, this is the TESTING/EIG/cchkhs.f(3) page from the Library Functions Manual, and the file is literally TESTING/EIG/cchkhs.f β itβs giving main-character Fortran test-driver energy, and we are keeping every single detail. π¦β¨
πΈ NAME πΈ
TESTING/EIG/cchkhs.f
β¨ SYNOPSIS β¨
π Functions/Subroutines π
subroutine cchkhs (nsizes, nn, ntypes, dotype, iseed, thresh, nounit, a, lda, h, t1, t2, u, ldu, z, uz, w1, w3, evectl, evectr, evecty, evectx, uu, tau, work, nwork, rwork, iwork, select, result, info)β this isCCHKHS, the whole vibe-check harness. π
π Function/Subroutine Documentation π
π subroutine cchkhs π
subroutine cchkhs (integer nsizes, integer, dimension( * ) nn, integer
ntypes, logical, dimension( * ) dotype, integer, dimension( 4 ) iseed,
real thresh, integer nounit, complex, dimension( lda, * ) a, integer
lda, complex, dimension( lda, * ) h, complex, dimension( lda, * ) t1,
complex, dimension( lda, * ) t2, complex, dimension( ldu, * ) u, integer
ldu, complex, dimension( ldu, * ) z, complex, dimension( ldu, * ) uz,
complex, dimension( * ) w1, complex, dimension( * ) w3, complex,
dimension( ldu, * ) evectl, complex, dimension( ldu, * ) evectr,
complex, dimension( ldu, * ) evecty, complex, dimension( ldu, * )
evectx, complex, dimension( ldu, * ) uu, complex, dimension( * ) tau,
complex, dimension( * ) work, integer nwork, real, dimension( * ) rwork,
integer, dimension( * ) iwork, logical, dimension( * ) select, real,
dimension( 16 ) result, integer info)
π CCHKHS π
π₯ Purpose π₯
okay so CCHKHS checks the nonsymmetric eigenvalue problem routines, and the friend-group rundown is iconic:
CGEHRDfactorsAasU H U', where'means conjugate transpose,His hessenberg, andUis unitary. πCUNGHRgenerates the unitary matrixU.CUNMHRmultiplies a matrix by the unitary matrixU.CHSEQRfactorsHasZ T Z', whereZis unitary andTis upper triangular. It also computes the eigenvalues,w(1), ..., w(n); we define a diagonal matrixWwhose (diagonal) entries are the eigenvalues. πCTREVCcomputes the left eigenvector matrixLand the right eigenvector matrixRfor the matrixT. The columns ofLare the complex conjugates of the left eigenvectors ofT. The columns ofRare the right eigenvectors ofT.Lis lower triangular, andRis upper triangular. πΈCHSEINcomputes the left eigenvector matrixYand the right eigenvector matrixXfor the matrixH. The columns ofYare the complex conjugates of the left eigenvectors ofH. The columns ofXare the right eigenvectors ofH.Yis lower triangular, andXis upper triangular. β¨CTREVC3computes left and right eigenvector matrices from a Schur matrixTand backtransforms them withZto eigenvector matricesLandRforA.LandRare GE matrices. π
When CCHKHS is called, a number of matrix sizes and a number of matrix types are specified. For each size and each type of matrix, one matrix will be generated and used to test the nonsymmetric eigenroutines. For each matrix, 16 tests will be performed:
(1) | A - U H U**H | / ( |A| n ulp )
(2) | I - UU**H | / ( n ulp )
(3) | H - Z T Z**H | / ( |H| n ulp )
(4) | I - ZZ**H | / ( n ulp )
(5) | A - UZ H (UZ)**H | / ( |A| n ulp )
(6) | I - UZ (UZ)**H | / ( n ulp )
(7) | T(Z computed) - T(Z not computed) | / ( |T| ulp )
(8) | W(Z computed) - W(Z not computed) | / ( |W| ulp )
(9) | TR - RW | / ( |T| |R| ulp )
(10) | L**H T - W**H L | / ( |T| |L| ulp )
(11) | HX - XW | / ( |H| |X| ulp )
(12) | Y**H H - W**H Y | / ( |H| |Y| ulp )
(13) | AX - XW | / ( |A| |X| ulp )
(14) | Y**H A - W**H Y | / ( |A| |Y| ulp )
(15) | AR - RW | / ( |A| |R| ulp )
(16) | LA - WL | / ( |A| |L| ulp )
The sizes are specified by an array NN(1:NSIZES); the value of each element NN(j) specifies one size. The types are specified by a logical array DOTYPE( 1:NTYPES ); if DOTYPE(j) is .TRUE., then matrix type j will be generated. Currently, the list of possible types is:
- The zero matrix. π«₯
- The identity matrix. π
- A (transposed) Jordan block, with
1's on the diagonal. - A diagonal matrix with evenly spaced entries
1, ..., ULPand random complex angles. (ULP = (first number larger than 1) - 1) π - A diagonal matrix with geometrically spaced entries
1, ..., ULPand random complex angles. π¦ - A diagonal matrix with entries
1, ULP, ..., ULPand random complex angles. β¨ - Same as (4), but multiplied by
SQRT( overflow threshold ). - Same as (4), but multiplied by
SQRT( underflow threshold ). - A matrix of the form
U' T U, whereUis unitary andThas evenly spaced entries1, ..., ULPwith random complex angles on the diagonal and randomO(1)entries in the upper triangle. π« - A matrix of the form
U' T U, whereUis unitary andThas geometrically spaced entries1, ..., ULPwith random complex angles on the diagonal and randomO(1)entries in the upper triangle. π - A matrix of the form
U' T U, whereUis unitary andThas entries1, ULP,..., ULPwith random complex angles on the diagonal and randomO(1)entries in the upper triangle. π - A matrix of the form
U' T U, whereUis unitary andThas complex eigenvalues randomly chosen fromULP < |z| < 1and randomO(1)entries in the upper triangle. π₯ - A matrix of the form
X' T X, whereXhas conditionSQRT( ULP )andThas evenly spaced entries1, ..., ULPwith random complex angles on the diagonal and randomO(1)entries in the upper triangle. π - A matrix of the form
X' T X, whereXhas conditionSQRT( ULP )andThas geometrically spaced entries1, ..., ULPwith random complex angles on the diagonal and randomO(1)entries in the upper triangle. π§ - A matrix of the form
X' T X, whereXhas conditionSQRT( ULP )andThas entries1, ULP,..., ULPwith random complex angles on the diagonal and randomO(1)entries in the upper triangle. π - A matrix of the form
X' T X, whereXhas conditionSQRT( ULP )andThas complex eigenvalues randomly chosen fromULP < |z| < 1and randomO(1)entries in the upper triangle. π - Same as (16), but multiplied by
SQRT( overflow threshold ). - Same as (16), but multiplied by
SQRT( underflow threshold ). - Nonsymmetric matrix with random entries chosen from
|z| < 1. π - Same as (19), but multiplied by
SQRT( overflow threshold ). - Same as (19), but multiplied by
SQRT( underflow threshold ). π
NSIZESβINTEGER. bestie this is literally "how many matrix sizes are we testing today." If it's zero,CCHKHSdoes nothing (naps, periodt). Must be at least zero. Not modified. π«ΆNNβINTEGER array, dimension (NSIZES). the actual sizes for the matrices, like a lil' lineup. Zero values get skipped entirely (they're not invited π ). All values must be at least zero. Not modified.NTYPESβINTEGER. how many elements live inDOTYPE. If it's zero, again:CCHKHSdoes nothing. Must be at least zero. ok now the spicy part π₯ β if it equalsMAXTYP+1andNSIZESis 1, then an extra type,MAXTYP+1, gets defined, which means "just use whatever matrix is already inA." That's only useful whenDOTYPE(1:MAXTYP)is.FALSE.andDOTYPE(MAXTYP+1)is.TRUE.. Not modified.DOTYPEβLOGICAL array, dimension (NTYPES). the guest list π ifDOTYPE(j)is.TRUE., then for every size inNNa matrix of that size and of typejgets generated. IfNTYPESis smaller than the max number of types defined (PARAMETER MAXTYP), then typesNTYPES+1throughMAXTYPwill not be generated. IfNTYPESis bigger thanMAXTYP, thenDOTYPE(MAXTYP+1)throughDOTYPE(NTYPES)are just ignored (left on read π). Not modified.ISEEDβINTEGER array, dimension (4). on entry this specifies the seed of the random number generator π±. the elements should be between0and4095β if not, they get reduced mod4096. AlsoISEED(4)must be odd, no exceptions. The generator uses a linear congruential sequence limited to small integers, so it should produce machine independent random numbers (iconic behaviour honestly β¨). The values ofISEEDare changed on exit, and you can pass them into the next call toCCHKHSto continue the exact same random number sequence. Modified.THRESHβREAL. a test counts as [an error] if the [ratio], computed as described above, exceedsTHRESH. heads up π¨ the error is scaled to beO(1), soTHRESHshould be a reasonably small multiple of 1 β like10or100. In particular it should not depend on the precision (single vs. double) or the size of the matrix. Must be at least zero. Not modified.NOUNITβINTEGER. the FORTRAN unit number used for printing out error messages (like, say, if a routine returnsIINFOnot equal to0). Not modified.AβCOMPLEX array, dimension (LDA,max(NN)). holds the matrix whose eigenvalues are gonna be computed π. On exit,Acontains the last matrix actually used. Modified.LDAβINTEGER. the leading dimension ofA,H,T1andT2. It must be at least1, and at leastmax( NN ). Not modified.HβCOMPLEX array, dimension (LDA,max(NN)). the upper hessenberg matrix computed byCGEHRDπ¦. On exit,Hcontains the Hessenberg form of the matrix inA. Modified.T1βCOMPLEX array, dimension (LDA,max(NN)). the Schur (=) matrix computed byCHSEQRifZis computed. On exit,T1contains the Schur form of the matrix inA. Modified.T2βCOMPLEX array, dimension (LDA,max(NN)). the Schur matrix computed byCHSEQRwhenZis not computed. This should be identical toT1β like, that's the whole point, bestie π. Modified.LDUβINTEGER. the leading dimension ofU,Z,UZandUU. Must be at least1, and at leastmax( NN ). Not modified.UβCOMPLEX array, dimension (LDU,max(NN)). the unitary matrix computed byCGEHRD. Modified.ZβCOMPLEX array, dimension (LDU,max(NN)). the unitary matrix computed byCHSEQR. Modified.UZβCOMPLEX array, dimension (LDU,max(NN)). the product ofUtimesZ. Modified.W1βCOMPLEX array, dimension (max(NN)). the eigenvalues ofA, as computed by a full Schur decompositionH = Z T Z'. On exit,W1contains the eigenvalues of the matrix inA. Modified.W3βCOMPLEX array, dimension (max(NN)). the eigenvalues ofA, as computed by a partial Schur decomposition (Znot computed,Tonly computed as much as is necessary for determining eigenvalues). On exit,W3contains the eigenvalues of the matrix inA, possibly perturbed byCHSEINπ« . Modified.EVECTLβCOMPLEX array, dimension (LDU,max(NN)). the conjugate transpose of the (upper triangular) left eigenvector matrix for the matrix inT1. Modified.EVECTRβCOMPLEX array, dimension (LDU,max(NN)). the (upper triangular) right eigenvector matrix for the matrix inT1. Modified.EVECTYβCOMPLEX array, dimension (LDU,max(NN)). the conjugate transpose of the left eigenvector matrix for the matrix inH. Modified.EVECTXβCOMPLEX array, dimension (LDU,max(NN)). the right eigenvector matrix for the matrix inH. Modified.UUβCOMPLEX array, dimension (LDU,max(NN)). the deets of the unitary matrix computed byCGEHRD. Modified.TAUβCOMPLEX array, dimension (max(NN)). further deets of the unitary matrix computed byCGEHRDβ¨. Modified.WORKβCOMPLEX array, dimension (NWORK). workspace, the humble king π. Modified.NWORKβINTEGER. the number of entries inWORK. Constraint:NWORK >= 4*NN(j)*NN(j) + 2.RWORKβREAL array, dimension (max(NN)). workspace. Could be equivalenced toIWORK, but notSELECTβ οΈ. Modified.IWORKβINTEGER array, dimension (max(NN)). workspace. Modified.SELECTβLOGICAL array, dimension (max(NN)). workspace. Could be equivalenced toIWORK, but notRWORKβ οΈ. Modified.RESULTβREAL array, dimension (16). the values computed by the fourteen tests described above. These values are currently limited to1/ulp, specifically to avoid overflow π. Modified.INFOβINTEGER. if0, then everything ran OK, we love a flawless run π. Otherwise:-1:NSIZES < 0-2: SomeNN(j) < 0-3:NTYPES < 0-6:THRESH < 0-9:LDA < 1orLDA < NMAX, whereNMAXismax( NN(j) ).-14:LDU < 1orLDU < NMAX.-26:NWORKtoo small.
If CLATMR, CLATMS, or CLATME returns an error code, the absolute value of it is returned.
If 1, then CHSEQR could not find all the shifts π¬.
If 2, then the EISPACK code (for small blocks) failed.
If >2, then 30*N iterations were not enough to find an eigenvalue or to decompose the problem π.
Modified.
π« Some Local Variables and Parameters
ok so these aren't arguments but you're gonna see them floating around and I refuse to let you be confused:
ZERO,ONEβ real0and1. that's it. that's the tea.MAXTYPβ the number of types defined.MTESTβ the number of tests defined. care must be taken that (1) the size ofRESULT, (2) the number of tests actually performed, and (3)MTESTall agree. like, they have to match, no cap π€.NTESTβ the number of tests performed on this matrix so far. This should be less thanMTEST, and equal to it by the last test. It'll be less if any of the routines being tested indicates that it couldn't compute the matrices that would be tested.NMAXβ largest value inNN.NMATSβ the number of matrices generated so far.NERRSβ the number of tests which have exceededTHRESHso far (computed bySLAFTS).COND,CONDS,IMODEβ values to be passed to the matrix generators.ANORMβ norm ofA; passed to matrix generators.OVFL,UNFLβ overflow and underflow thresholds.ULP,ULPINVβ finest relative precision and its inverse.RTOVFL,RTUNFL,RTULP,RTULPIβ square roots of the previous 4 values.
and then these four arrays decode JTYPE π΅οΈββοΈ:
KTYPE(j)β the general type (1-10) for type [j].KMODE(j)β theMODEvalue to be passed to the matrix generator for type [j].KMAGN(j)β the order of magnitude (O(1),O(overflow^(1/2)),O(underflow^(1/2)))KCONDS(j)β selects whetherCONDSis to be1or1/sqrt(ulp). (0means irrelevant.)
π Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Definition at line 416 of file cchkhs.f. β
β¨ AUTHOR β¨
Okay bestie, the Author section is giving auto-generated realness: the line literally says Generated automatically by Doxygen for LAPACK from the source code. So no mysterious author to stan here β Doxygen made this page for LAPACK straight from the source code, periodt. π
β¨
And that's a wrap, fr fr. The footer does the cute source/version/date sign-off with LAPACK Version 3.12.0 and the page path TESTING/EIG/cchkhs.f(3) β icon behavior only. ππ¦π«Ά
π¦ 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