TESTING/EIG/zchkst.f(3)
π NAME π
TESTING/EIG/zchkst.f β okay so before we even get into it, this page is from the Library Functions Manual, and the whole vibe here is that one file. That's it. That's the name. Short, sweet, iconic π
β¨ SYNOPSIS β¨
π¦ Functions/Subroutines π¦
subroutine zchkst (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)β the one and onlyZCHKST, bestie. Yes, look at all those arguments. She's that girl. π
πΈ Function/Subroutine Documentation πΈ
π subroutine zchkst π
The full signature, in all her glory β and ngl she's got a LOT going on, so here it is laid out exactly, no cap:
subroutine zchkst (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)
ZCHKST π«Ά
Okay so real talk β that argument list is long, so here's every single one of them broken out with her exact declared type, because we do not skip deets in this house πβ¨
integer nsizesβ integer, bestie.integer, dimension( * ) nnβ array of integers, dimension*.integer ntypesβ integer.logical, dimension( * ) dotypeβ array of logicals, dimension*.integer, dimension( 4 ) iseedβ array of integers, dimension4(yes, specifically4, not*, don't come for her).double precision threshβ double precision scalar.integer nounitβ integer.complex*16, dimension( lda, * ) aβ 2-Dcomplex*16array, dimension( lda, * ).integer ldaβ integer.complex*16, dimension( * ) apβcomplex*16array, dimension*.double precision, dimension( * ) sdβ double precision array, dimension*.double precision, dimension( * ) seβ same energy, dimension*.double precision, dimension( * ) d1β yup,*.double precision, dimension( * ) d2β π another one.double precision, dimension( * ) d3β she keeps going.double precision, dimension( * ) d4β iconic, no notes.double precision, dimension( * ) d5β the last of the d-squad πdouble precision, dimension( * ) wa1β double precision array.double precision, dimension( * ) wa2β double precision array.double precision, dimension( * ) wa3β double precision array.double precision, dimension( * ) wrβ double precision array.complex*16, dimension( ldu, * ) uβ 2-Dcomplex*16, dimension( ldu, * ).integer lduβ integer (and yes, she's the leading dimension foru,vandzβ the way she multi-tasks π).complex*16, dimension( ldu, * ) vβ 2-Dcomplex*16, dimension( ldu, * ).complex*16, dimension( * ) vpβcomplex*16array, dimension*.complex*16, dimension( * ) tauβcomplex*16array, dimension*.complex*16, dimension( ldu, * ) zβ 2-Dcomplex*16, dimension( ldu, * ).complex*16, dimension( * ) workβcomplex*16workspace array, dimension*.integer lworkβ integer.double precision, dimension( * ) rworkβ double precision array, dimension*.integer lrworkβ integer.integer, dimension( * ) iworkβ integer array, dimension*.integer liworkβ integer.double precision, dimension( * ) resultβ double precision array, dimension*.integer infoβ integer. The classic. The main character of every LAPACK-adjacent signature π
Fr fr, that's the whole parameter list β every single argument, exact types, nothing merged, nothing dropped. Copy-paste her into your code and she'll be happy. π
π§ Purpose π§
okay so this is where the Purpose: section starts β and that's literally where this part of the page stops, bestie. The deets keep rolling in the next bit, so don't close the tab π¦β¨
ZUNGTR builds the matrix U out of whatever's sitting in V and TAU, and ZUPGTR does the exact same glow-up for VP and TAU. Iconic, no notes. β¨
ZSTEQR factors S as Z D1 Z*, where Z is the unitary matrix of eigenvectors and D1 is a diagonal matrix with the eigenvalues chillin' on the diagonal. D2? That's the matrix of eigenvalues you get when Z is not computed. Two moods, same tea.
DSTERF computes D3, the matrix of eigenvalues, via the PWK method β which is giving "eigenvalues only, no eigenvectors, we don't do plus-ones" π
ZPTEQR factors S as Z4 D4 Z4*, for a Hermitian positive definite tridiagonal matrix. D5 is the matrix of eigenvalues computed when Z is not computed.
DSTEBZ computes selected eigenvalues. WA1, WA2, and WA3 denote eigenvalues computed to high absolute accuracy, with different range options. WR denotes eigenvalues computed to high relative accuracy. Know the difference, bestie, it matters π«Ά
ZSTEIN computes Y, the eigenvectors of S, given the eigenvalues.
ZSTEDC factors S as Z D1 Z*, where Z is the unitary matrix of eigenvectors and D1 is diagonal with the eigenvalues on the diagonal ('I' option). It may also update an input unitary matrix β usually the output from ZHETRD/ZUNGTR or ZHPTRD/ZUPGTR (that's the 'V' option). And it may also just compute eigenvalues (the 'N' option). Versatile queen π
ZSTEMR factors S as Z D1 Z*, where Z is the unitary matrix of eigenvectors and D1 is diagonal with the eigenvalues on the diagonal ('I' option). ZSTEMR uses the Relatively Robust Representation whenever possible. Fancy. πΈ
When ZCHKST 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 gets generated and used to test the Hermitian eigenroutines. For each matrix, a whole pile of tests runs:
(1)β| A - V S V* | / ( |A| n ulp )forZHETRD( UPLO='U', ... )(2)β| I - UV* | / ( n ulp )forZUNGTR( UPLO='U', ... )(3)β| A - V S V* | / ( |A| n ulp )forZHETRD( UPLO='L', ... )(4)β| I - UV* | / ( n ulp )forZUNGTR( UPLO='L', ... )(5-8)β same as 1-4, but forZHPTRDandZUPGTR. Same energy, packed format.(9)β| S - Z D Z* | / ( |S| n ulp )forZSTEQR('V',...)(10)β| I - ZZ* | / ( n ulp )forZSTEQR('V',...)(11)β| D1 - D2 | / ( |D1| ulp )forZSTEQR('N',...)(12)β| D1 - D3 | / ( |D1| ulp )forDSTERF(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 )forZPTEQR('V',...)(15)β| I - Z4 Z4* | / ( n ulp )forZPTEQR('V',...)(16)β| D4 - D5 | / ( 100 |D4| ulp )forZPTEQR('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 )viaDSTEBZ,ZSTEIN(21)β| I - Y Y* | / ( n ulp )viaDSTEBZ,ZSTEIN(22)β| S - Z D Z* | / ( |S| n ulp )forZSTEDC('I')(23)β| I - ZZ* | / ( n ulp )forZSTEDC('I')(24)β| S - Z D Z* | / ( |S| n ulp )forZSTEDC('V')(25)β| I - ZZ* | / ( n ulp )forZSTEDC('V')(26)β| D1 - D2 | / ( |D1| ulp )forZSTEDC('V')andZSTEDC('N')
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')
Tests 29 through 34 are disabled at present because ZSTEMR does not handle partial spectrum requests. π
(29)β| S - Z D Z* | / ( |S| n ulp )forZSTEMR('V', 'I')(30)β| I - ZZ* | / ( n ulp )forZSTEMR('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 )forZSTEMR('V', 'V')(33)β| I - ZZ* | / ( n ulp )forZSTEMR('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 )forZSTEMR('V', 'A')(36)β| I - ZZ* | / ( n ulp )forZSTEMR('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 are specified by an array NN(1:NSIZES) β each element NN(j) says one size. The types are specified by a logical array DOTYPE( 1:NTYPES ) β if DOTYPE(j) is .TRUE., then matrix type j gets generated. Currently the list of possible types is, and I'm obsessed with how thorough this is:
(1)β the zero matrix.(2)β the identity matrix.(3)β a diagonal matrix with evenly spaced entries1, ..., ULPand random signs. (ULP = (first number larger than 1) - 1)(4)β a diagonal matrix with geometrically spaced entries1, ..., ULPand random signs.(5)β a diagonal matrix with entries1, ULP, ..., ULPand random signs.(6)β same as(4), but multiplied bySQRT( overflow threshold ).(7)β same as(4), but multiplied bySQRT( underflow threshold ).(8)β a matrix of the formU* D U, whereUis unitary andDhas evenly spaced entries1, ..., ULPwith random signs on the diagonal.(9)β a matrix of the formU* D U, whereUis unitary andDhas geometrically spaced entries1, ..., ULPwith random signs on the diagonal.(10)β a matrix of the formU* D U, whereUis unitary andDhas entries1, ULP,..., ULPwith random signs on the diagonal.(11)β same as(8), but multiplied bySQRT( overflow threshold ).(12)β same as(8), but multiplied bySQRT( underflow threshold ).(13)β Hermitian matrix with random entries chosen from(-1,1).(14)β same as(13), but multiplied bySQRT( overflow threshold ).(15)β same as(13), but multiplied bySQRT( 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 bySQRT( overflow threshold ).(20)β same as(16), but multiplied bySQRT( underflow threshold ).(21)β a diagonally dominant tridiagonal matrix with geometrically spaced diagonal entries1, ..., ULP.
πΈ Parameters πΈ
NSIZES
NSIZES is INTEGER.
The number of sizes of matrices to use. If it's zero, ZCHKST does nothing β full couch potato mode π΄. It must be at least zero.
NN
NN is INTEGER array, dimension (NSIZES).
An array containing the sizes to be used for the matrices. Zero values get skipped. The values must be at least zero.
NTYPES
NTYPES is INTEGER.
The number of elements in DOTYPE. If it's zero, ZCHKST does nothing (again β iconically lazy). It must be at least zero.
If it is MAXTYP+1 and NSIZES is 1, then an additional type, MAXTYP+1, is defined, which is to use whatever matrix is already in A. Heads up though: this is only useful if DOTYPE(1:MAXTYP) is .FALSE. and DOTYPE(MAXTYP+1) is .TRUE.. iykyk π
DOTYPE
β¦and DOTYPE is up next, bestie β its description keeps rolling in the next bit π«Ά
DOTYPEβ LOGICAL array, dimension(NTYPES). IfDOTYPE(j)is.TRUE., then for each size inNNa matrix of that size and of typejwill be generated β¨. And okay, the rules: ifNTYPESis smaller than the maximum number of types defined (PARAMETER MAXTYP), then typesNTYPES+1throughMAXTYPwill not be generated. IfNTYPESis larger thanMAXTYP,DOTYPE(MAXTYP+1)throughDOTYPE(NTYPES)will be ignored π. That's it, that's the whole vibe.ISEEDβ INTEGER array, dimension(4). On entry,ISEEDspecifies the seed of the random number generator π±. The array elements should be between0and4095; if not, they will be reducedmod 4096. Also β important βISEED(4)must be odd (like, actually, no cap). The random number generator uses a linear congruential sequence limited to small integers, and so should produce machine independent random numbers. The values ofISEEDare changed on exit, and can be used in the next call toZCHKSTto continue the same random number sequence. Slay, continuity π .THRESHβ DOUBLE PRECISION. A test will count as [failed] if the [error ratio], computed as described above, exceedsTHRESH. 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. Like, zero is the floor, bestie.NOUNITβ INTEGER. The FORTRAN unit number for printing out error messages (e.g., if a routine returnsIINFOnot equal to0.) π«Ά Your little messenger pigeon for bad news.Aβ COMPLEX*16 array of dimension( LDA , max(NN) ). Used to hold the matrix whose eigenvalues are to be computed. On exit,Acontains the last matrix actually used. Main character array, honestly π.LDAβ INTEGER. The leading dimension ofA. It must be at least1and at leastmax( NN ).APβ COMPLEX*16 array of dimension( max(NN)*max(NN+1)/2 ). The matrixAstored in packed format π.SDβ DOUBLE PRECISION array of dimension( max(NN) ). The diagonal of the tridiagonal matrix computed byZHETRD. On exit,SDandSEcontain the tridiagonal form of the matrix inA.SEβ DOUBLE PRECISION array of dimension( max(NN) ). The off-diagonal of the tridiagonal matrix computed byZHETRD. On exit,SDandSEcontain the tridiagonal form of the matrix inA. Besties, they come as a pair π.D1β DOUBLE PRECISION array of dimension( max(NN) ). The eigenvalues ofA, as computed byZSTEQRsimultaneously withZ. On exit, the eigenvalues inD1correspond with the matrix inA.D2β DOUBLE PRECISION array of dimension( max(NN) ). The eigenvalues ofA, as computed byZSTEQRifZis not computed. On exit, the eigenvalues inD2correspond with the matrix inA.D3β DOUBLE PRECISION array of dimension( max(NN) ). The eigenvalues ofA, as computed byDSTERF. On exit, the eigenvalues inD3correspond with the matrix inA. Three D's, three routines, three vibes β¨.D4β DOUBLE PRECISION array of dimension( max(NN) ). The eigenvalues ofA, as computed byZPTEQR(V).ZPTEQRfactorsSasZ4 D4 Z4*. On exit, the eigenvalues inD4correspond with the matrix inA.D5β DOUBLE PRECISION array of dimension( max(NN) ). The eigenvalues ofA, as computed byZPTEQR(N)whenZis not computed. On exit, the eigenvalues inD4correspond with the matrix inA. (Yes, it saysD4β I'm just passing along the message, don't come for me π.)WA1β DOUBLE PRECISION array of dimension( max(NN) ). All eigenvalues ofA, computed to high absolute accuracy, with different range options, as computed byDSTEBZ.WA2β DOUBLE PRECISION array of dimension( max(NN) ). Selected eigenvalues ofA, computed to high absolute accuracy, with different range options, as computed byDSTEBZ. Choose random values forILandIU, and ask for theIL-th throughIU-th eigenvalues π².WA3β DOUBLE PRECISION array of dimension( max(NN) ). Selected eigenvalues ofA, computed to high absolute accuracy, with different range options, as computed byDSTEBZ. Determine the valuesVLandVUof theIL-th andIU-th eigenvalues and ask for all eigenvalues in this range.WRβ DOUBLE PRECISION array of dimension( max(NN) ). All eigenvalues ofA, computed to high absolute accuracy, with different options, as computed byDSTEBZ.Uβ COMPLEX*16 array of dimension( LDU, max(NN) ). The unitary matrix computed byZHETRD+ZUNGTRπ¦.LDUβ INTEGER. The leading dimension ofU,Z, andV. It must be at least1and at leastmax( NN ). One number to rule all three, periodt π .Vβ COMPLEX*16 array of dimension( LDU, max(NN) ). The Housholder vectors computed byZHETRDin 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 inZHETRD, the sub- and superdiagonal are not set to1, although the true Householder vector has a1in that position. The routines that useV, such asZUNGTR, set those entries to1before using them, and then restore them later.) Like a friend who borrows your hoodie and puts it back exactly how it was π«Ά.VPβ COMPLEX*16 array of dimension( max(NN)*max(NN+1)/2 ). The matrixVstored in packed format.TAUβ COMPLEX*16 array of dimension( max(NN) ). The Householder factors computed byZHETRDin reducingAto tridiagonal form.Zβ COMPLEX*16 array of dimension( LDU, max(NN) ). The unitary matrix of eigenvectors computed byZSTEQR,ZPTEQR, andZSTEINπΈ.WORKβ COMPLEX*16 array of dimension( LWORK ). Scratch space, doing the behind-the-scenes labour π.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. Math girlies stay winning πβ¨.
IWORKβ INTEGER array. Workspace.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. Yes it's a different formula from LWORK, don't mix them up bestie π.
RWORKβ DOUBLE PRECISION array. (That's the whole description. Short king π.)LRWORKβ INTEGER. The number of entries inLRWORK(dimension( ??? ) π β yeah, the docs leave that one as a mystery, I'm not gonna invent an answer).RESULTβ DOUBLE PRECISION array, dimension(26). The values computed by the tests described above. The values are currently limited to1/ulp, to avoid overflow. Twenty-six little report cards π₯.INFO
INFO is INTEGER π
- If
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.- If
ZLATMR,CLATMS,ZHETRD,ZUNGTR,ZSTEQR,DSTERF, orZUNMC2returns an error code, the absolute value of it is returned.
π§ 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 previous2values.
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 599 of file zchkst.f.
π Author π
Generated automatically by Doxygen for LAPACK from the source code.
Cute sign-off bestie: this oneβs LAPACK Version 3.12.0, source TESTING/EIG/zchkst.f(3), and the footer doesnβt give a date β so thatβs the whole vibe. Mwah πβ¨
π¦ 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