TESTING/EIG/cchkst.f(3)
๐ TESTING/EIG/cchkst.f ๐
okay so bestie, this is straight out of the Library Functions Manual (section 3, iykyk) and it's the whole vibe check for cchkst โ the tester that puts every Hermitian eigenvalue routine through its paces. it's long. it's gorgeous. it's giving "trust me, I know what I'm doing" energy. buckle up ๐
tiny heads-up before we start: a couple of words got eaten by the source text (they show up as ??? down there). that's the original being glitchy, not me ๐ everything else is literally exactly what the page says.
โจ NAME โจ
TESTING/EIG/cchkst.f โ that's it, that's the name, no notes ๐
๐ธ SYNOPSIS ๐ธ
Functions/Subroutines ๐ฆ
here's the whole cast list, verbatim, no edits:
subroutine cchkst (nsizes, nn, ntypes, dotype, iseed, thresh, nounit, a,
lda, ap, sd, se, d1, d2, d3, d4, d5, wa1, wa2, wa3, wr, u, ldu, v,
vp, tau, z, work, lwork, rwork, lrwork, iwork, liwork, result, info)
CCHKST
๐ Function/Subroutine Documentation ๐
subroutine cchkst ๐
the full signature, character for character, because we do not play with type declarations in this house:
subroutine cchkst (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( * ) ap, real, dimension( * ) sd, real,
dimension( * ) se, real, dimension( * ) d1, real, dimension( * ) d2,
real, dimension( * ) d3, real, dimension( * ) d4, real, dimension( * )
d5, real, dimension( * ) wa1, real, dimension( * ) wa2, real, dimension(
* ) wa3, real, dimension( * ) wr, complex, dimension( ldu, * ) u,
integer ldu, complex, dimension( ldu, * ) v, complex, dimension( * ) vp,
complex, dimension( * ) tau, complex, dimension( ldu, * ) z, complex,
dimension( * ) work, integer lwork, real, dimension( * ) rwork, integer
lrwork, integer, dimension( * ) iwork, integer liwork, real, dimension(
* ) result, integer info)
CCHKST
CCHKST โ say it with your chest ๐
Purpose ๐
okay so, the main character of the whole page: CCHKST checks the Hermitian eigenvalue problem routines. that's the job. that's the assignment. and it takes it so seriously ๐ค
here's the breakdown of everything it's validating, bestie:
CHETRDfactorsAasU S U*, where*means conjugate transpose,Sis real symmetric tridiagonal, andUis unitary.CHETRDcan use either just the lower or just the upper triangle ofA;CCHKSTchecks both cases. thorough queen behavior ๐Uis represented as a product of Householder transformations, whose vectors are stored in the firstn-1columns ofV, and whose scale factors are inTAU.CHPTRDdoes the same asCHETRD, except thatAandVare stored in ??? format. (there's a missing word there in the original โ not my fault, I promise ๐ญ)CUNGTRconstructs the matrixUfrom the contents ofVandTAU.CUPGTRconstructs the matrixUfrom the contents ofVPandTAU.CSTEQRfactorsSasZ D1 Z*, whereZis the unitary matrix of eigenvectors andD1is a diagonal matrix with the eigenvalues on the diagonal.D2is the matrix of eigenvalues computed whenZis not computed.SSTERFcomputesD3, the matrix of eigenvalues, by the PWK method, which does not yield eigenvectors.CPTEQRfactorsSasZ4 D4 Z4*, for a Hermitian positive definite tridiagonal matrix.D5is the matrix of eigenvalues computed whenZis not computed.SSTEBZcomputes selected eigenvalues.WA1,WA2, andWA3will denote eigenvalues computed to high absolute accuracy, with different range options.WRwill denote eigenvalues computed to high relative accuracy. accuracy is the moment, periodt โจCSTEINcomputesY, the eigenvectors ofS, given the eigenvalues.CSTEDCfactorsSasZ D1 Z*, whereZis the unitary matrix of eigenvectors andD1is a diagonal matrix with the eigenvalues on the diagonal (the'I'option). it may also update an input unitary matrix, usually the output fromCHETRD/CUNGTRorCHPTRD/CUPGTR(the'V'option). it may also just compute eigenvalues (the'N'option). multitasking icon ๐CSTEMRfactorsSasZ D1 Z*, whereZis the unitary matrix of eigenvectors andD1is a diagonal matrix with the eigenvalues on the diagonal (the'I'option).CSTEMRuses the Relatively Robust Representation whenever possible. fancy ๐
so when CCHKST is called, a number of matrix ??? () and a number of matrix ??? are specified. for each size () and each type of matrix, one matrix will be generated and used to test the Hermitian eigenroutines. and for each matrix, a number of tests will be performed. here is the full list, and yes I'm giving you every single one because we don't skip tests in this house ๐ซถ
- (1)
| A - V S V* | / ( |A| n ulp )โCHETRD( UPLO='U', ... ) - (2)
| I - UV* | / ( n ulp )โCUNGTR( UPLO='U', ... ) - (3)
| A - V S V* | / ( |A| n ulp )โCHETRD( UPLO='L', ... ) - (4)
| I - UV* | / ( n ulp )โCUNGTR( UPLO='L', ... ) - (5-8) same as 1-4, but for
CHPTRDandCUPGTR. - (9)
| S - Z D Z* | / ( |S| n ulp )โCSTEQR('V',...) - (10)
| I - ZZ* | / ( n ulp )โCSTEQR('V',...) - (11)
| D1 - D2 | / ( |D1| ulp )โCSTEQR('N',...) - (12)
| D1 - D3 | / ( |D1| ulp )โSSTERF - (13)
0if the true eigenvalues (computed by sturm count) ofSare withinTHRESHof those inD1.2*THRESHif they are not. (tested usingSSTECH)
then, for S positive definite:
- (14)
| S - Z4 D4 Z4* | / ( |S| n ulp )โCPTEQR('V',...) - (15)
| I - Z4 Z4* | / ( n ulp )โCPTEQR('V',...) - (16)
| D4 - D5 | / ( 100 |D4| ulp )โCPTEQR('N',...)
and when S is also diagonally dominant by the factor gamma < 1:
- (17) the max over
iof| D4(i) - WR(i) | / ( |D4(i)| omega ), where:
omega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4
...and this one is SSTEBZ( 'A', 'E', ...) ๐ฅ
- (18)
| WA1 - D3 | / ( |D3| ulp )โSSTEBZ( 'A', 'E', ...) - (19) this absolute unit of a formula, over
SSTEBZ( 'I', 'E', ...):
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
- (20)
| S - Y WA1 Y* | / ( |S| n ulp )โSSTEBZ,CSTEIN - (21)
| I - Y Y* | / ( n ulp )โSSTEBZ,CSTEIN - (22)
| S - Z D Z* | / ( |S| n ulp )โCSTEDC('I') - (23)
| I - ZZ* | / ( n ulp )โCSTEDC('I') - (24)
| S - Z D Z* | / ( |S| n ulp )โCSTEDC('V') - (25)
| I - ZZ* | / ( n ulp )โCSTEDC('V') - (26)
| D1 - D2 | / ( |D1| ulp )โCSTEDC('V')andCSTEDC('N')
test 27 is disabled at the moment because CSTEMR does not guarantee high relatvie accuracy. (yes, "relatvie" โ that's how it's spelled in the source, we love a typo ๐)
- (27) the max over
iof| D6(i) - WR(i) | / ( |D6(i)| omega ), where:
omega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4
...and this one is CSTEMR('V', 'A')
- (28) same deal, max over
iof| D6(i) - WR(i) | / ( |D6(i)| omega ), where:
omega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4
...and this one is CSTEMR('V', 'I')
tests 29 through 34 are disable at present because CSTEMR does not handle partial spectrum requests. ("disable", again, source text, not me ๐)
- (29)
| S - Z D Z* | / ( |S| n ulp )โCSTEMR('V', 'I') - (30)
| I - ZZ* | / ( n ulp )โCSTEMR('V', 'I') - (31) the big one:
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
...being CSTEMR('N', 'I') vs. CSTEMR('V', 'I')
- (32)
| S - Z D Z* | / ( |S| n ulp )โCSTEMR('V', 'V') - (33)
| I - ZZ* | / ( n ulp )โCSTEMR('V', 'V') - (34) and again:
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
...being CSTEMR('N', 'V') vs. CSTEMR('V', 'V')
- (35)
| S - Z D Z* | / ( |S| n ulp )โCSTEMR('V', 'A') - (36)
| I - ZZ* | / ( n ulp )โCSTEMR('V', 'A') - (37) last one, same shape:
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
...being CSTEMR('N', 'A') vs. CSTEMR('V', 'A')
the ??? are specified by an array NN(1:NSIZES); the value of each element NN(j) specifies one size.
the ??? are specified by a logical array DOTYPE( 1:NTYPES ); if DOTYPE(j) is .TRUE., then matrix type ??? will be generated.
currently, the list of possible types is โ and I'm giving you all twenty-one of them, no cuts, no skips, because every one of these is somebody's favorite ๐ :
- (1) The zero matrix.
- (2) The identity matrix.
- (3) A diagonal matrix with evenly spaced entries
1, ..., ULP??? and random signs. (ULP = (first number larger than 1) - 1) - (4) A diagonal matrix with geometrically spaced entries
1, ..., ULP??? and random signs. - (5) A diagonal matrix with ??? entries
1, ULP, ..., ULPand random signs. - (6) Same as (4), but multiplied by
SQRT( overflow threshold ) - (7) Same as (4), but multiplied by
SQRT( underflow threshold ) - (8) A matrix of the form
U* D U, whereUis unitary andDhas evenly spaced entries1, ..., ULPwith random signs on the diagonal. - (9) A matrix of the form
U* D U, whereUis unitary andDhas geometrically spaced entries1, ..., ULPwith random signs on the diagonal. - (10) A matrix of the form
U* D U, whereUis unitary andDhas ??? entries1, ULP,..., ULPwith random signs on the diagonal. - (11) Same as (8), but multiplied by
SQRT( overflow threshold ) - (12) Same as (8), but multiplied by
SQRT( underflow threshold ) - (13) Hermitian matrix with random entries chosen from
(-1,1). - (14) Same as (13), but multiplied by
SQRT( overflow threshold ) - (15) Same as (13), but multiplied by
SQRT( underflow threshold ) - (16) Same as (8), but diagonal elements are all positive.
- (17) Same as (9), but diagonal elements are all positive.
- (18) Same as (10), but diagonal elements are all positive.
- (19) Same as (16), but multiplied by
SQRT( overflow threshold ) - (20) Same as (16), but multiplied by
SQRT( underflow threshold ) - (21) A diagonally dominant tridiagonal matrix with geometrically spaced diagonal entries
1, ..., ULP.
Parameters ๐
NSIZES
NSIZESโINTEGER. How many matrix sizes we're testing, bestie. If it's zero,CCHKSTliterally does nothing (the audacity ๐). Must be at least zero.NNโINTEGER array, dimension (NSIZES). The actual sizes to use for the matrices. Zero values get skipped, no drama. Every value must be at least zero.NTYPESโINTEGER. The number of elements inDOTYPE. If it's zero,CCHKSTdoes nothing. Must be at least zero. โจ Special case alert โจ: if it'sMAXTYP+1andNSIZESis1, then one extra type โMAXTYP+1โ gets defined, and that one just uses whatever matrix is already sitting inA. This is only useful ifDOTYPE(1:MAXTYP)is.FALSE.andDOTYPE(MAXTYP+1)is.TRUE..DOTYPEโLOGICAL array, dimension (NTYPES). IfDOTYPE(j)is.TRUE., then for each size inNNa matrix of that size and of typejgets generated ๐. IfNTYPESis smaller than the maximum number of types defined (PARAMETER MAXTYP), then typesNTYPES+1throughMAXTYPwon't be generated. IfNTYPESis bigger thanMAXTYP, thenDOTYPE(MAXTYP+1)throughDOTYPE(NTYPES)get ignored (rude, but that's the rule).ISEEDโINTEGER array, dimension (4). On entry,ISEEDsets the seed of the random number generator ๐ฒ. The array elements should be between0and4095; if they're not, they get reduced mod4096. AlsoISEED(4)must be odd โ no cap, that's required. The generator uses a linear congruential sequence limited to small integers, so it should produce machine independent random numbers. The values ofISEEDget changed on exit, and you can pass them into the nextCCHKSTcall to keep the same random number sequence going โ continuity queen ๐.THRESHโREAL. A test will count as a failure if the <span> </span>โ ok the source literally has a gap here ๐ญ โ computed as described above, exceedsTHRESH. Note that 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. It must be at least zero.NOUNITโINTEGER. The FORTRAN unit number used for printing out error messages (e.g., if a routine returnsIINFOnot equal to0). So like, where the complaints get filed ๐ฌ.AโCOMPLEXarray ofdimension ( LDA , max(NN) ). Holds the matrix whose eigenvalues are gonna be computed. On exit,Acontains the last matrix actually used โ she remembers where she's been ๐ .LDAโINTEGER. The leading dimension ofA. Must be at least1and at leastmax( NN ).APโCOMPLEXarray ofdimension( max(NN)*max(NN+1)/2 ). The matrixA, but stored in packed format (compact icon behaviour).SDโREALarray ofdimension( max(NN) ). The diagonal of the tridiagonal matrix computed byCHETRD. On exit,SDandSEcontain the tridiagonal form of the matrix inA.SEโREALarray ofdimension( max(NN) ). The off-diagonal of the tridiagonal matrix computed byCHETRD. On exit,SDandSEcontain the tridiagonal form of the matrix inA.D1โREALarray ofdimension( max(NN) ). The eigenvalues ofA, as computed byCSTEQRsimultaneously withZ(multitasking queen). On exit, the eigenvalues inD1correspond with the matrix inA.D2โREALarray ofdimension( max(NN) ). The eigenvalues ofA, as computed byCSTEQRifZis not computed. On exit, the eigenvalues inD2correspond with the matrix inA.D3โREALarray ofdimension( max(NN) ). The eigenvalues ofA, as computed bySSTERF. On exit, the eigenvalues inD3correspond with the matrix inA.D4โREALarray ofdimension( max(NN) ). The eigenvalues ofA, as computed byCPTEQR(V).ZPTEQRfactorsSasZ4 D4 Z4*. On exit, the eigenvalues inD4correspond with the matrix inA.D5โREALarray ofdimension( max(NN) ). The eigenvalues ofA, as computed byZPTEQR(N)whenZis not computed. On exit, the eigenvalues inD4correspond with the matrix inA. (Yes, it saysD4on aD5entry โ that's what the source says, don't come for me ๐.)WA1โREALarray ofdimension( max(NN) ). All eigenvalues ofA, computed to high absolute accuracy, with different range options, as computed bySSTEBZโญ.WA2โREALarray ofdimension( max(NN) ). Selected eigenvalues ofA, computed to high absolute accuracy, with different range options, as computed bySSTEBZ. The move here: pick random values forILandIU, then ask for theIL-th throughIU-th eigenvalues ๐ฏ.WA3โREALarray ofdimension( max(NN) ). Selected eigenvalues ofA, computed to high absolute accuracy, with different range options, as computed bySSTEBZ. The move here: determine the valuesVLandVUof theIL-th andIU-th eigenvalues, then ask for all eigenvalues in that range.WRโDOUBLE PRECISIONarray ofdimension( max(NN) ). All eigenvalues ofA, computed to high absolute accuracy, with different options, as computed byDSTEBZ. (Note the precision glow-up โ this one'sDOUBLE PRECISION, notREAL๐.)UโCOMPLEXarray ofdimension( LDU, max(NN) ). The unitary matrix computed byCHETRD + CUNGTR.LDUโINTEGER. The leading dimension ofU,Z, andVโ one dimension to rule them all ๐. Must be at least1and at leastmax( NN ).VโCOMPLEXarray ofdimension( LDU, max(NN) ). The Householder vectors computed byCHETRDin reducingAto tridiagonal form. The vectors computed withUPLO='U'are in the upper triangle, and the vectors computed withUPLO='L'are in the lower triangle. (As described inCHETRD, the sub- and superdiagonal are not set to1, even though the true Householder vector has a1in that position. The routines that useV, such asCUNGTR, set those entries to1before using them, and then restore them later. Considerate kings ๐ซถ.)VPโCOMPLEXarray ofdimension( max(NN)*max(NN+1)/2 ). The matrixV, stored in packed format.TAUโCOMPLEXarray ofdimension( max(NN) ). The Householder factors computed byCHETRDin reducingAto tridiagonal form.ZโCOMPLEXarray ofdimension( LDU, max(NN) ). The unitary matrix of eigenvectors computed byCSTEQR,CPTEQR, andCSTEIN.WORKโCOMPLEXarray ofdimension( LWORK ).LWORKโINTEGER. The number of entries inWORK. This must be at least
1 + 4 * Nmax + 2 * Nmax * lg Nmax + 3 * Nmax**2
where Nmax = max( NN(j), 2 ) and lg = log base 2. Do the math, bestie, don't skip the math ๐งฎ.
IWORKโINTEGER array. Workspace. That's it. That's the whole description ๐.LIWORKโINTEGER. The number of entries inIWORK. This must be at least
6 + 6*Nmax + 5 * Nmax * lg Nmax
where Nmax = max( NN(j), 2 ) and lg = log base 2.
RWORKโREAL array. (Yes, literally just that. No dimension note, no nothing. Iconic minimalism ๐ธ.)LRWORKโINTEGER. The number of entries inLRWORKโdimension( ??? ). The source really wrote???there and honestly? Mood. ๐ฆRESULTโREAL array, dimension (26). The values computed by the tests described above. Those values are currently limited to1/ulp, to avoid overflow โ safety first, no overflow parties allowed ๐ซ๐ฅ.INFOโ hold that thought, the deets on this one are dropping in the next chunk โจ (no spoilers, iykyk).
Okay so INFO is an INTEGER, bestie โ hereโs the whole tea โ๐
If it comes back as 0, then everything ran OK. Slay.
-1โNSIZES < 0-2โ SomeNN(j) < 0-3โNTYPES < 0-5โTHRESH < 0-9โLDA < 1orLDA < NMAX, whereNMAXismax( NN(j) ).-23โLDU < 1orLDU < NMAX.-29โLWORKtoo small.
And if CLATMR, CLATMS, CHETRD, CUNGTR, CSTEQR, SSTERF, or CUNMC2 returns an error code, the absolute value of it is returned. Thatโs the rule, periodt ๐
โจ Some Local Variables and Parameters โจ
ZERO,ONEโ Real0and1.MAXTYPโ The number of types defined.NTESTโ The number of tests performed, or which can be performed so far, for the current matrix.NTESTTโ The total number of tests performed so far.NBLOCKโ Blocksize as returned byENVIR.NMAXโ Largest value inNN.NMATSโ The number of matrices generated so far.NERRSโ The number of tests which have exceededTHRESHso far.COND,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โ Square roots of the previous 2 values.
The following four arrays decode JTYPE:
KTYPE(j)โ The general type (1-10) for type .KMODE(j)โ The MODE value to be passed to the matrix generator for type .KMAGN(j)โ The order of magnitude (O(1),O(overflow^(1/2) ),O(underflow^(1/2) ))
โ๏ธ Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Definition at line 599 of file cchkst.f.
๐ค Author
Generated automatically by Doxygen for LAPACK from the source code.
Okay bye bestie โ this footer is giving LAPACK Version 3.12.0, page TESTING/EIG/cchkst.f(3) ๐โจ (no date in this footer, so Iโm not inventing one ๐๐)
๐ฆ 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