CCHKST2STG(3)
πΈ TESTING/EIG/cchkst2stg.f β Library Functions Manual πΈ
okay so bestie, this page is for TESTING/EIG/cchkst2stg.f, the manual-page title is TESTING/EIG/cchkst2stg.f(3), and the manual name is Library Functions Manual. we're in the right place, no cap. π¦
π NAME π
TESTING/EIG/cchkst2stg.f
that's the name. periodt. β¨
π SYNOPSIS π
Functions/Subroutines
subroutine cchkst2stg (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)
CCHKST2STG
π Function/Subroutine Documentation π
subroutine cchkst2stg (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)
CCHKST2STG
π― Purpose: π―
okay so what is CCHKST2STG actually doing all day?? bestie, it's the vibe check for the Hermitian eigenvalue problem routines, but specifically the ones using the 2-stage reduction techniques β¨.
Real talk before we go any further though: since generating Q (or the vectors at all, honestly) isn't available in this release, we can't do the full vector comparison. So we only compare the eigenvalue results from the 2-stage path against the ones we trust as reference β the ones from the standard 1-stage reduction CHETRD. Here's the whole plan, no cap: we call the standard CHETRD and compute D1 using DSTEQR, then we call the 2-stage CHETRD_2STAGE with Upper and Lower, and we compute D2 and D3 using DSTEQR, and then we replaced tests 3 and 4 by tests 11 and 12. Tests 1 and 2 stay right where they are so we can verify the 1-stage results are OK and can be trusted π«Ά.
this testing routine will converge to theCCHKSTin the next release when vectors and generation ofQwill be implemented. iykyk π
here's the cast of characters, and yes they all ate π
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;CCHKST2STGchecks both cases.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 packed format.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.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).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.
so when it gets calledβ¦ π
When CCHKST2STG 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 Hermitian eigenroutines. For each matrix, a number of tests will be performed π
- Test 1 β
| A - V S V* | / ( |A| n ulp )viaCHETRD( UPLO='U', ... ) - Test 2 β
| I - UV* | / ( n ulp )viaCUNGTR( UPLO='U', ... ) - Test 3 β
| A - V S V* | / ( |A| n ulp )viaCHETRD( UPLO='L', ... ), replaced by| D1 - D2 | / ( |D1| ulp )whereD1is the eigenvalue matrix computed usingSandD2is the eigenvalue matrix computed usingS_2stage, the output ofCHETRD_2STAGE(, ,....).D1andD2are computed viaDSTEQR('N',...) - Test 4 β
| I - UV* | / ( n ulp )viaCUNGTR( UPLO='L', ... ), replaced by| D1 - D3 | / ( |D1| ulp )whereD1is the eigenvalue matrix computed usingSandD3is the eigenvalue matrix computed usingS_2stage, the output ofCHETRD_2STAGE(, ,....).D1andD3are computed viaDSTEQR('N',...) - Tests 5-8 β same as 1-4, but for
CHPTRDandCUPGTR. - Test 9 β
| S - Z D Z* | / ( |S| n ulp )viaCSTEQR('V',...) - Test 10 β
| I - ZZ* | / ( n ulp )viaCSTEQR('V',...) - Test 11 β
| D1 - D2 | / ( |D1| ulp )viaCSTEQR('N',...) - Test 12 β
| D1 - D3 | / ( |D1| ulp )viaSSTERF - Test 13 β
0if the true eigenvalues (computed by sturm count) ofSare withinTHRESHof those inD1.2*THRESHif they are not. (Tested usingSSTECH)
for S positive definite π¦
- Test 14 β
| S - Z4 D4 Z4* | / ( |S| n ulp )viaCPTEQR('V',...) - Test 15 β
| I - Z4 Z4* | / ( n ulp )viaCPTEQR('V',...) - Test 16 β
| D4 - D5 | / ( 100 |D4| ulp )viaCPTEQR('N',...)
when S is also diagonally dominant by the factor gamma < 1 πΈ
- Test 17 β
max | D4(i) - WR(i) | / ( |D4(i)| omega )overi, whereomega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4, viaSSTEBZ( 'A', 'E', ...) - Test 18 β
| WA1 - D3 | / ( |D3| ulp )viaSSTEBZ( 'A', 'E', ...) - Test 19 β
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
via SSTEBZ( 'I', 'E', ...)
- Test 20 β
| S - Y WA1 Y* | / ( |S| n ulp )viaSSTEBZ,CSTEIN - Test 21 β
| I - Y Y* | / ( n ulp )viaSSTEBZ,CSTEIN - Test 22 β
| S - Z D Z* | / ( |S| n ulp )viaCSTEDC('I') - Test 23 β
| I - ZZ* | / ( n ulp )viaCSTEDC('I') - Test 24 β
| S - Z D Z* | / ( |S| n ulp )viaCSTEDC('V') - Test 25 β
| I - ZZ* | / ( n ulp )viaCSTEDC('V') - Test 26 β
| D1 - D2 | / ( |D1| ulp )viaCSTEDC('V')andCSTEDC('N')
okay so test 27 is disabled at the moment because CSTEMR does not guarantee high relative accuracy π don't come for me, it's literally in the source.
- Test 27 β
max | D6(i) - WR(i) | / ( |D6(i)| omega )overi, whereomega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4, viaCSTEMR('V', 'A') - Test 28 β
max | D6(i) - WR(i) | / ( |D6(i)| omega )overi, whereomega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4, viaCSTEMR('V', 'I')
and tests 29 through 34 are disabled at present too, because CSTEMR does not handle partial spectrum requests π
- Test 29 β
| S - Z D Z* | / ( |S| n ulp )viaCSTEMR('V', 'I') - Test 30 β
| I - ZZ* | / ( n ulp )viaCSTEMR('V', 'I') - Test 31 β
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
CSTEMR('N', 'I') vs. CSTEMR('V', 'I')
- Test 32 β
| S - Z D Z* | / ( |S| n ulp )viaCSTEMR('V', 'V') - Test 33 β
| I - ZZ* | / ( n ulp )viaCSTEMR('V', 'V') - Test 34 β
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
CSTEMR('N', 'V') vs. CSTEMR('V', 'V')
- Test 35 β
| S - Z D Z* | / ( |S| n ulp )viaCSTEMR('V', 'A') - Test 36 β
| I - ZZ* | / ( n ulp )viaCSTEMR('V', 'A') - Test 37 β
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
CSTEMR('N', 'A') vs. CSTEMR('V', 'A')
the sizes and the types π§
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 diagonal matrix with evenly spaced entries
1, ..., ULPand random signs. (ULP = (first number larger than 1) - 1) - A diagonal matrix with geometrically spaced entries
1, ..., ULPand random signs. - A diagonal matrix with entries
1, ULP, ..., ULPand random signs. - Same as (4), but multiplied by
SQRT( overflow threshold ) - Same as (4), but multiplied by
SQRT( underflow threshold ) - A matrix of the form
U* D U, whereUis unitary andDhas evenly spaced entries1, ..., ULPwith random signs on the diagonal. - A matrix of the form
U* D U, whereUis unitary andDhas geometrically spaced entries1, ..., ULPwith random signs on the diagonal. - A matrix of the form
U* D U, whereUis unitary andDhas entries1, ULP,..., ULPwith random signs on the diagonal. - Same as (8), but multiplied by
SQRT( overflow threshold ) - Same as (8), but multiplied by
SQRT( underflow threshold ) - Hermitian matrix with random entries chosen from
(-1,1). - Same as (13), but multiplied by
SQRT( overflow threshold ) - Same as (13), but multiplied by
SQRT( underflow threshold ) - Same as (8), but diagonal elements are all positive.
- Same as (9), but diagonal elements are all positive.
- Same as (10), but diagonal elements are all positive.
- Same as (16), but multiplied by
SQRT( overflow threshold ) - Same as (16), but multiplied by
SQRT( underflow threshold ) - A diagonally dominant tridiagonal matrix with geometrically spaced diagonal entries
1, ..., ULP.
π Parameters π
NSIZESβINTEGERThe number of sizes of matrices to use. If it's zero,CCHKST2STGliterally does nothing (iconic king of "no thoughts, head empty"). It must be at least zero.NNβINTEGERarray, dimension(NSIZES)An array holding all the sizes you want the matrices to be. Zero values get skipped. The values must be at least zero.NTYPESβINTEGERThe number of elements inDOTYPE. If it's zero,CCHKST2STGdoes nothing. It must be at least zero. And here's the spicy bit: if it equalsMAXTYP+1andNSIZESis1, then one extra type βMAXTYP+1β gets defined, and that type means "just use whatever matrix is already sitting inA". This is only useful ifDOTYPE(1:MAXTYP)is.FALSE.andDOTYPE(MAXTYP+1)is.TRUE.π«ΆDOTYPEβLOGICALarray, 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+1throughMAXTYPwill not be generated. IfNTYPESis bigger thanMAXTYP, thenDOTYPE(MAXTYP+1)throughDOTYPE(NTYPES)are just ignored, no cap.ISEEDβINTEGERarray, dimension(4)On entry,ISEEDspecifies 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 (non-negotiable, it's the vibe check). The random number generator uses a linear congruential sequence limited to small integers, so it should produce machine independent random numbers. The values ofISEEDchange on exit, and you can reuse them in the next call toCCHKST2STGto continue the same random number sequence. β¨THRESHβREALA test will count as β£ if the β£, computed as described above, exceedsTHRESH. (Yeah bestie, the original text literally has words missing there β not me, I promise π.) Note that the error is scaled to beO(1), soTHRESHshould be a reasonably small multiple of1, e.g.,10or100. 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βINTEGERThe FORTRAN unit number for printing out error messages (like if a routine returnsIINFOnot equal to0).AβCOMPLEXarray of
dimension ( LDA , max(NN) )
Used to hold the matrix whose eigenvalues are to be computed. On exit, A contains the last matrix actually used.
LDAβINTEGERThe leading dimension ofA. It must be at least1and at leastmax( NN ).APβCOMPLEXarray of
dimension( max(NN)*max(NN+1)/2 )
The matrix A stored in packed format.
SDβREALarray of
dimension( max(NN) )
The diagonal of the tridiagonal matrix computed by CHETRD. On exit, SD and SE contain the tridiagonal form of the matrix in A.
SEβREALarray of
dimension( max(NN) )
The off-diagonal of the tridiagonal matrix computed by CHETRD. On exit, SD and SE contain the tridiagonal form of the matrix in A.
D1βREALarray of
dimension( max(NN) )
The eigenvalues of A, as computed by CSTEQR simultaneously with Z. On exit, the eigenvalues in D1 correspond with the matrix in A.
D2βREALarray of
dimension( max(NN) )
The eigenvalues of A, as computed by CSTEQR if Z is not computed. On exit, the eigenvalues in D2 correspond with the matrix in A.
D3βREALarray of
dimension( max(NN) )
The eigenvalues of A, as computed by SSTERF. On exit, the eigenvalues in D3 correspond with the matrix in A.
D4βREALarray of
dimension( max(NN) )
The eigenvalues of A, as computed by CPTEQR(V). CPTEQR factors S as Z4 D4 Z4*. On exit, the eigenvalues in D4 correspond with the matrix in A.
D5βREALarray of
dimension( max(NN) )
The eigenvalues of A, as computed by CPTEQR(N) when Z is not computed. On exit, the eigenvalues in D4 correspond with the matrix in A. (Yes, it says D4 in the D5 description β that's genuinely what the source says, I'm not making it up π.)
WA1βREALarray of
dimension( max(NN) )
All eigenvalues of A, computed to high absolute accuracy, with different range options, as computed by SSTEBZ.
WA2βREALarray of
dimension( max(NN) )
Selected eigenvalues of A, computed to high absolute accuracy, with different range options, as computed by SSTEBZ. Choose random values for IL and IU, and ask for the IL-th through IU-th eigenvalues.
WA3βREALarray of
dimension( max(NN) )
Selected eigenvalues of A, computed to high absolute accuracy, with different range options, as computed by SSTEBZ. Determine the values VL and VU of the IL-th and IU-th eigenvalues and ask for all eigenvalues in this range.
WRβREALarray of
dimension( max(NN) )
All eigenvalues of A, computed to high absolute accuracy, with different options, as computed by SSTEBZ.
UβCOMPLEXarray of
dimension( LDU, max(NN) ).
The unitary matrix computed by CHETRD + CUNGTR.
LDUβINTEGERThe leading dimension ofU,Z, andV. It must be at least1and at leastmax( NN ).VβCOMPLEXarray of
dimension( LDU, max(NN) ).
The Householder vectors computed by CHETRD in reducing A to tridiagonal form. The vectors computed with UPLO='U' are in the upper triangle, and the vectors computed with UPLO='L' are in the lower triangle. (As described in CHETRD, the sub- and superdiagonal are not set to 1, even though the true Householder vector has a 1 in that position. The routines that use V, such as CUNGTR, set those entries to 1 before using them, and then restore them later. Respect the restore, king π«‘.)
VPβCOMPLEXarray of
dimension( max(NN)*max(NN+1)/2 )
The matrix V stored in packed format.
TAUβCOMPLEXarray of
dimension( max(NN) )
The Householder factors computed by CHETRD in reducing A to tridiagonal form.
ZβCOMPLEXarray of
dimension( LDU, max(NN) ).
The unitary matrix of eigenvectors computed by CSTEQR, CPTEQR, and CSTEIN.
WORKβCOMPLEXarray of
dimension( LWORK )
LWORKβINTEGERThe 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.
IWORKβINTEGERarray Workspace. That's it, that's the whole description π§LIWORKβINTEGERThe 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βREALarrayLRWORKβINTEGERThe number of entries inLRWORK(dimension( ??? )β yes, the source literally has question marks there, we love a mystery πΈ).RESULTβREALarray, dimension(26)The values computed by the tests described above. The values are currently limited to1/ulp, to avoid overflow.INFO
okay so INFO is an INTEGER, and here's the vibe check on what each value means:
0β 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.
If CLATMR, CLATMS, CHETRD, CUNGTR, CSTEQR, SSTERF, or CUNMC2 returns an error code, the absolute value of it is returned. periodt π
Some local variables and parameters, bestie:
ZERO,ONEβ real 0 and 1.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.
Overflow and underflow icons:
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 (yes, it says four and then lists three β that's the source's business, not ours π):
KTYPE(j)β the general type (1-10) for type .KMODE(j)β theMODEvalue 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 620 of file cchkst2stg.f.
Author π§
Generated automatically by Doxygen for LAPACK from the source code.
That's the whole page, bestie! π This iconic little number is LAPACK Version 3.12.0, file TESTING/EIG/cchkst2stg.f(3). Catch you in the next manpage! πβ¨
π¦ 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