ZCHKST2STG(3)
okay bestie, welcome to ZCHKST2STG(3) β the page for TESTING/EIG/zchkst2stg.f, living in the Library Functions Manual. Itβs giving testing energy, and no cap, weβre keeping every single character of these signatures. π
πΈ NAME πΈ
TESTING/EIG/zchkst2stg.f β thatβs the file name, bestie, and weβre not changing a single character of it. Periodt.
β¨ SYNOPSIS β¨
π§ Functions/Subroutines π§
okay so under Functions/Subroutines, the synopsis is literally this call:
subroutine zchkst2stg (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)
ZCHKST2STG
π Function/Subroutine Documentation π
now the full documentation signature β itβs a long one, and every arg is here, exact, no edits:
subroutine zchkst2stg (integer nsizes, integer, dimension( * ) nn, integer
ntypes, logical, dimension( * ) dotype, integer, dimension( 4 ) iseed,
double precision thresh, integer nounit, complex*16, dimension( lda, * )
a, integer lda, complex*16, dimension( * ) ap, double precision,
dimension( * ) sd, double precision, dimension( * ) se, double
precision, dimension( * ) d1, double precision, dimension( * ) d2,
double precision, dimension( * ) d3, double precision, dimension( * )
d4, double precision, dimension( * ) d5, double precision, dimension( *
) wa1, double precision, dimension( * ) wa2, double precision,
dimension( * ) wa3, double precision, dimension( * ) wr, complex*16,
dimension( ldu, * ) u, integer ldu, complex*16, dimension( ldu, * ) v,
complex*16, dimension( * ) vp, complex*16, dimension( * ) tau,
complex*16, dimension( ldu, * ) z, complex*16, dimension( * ) work,
integer lwork, double precision, dimension( * ) rwork, integer lrwork,
integer, dimension( * ) iwork, integer liwork, double precision,
dimension( * ) result, integer info)
ZCHKST2STG
ZCHKST2STG
π― Purpose
okay so here's the tea on what this bad boy actually checks, because the whole point of ZCHKST2STG is verifying Hermitian eigenvalue problem routines using the 2-stage reduction techniques π₯
So here's the situation, bestie: since the generation of Q or the vectors is not available in this release, we only compare the eigenvalue resulting when using the 2-stage to the one considered as reference using the standard 1-stage reduction ZHETRD. For that, we call the standard ZHETRD and compute D1 using DSTEQR, then we call the 2-stage ZHETRD_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. test 1 and 2 remain to verify that the 1-stage results are OK and can be trusted. This testing routine will converge to the ZCHKST in the next release when vectors and generation of Q will be implemented. π
π§ the cast of characters (aka what's being tested)
ZHETRDfactorsAasU S U*, where*means conjugate transpose,Sis real symmetric tridiagonal, andUis unitary.ZHETRDcan use either just the lower or just the upper triangle ofA;ZCHKST2STGchecks 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.ZHPTRDdoes the same asZHETRD, except thatAandVare stored in format. (yep, that blank is literally in the source, bestie β the format name got eaten, not me)ZUNGTRconstructs the matrixUfrom the contents ofVandTAU.ZUPGTRconstructs the matrixUfrom the contents ofVPandTAU.ZSTEQRfactorsSasZ 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.DSTERFcomputesD3, the matrix of eigenvalues, by the PWK method, which does not yield eigenvectors.ZPTEQRfactorsSasZ4 D4 Z4*, for a Hermitian positive definite tridiagonal matrix.D5is the matrix of eigenvalues computed whenZis not computed.DSTEBZcomputes selected eigenvalues.WA1,WA2, andWA3will denote eigenvalues computed to high absolute accuracy, with different range options.WRwill denote eigenvalues computed to high relative accuracy.ZSTEINcomputesY, the eigenvectors ofS, given the eigenvalues.ZSTEDCfactorsSasZ D1 Z*, whereZis the unitary matrix of eigenvectors andD1is a diagonal matrix with the eigenvalues on the diagonal ('I'option). It may also update an input unitary matrix, usually the output fromZHETRD/ZUNGTRorZHPTRD/ZUPGTR('V'option). It may also just compute eigenvalues ('N'option).ZSTEMRfactorsSasZ D1 Z*, whereZis the unitary matrix of eigenvectors andD1is a diagonal matrix with the eigenvalues on the diagonal ('I'option).ZSTEMRuses the Relatively Robust Representation whenever possible. β¨
π the setup, explained
When ZCHKST2STG 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. For each matrix, a number of tests will be performed: (this is the fun part, fr fr)
π¦ THE TESTS β all of them, no skips
- (1)
| A - V S V* | / ( |A| n ulp )βZHETRD( UPLO='U', ... ) - (2)
| I - UV* | / ( n ulp )βZUNGTR( UPLO='U', ... ) - (3)
| A - V S V* | / ( |A| n ulp )βZHETRD( UPLO='L', ... )replaced by| D1 - D2 | / ( |D1| ulp )whereD1is the eigenvalue matrix computed usingSandD2is the eigenvalue matrix computed usingS_2stagethe output ofZHETRD_2STAGE(, ,....).D1andD2are computed viaDSTEQR('N',...) - (4)
| I - UV* | / ( n ulp )βZUNGTR( UPLO='L', ... )replaced by| D1 - D3 | / ( |D1| ulp )whereD1is the eigenvalue matrix computed usingSandD3is the eigenvalue matrix computed usingS_2stagethe output ofZHETRD_2STAGE(, ,....).D1andD3are computed viaDSTEQR('N',...) - (5-8) Same as 1-4, but for
ZHPTRDandZUPGTR. - (9)
| S - Z D Z* | / ( |S| n ulp )βZSTEQR('V',...) - (10)
| I - ZZ* | / ( n ulp )βZSTEQR('V',...) - (11)
| D1 - D2 | / ( |D1| ulp )βZSTEQR('N',...) - (12)
| D1 - D3 | / ( |D1| ulp )βDSTERF - (13)
0if the true eigenvalues (computed by sturm count) ofSare withinTHRESHof those inD1.2*THRESHif they are not. (Tested usingDSTECH)
For S positive definite π:
- (14)
| S - Z4 D4 Z4* | / ( |S| n ulp )βZPTEQR('V',...) - (15)
| I - Z4 Z4* | / ( n ulp )βZPTEQR('V',...) - (16)
| D4 - D5 | / ( 100 |D4| ulp )βZPTEQR('N',...)
When S is also diagonally dominant by the factor gamma < 1:
- (17)
max | D4(i) - WR(i) | / ( |D4(i)| omega ) ,
i
omega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4
DSTEBZ( 'A', 'E', ...)
- (18)
| WA1 - D3 | / ( |D3| ulp )βDSTEBZ( 'A', 'E', ...) - (19)
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
DSTEBZ( 'I', 'E', ...)
- (20)
| S - Y WA1 Y* | / ( |S| n ulp )βDSTEBZ,ZSTEIN - (21)
| I - Y Y* | / ( n ulp )βDSTEBZ,ZSTEIN - (22)
| S - Z D Z* | / ( |S| n ulp )βZSTEDC('I') - (23)
| I - ZZ* | / ( n ulp )βZSTEDC('I') - (24)
| S - Z D Z* | / ( |S| n ulp )βZSTEDC('V') - (25)
| I - ZZ* | / ( n ulp )βZSTEDC('V') - (26)
| D1 - D2 | / ( |D1| ulp )βZSTEDC('V')andZSTEDC('N')
heads up, bestie: Test 27 is disabled at the moment because ZSTEMR does not guarantee high relative accuracy. π
- (27)
max | D6(i) - WR(i) | / ( |D6(i)| omega ) ,
i
omega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4
ZSTEMR('V', 'A')
- (28)
max | D6(i) - WR(i) | / ( |D6(i)| omega ) ,
i
omega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4
ZSTEMR('V', 'I')
also very much disabled rn: Tests 29 through 34 are disable at present because ZSTEMR does not handle partial spectrum requests. π
- (29)
| S - Z D Z* | / ( |S| n ulp )βZSTEMR('V', 'I') - (30)
| I - ZZ* | / ( n ulp )βZSTEMR('V', 'I') - (31)
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
ZSTEMR('N', 'I') vs. CSTEMR('V', 'I')
- (32)
| S - Z D Z* | / ( |S| n ulp )βZSTEMR('V', 'V') - (33)
| I - ZZ* | / ( n ulp )βZSTEMR('V', 'V') - (34)
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
ZSTEMR('N', 'V') vs. CSTEMR('V', 'V')
- (35)
| S - Z D Z* | / ( |S| n ulp )βZSTEMR('V', 'A') - (36)
| I - ZZ* | / ( n ulp )βZSTEMR('V', 'A') - (37)
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
ZSTEMR('N', 'A') vs. CSTEMR('V', 'A')
πΈ the sizes and the matrix types
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: (each one is a whole vibe, ngl)
- (1) The zero matrix.
- (2) The identity matrix.
- (3) A diagonal matrix with evenly spaced entries
1, ..., ULPand random signs. (ULP = (first number larger than 1) - 1) - (4) A diagonal matrix with geometrically spaced entries
1, ..., ULPand 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.
and that's the whole matrix-type menu, bestie β 21 flavours of test matrix, all iconic, all accounted for π
β¨ Parameters β¨
Okay bestie, here comes the full cast of characters π every single one of these is a real argument you gotta pass, and I'm not skipping a single one. Buckle up.
NSIZESβINTEGER. It's the number of sizes of matrices to use. If it's zero,ZCHKST2STGdoes nothing (iconic king of boundaries, honestly). Must be at least zero.NNβINTEGERarray, dimension(NSIZES). The array holding the sizes to be used for the matrices. Zero values get skipped, no cap. The values must be at least zero.NTYPESβINTEGER. The number of elements inDOTYPE. If it's zero,ZCHKST2STGdoes nothing. It must be at least zero. If it equalsMAXTYP+1andNSIZESis 1, then one extra type gets defined,MAXTYP+1, and that one means "just use whatever matrix is already 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 every size inNNa matrix of that size and of typejgets generated. IfNTYPESis smaller than the maximum number of types defined (PARAMETER MAXTYP), then typesNTYPES+1throughMAXTYPsimply do not get generated. IfNTYPESis larger thanMAXTYP, thenDOTYPE(MAXTYP+1)throughDOTYPE(NTYPES)get ignored. π«ΆISEEDβINTEGERarray, dimension(4). On entry,ISEEDsets the seed of the random number generator. The array elements should be between 0 and 4095; if they're not, they get reduced mod 4096. Also,ISEED(4)must be odd β not optional, bestie, it's a whole vibe requirement. The RNG uses a linear congruential sequence limited to small integers, so it should crank out machine independent random numbers. The values ofISEEDare changed on exit, which means you can feed them into the next call toZCHKST2STGto keep the exact same random number sequence going. Continuity slay β¨THRESHβDOUBLE PRECISION. A test will count as β¬ if the β¬ β computed as described above β exceedsTHRESH. (Yeah, the source doc literally has blanks there. Not me. Blame the Fortran π.) Note that the error is scaled to beO(1), soTHRESHshould be a reasonably small multiple of 1, like, say, 10 or 100. In particular it should not depend on the precision (single vs. double) or on the size of the matrix. It must be at least zero.NOUNITβINTEGER. The FORTRAN unit number for printing out error messages (like, if a routine returnsIINFOnot equal to 0).AβCOMPLEX*16array, dimension( LDA , max(NN) ). It holds the matrix whose eigenvalues are about to be computed. On exit,Acontains the last matrix that was actually used.LDAβINTEGER. The leading dimension ofA. It must be at least 1 and at leastmax( NN ).APβCOMPLEX*16array, dimension( max(NN)*max(NN+1)/2 ). The matrixA, but stored in packed format. Same queen, smaller closet πSDβDOUBLE PRECISIONarray, dimension( max(NN) ). The diagonal of the tridiagonal matrix computed byZHETRD. On exit,SDandSEcontain the tridiagonal form of the matrix inA.SEβDOUBLE PRECISIONarray, dimension( max(NN) ). The off-diagonal of the tridiagonal matrix computed byZHETRD. On exit,SDandSEcontain the tridiagonal form of the matrix inA. (Yes, same sentence asSD. They're a package deal, iykyk.)D1βDOUBLE PRECISIONarray, dimension( max(NN) ). The eigenvalues ofA, as computed byZSTEQRsimultaneously withZ. On exit, the eigenvalues inD1correspond with the matrix inA.D2βDOUBLE PRECISIONarray, dimension( max(NN) ). The eigenvalues ofA, as computed byZSTEQRifZis not computed. On exit, the eigenvalues inD2correspond with the matrix inA.D3βDOUBLE PRECISIONarray, dimension( max(NN) ). The eigenvalues ofA, as computed byDSTERF. On exit, the eigenvalues inD3correspond with the matrix inA.D4βDOUBLE PRECISIONarray, dimension( max(NN) ). The eigenvalues ofA, as computed byZPTEQR(V).ZPTEQRfactorsSasZ4 D4 Z4*. On exit, the eigenvalues inD4correspond with the matrix inA.D5βDOUBLE PRECISIONarray, dimension( max(NN) ). The eigenvalues ofA, as computed byZPTEQR(N)whenZis not computed. On exit, the eigenvalues inD4correspond with the matrix inA. (And yep β the doc really does sayD4there, notD5. We're just the messengers, bestie π.)WA1βDOUBLE PRECISIONarray, dimension( max(NN) ). All eigenvalues ofA, computed to high absolute accuracy, with different range options β as computed byDSTEBZ.WA2βDOUBLE PRECISIONarray, dimension( max(NN) ). Selected eigenvalues ofA, computed to high absolute accuracy, with different range options β as computed byDSTEBZ. Here's the bit: choose random values forILandIU, then ask for theIL-th throughIU-th eigenvalues.WA3βDOUBLE PRECISIONarray, dimension( max(NN) ). Selected eigenvalues ofA, computed to high absolute accuracy, with different range options β as computed byDSTEBZ. This time, determine the valuesVLandVUof theIL-th andIU-th eigenvalues, then ask for all the eigenvalues in that range.WRβDOUBLE PRECISIONarray, dimension( max(NN) ). All eigenvalues ofA, computed to high absolute accuracy, with different options β as computed byDSTEBZ.UβCOMPLEX*16array, dimension( LDU, max(NN) ). The unitary matrix computed byZHETRD+ZUNGTR. πLDUβINTEGER. The leading dimension ofU,Z, andVβ all three of em, one shared glow-up. It must be at least 1 and at leastmax( NN ).VβCOMPLEX*16array, dimension( LDU, max(NN) ). The Householder vectors computed byZHETRDwhile reducingAto tridiagonal form. The vectors computed withUPLO='U'live in the upper triangle, and the vectors computed withUPLO='L'live in the lower triangle. (As described inZHETRD, the sub- and superdiagonal are not set to 1, even though the true Householder vector does have a 1 in that position. The routines that useV, likeZUNGTR, set those entries to 1 before using them, and then restore them later. Considerate little icons π§)VPβCOMPLEX*16array, dimension( max(NN)*max(NN+1)/2 ). The matrixV, but stored in packed format.TAUβCOMPLEX*16array, dimension( max(NN) ). The Householder factors computed byZHETRDwhile reducingAto tridiagonal form.ZβCOMPLEX*16array, dimension( LDU, max(NN) ). The unitary matrix of eigenvectors computed byZSTEQR,ZPTEQR, andZSTEIN.WORKβCOMPLEX*16array, dimension( 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.
IWORKβINTEGERarray. 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βDOUBLE PRECISIONarray. That's all she wrote on this one β¨LRWORKβINTEGER. The number of entries inLRWORK(dimension( ??? ) β yes, the doc itself leaves a whole question mark situation there. We do not know either π).RESULTβDOUBLE PRECISIONarray, dimension(26)β twenty-six, count em. The values computed by the tests described above. These values are currently limited to1/ulp, to avoid overflow.INFOβ hold that thought bestie, its description picks up right where this part ends π«
INFO is INTEGER β the official vibe check for this whole routine. If itβs 0, then everything ran OK, no cap. π
-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.
IfZLATMR,CLATMS,ZHETRD,ZUNGTR,ZSTEQR,DSTERF, orZUNMC2returns an error code, the absolute value of it is returned. π
Some Local Variables and Parameters: π
The original even throws in a lil ---- ----- --------- --- ---------- underline, iconic.
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.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)β 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 zchkst2stg.f.
Author β¨ (auto-generated bestie)
Generated automatically by Doxygen for LAPACK from the source code.
okayyy thatβs the page, bestie π«Ά β footer tea: source/version is LAPACK Version 3.12.0, file is TESTING/EIG/zchkst2stg.f(3), and the auto-gen date is living in that footer vibe. bye π
β¨
π¦ 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