TESTING/EIG/dchkst.f(3)
๐ธ TESTING/EIG/dchkst.f ๐ธ
okay so real talk, this is page (3) of the Library Functions Manual โ the file is TESTING/EIG/dchkst.f, and it's filed under TESTING/EIG in the source tree. This is the documentation page for one single subroutine, and she is a lot, bestie. Buckle up. ๐
โจ NAME โจ
TESTING/EIG/dchkst.f
that's it. that's the name. short king. ๐
๐ฆ SYNOPSIS ๐ฆ
Functions/Subroutines
dchkstโ the whole squad of arguments shows up here, no gatekeeping:
subroutine dchkst (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, iwork, liwork, result, info)
๐ฅ Function/Subroutine Documentation ๐ฅ
subroutine dchkst
okay so here's the full flex โ the typed version of that signature, because Fortran wants you to know exactly what everything is. and honestly? iconic of her. ๐ซถ
subroutine dchkst (integer nsizes, integer, dimension( * ) nn, integer
ntypes, logical, dimension( * ) dotype, integer, dimension( 4 ) iseed,
double precision thresh, integer nounit, double precision, dimension(
lda, * ) a, integer lda, double precision, 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, double
precision, dimension( ldu, * ) u, integer ldu, double precision,
dimension( ldu, * ) v, double precision, dimension( * ) vp, double
precision, dimension( * ) tau, double precision, dimension( ldu, * ) z,
double precision, dimension( * ) work, integer lwork, integer,
dimension( * ) iwork, integer liwork, double precision, dimension( * )
result, integer info)
and here's that same energy, one declaration at a time, in the exact order she wrote them โ thirty-three of them. thirty-three!! not me counting ๐ญ
integer nsizes
integer, dimension( * ) nn
integer ntypes
logical, dimension( * ) dotype
integer, dimension( 4 ) iseed
double precision thresh
integer nounit
double precision, dimension( lda, * ) a
integer lda
double precision, 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
double precision, dimension( ldu, * ) u
integer ldu
double precision, dimension( ldu, * ) v
double precision, dimension( * ) vp
double precision, dimension( * ) tau
double precision, dimension( ldu, * ) z
double precision, dimension( * ) work
integer lwork
integer, dimension( * ) iwork
integer liwork
double precision, dimension( * ) result
integer info
quick vibe check on the crowd, nothing extra added, just noticing things out loud ๐
- the integer crew:
nsizes,ntypes,nounit,lda,ldu,lwork,liwork,infoโ plusinteger, dimension( * ) nnandinteger, dimension( 4 ) iworkโฆ wait no bestie,iseedis thedimension( 4 )one,iworkisdimension( * ). reading comprehension: unlocked. ๐ - the one and only logical:
logical, dimension( * ) dotypeโ she's the outlier and she knows it โจ - the double precision girlies:
thresh,a,ap,sd,se,d1,d2,d3,d4,d5,wa1,wa2,wa3,wr,u,v,vp,tau,z,work,resultโ that's the whole group chat ๐ - the ones with two dimensions (main character energy):
aisdimension( lda, * ), whileu,vandzare alldimension( ldu, * )๐
ngl the names are giving "somebody's scratch workspace" and honestly? relatable.d1throughd5didn't even get real names. they got numbers. ๐
DCHKST
that's the label she goes by. one word, all caps, no notes. ๐
๐ง Purpose ๐ง
okay so this is where the actual explanation lives โ and it's right here, bestie, it's coming up in the next part, don't scroll away on me ๐๐
DCHKST is the full vibe-check for the symmetric eigenvalue problem routines, and she does not skip a single test ๐
DSYTRD factors A as U S U', where ' means transpose, S is symmetric tridiagonal, and U is orthogonal. Bestie, DSYTRD can use either just the lower triangle or just the upper triangle of A โ and DCHKST checks both cases, no cap. U is represented as a product of Householder transformations, whose vectors are stored in the first n-1 columns of V, and whose scale factors are in TAU.
DSPTRD does the same as DSYTRD, except A and V are stored in that other format (iykyk ๐ซถ).
DORGTR constructs the matrix U from the contents of V and TAU.
DOPGTR constructs the matrix U from the contents of VP and TAU.
DSTEQR factors S as Z D1 Z', where Z is the orthogonal matrix of eigenvectors and D1 is a diagonal matrix with the eigenvalues on the diagonal. D2 is the matrix of eigenvalues computed when Z is not computed.
DSTERF computes D3, the matrix of eigenvalues, by the PWK method, which does not yield eigenvectors.
DPTEQR factors S as Z4 D4 Z4', for a symmetric positive definite tridiagonal matrix. D5 is the matrix of eigenvalues computed when Z is not computed.
DSTEBZ computes selected eigenvalues. WA1, WA2, and WA3 will denote eigenvalues computed to high absolute accuracy, with different range options. WR will denote eigenvalues computed to high relative accuracy.
DSTEIN computes Y, the eigenvectors of S, given the eigenvalues.
DSTEDC factors S as Z D1 Z', where Z is the orthogonal matrix of eigenvectors and D1 is a diagonal matrix with the eigenvalues on the diagonal ('I' option). It may also update an input orthogonal matrix, usually the output from DSYTRD/DORGTR or DSPTRD/DOPGTR ('V' option). It may also just compute eigenvalues ('N' option).
DSTEMR factors S as Z D1 Z', where Z is the orthogonal matrix of eigenvectors and D1 is a diagonal matrix with the eigenvalues on the diagonal ('I' option). DSTEMR uses the Relatively Robust Representation whenever possible.
When DCHKST 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 symmetric eigenroutines. For each matrix, a number of tests will be performed:
- Test (1) โ
| A - V S V' | / ( |A| n ulp )forDSYTRD( UPLO='U', ... ) - Test (2) โ
| I - UV' | / ( n ulp )forDORGTR( UPLO='U', ... ) - Test (3) โ
| A - V S V' | / ( |A| n ulp )forDSYTRD( UPLO='L', ... ) - Test (4) โ
| I - UV' | / ( n ulp )forDORGTR( UPLO='L', ... ) - Tests (5-8) โ same as 1-4, but for
DSPTRDandDOPGTR. - Test (9) โ
| S - Z D Z' | / ( |S| n ulp )forDSTEQR('V',...) - Test (10) โ
| I - ZZ' | / ( n ulp )forDSTEQR('V',...) - Test (11) โ
| D1 - D2 | / ( |D1| ulp )forDSTEQR('N',...) - Test (12) โ
| D1 - D3 | / ( |D1| ulp )forDSTERF - Test (13) โ
0if the true eigenvalues (computed by sturm count) ofSare withinTHRESHof those inD1.2*THRESHif they are not. (Tested usingDSTECH.)
For S positive definite:
- Test (14) โ
| S - Z4 D4 Z4' | / ( |S| n ulp )forDPTEQR('V',...) - Test (15) โ
| I - Z4 Z4' | / ( n ulp )forDPTEQR('V',...) - Test (16) โ
| D4 - D5 | / ( 100 |D4| ulp )forDPTEQR('N',...)
When S is also diagonally dominant by the factor gamma < 1:
- Test (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', ...)
- Test (18) โ
| WA1 - D3 | / ( |D3| ulp )forDSTEBZ( 'A', 'E', ...) - Test (19) โ
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
DSTEBZ( 'I', 'E', ...)
- Test (20) โ
| S - Y WA1 Y' | / ( |S| n ulp )forDSTEBZ, SSTEIN - Test (21) โ
| I - Y Y' | / ( n ulp )forDSTEBZ, SSTEIN - Test (22) โ
| S - Z D Z' | / ( |S| n ulp )forDSTEDC('I') - Test (23) โ
| I - ZZ' | / ( n ulp )forDSTEDC('I') - Test (24) โ
| S - Z D Z' | / ( |S| n ulp )forDSTEDC('V') - Test (25) โ
| I - ZZ' | / ( n ulp )forDSTEDC('V') - Test (26) โ
| D1 - D2 | / ( |D1| ulp )forDSTEDC('V')andDSTEDC('N')
Test 27 is disabled at the moment because DSTEMR does not guarantee high relative accuracy. So sheโs sitting this one out, bestie ๐ญ
- Test (27) โ
max | D6(i) - WR(i) | / ( |D6(i)| omega ) ,
i
omega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4
DSTEMR('V', 'A')
- Test (28) โ
max | D6(i) - WR(i) | / ( |D6(i)| omega ) ,
i
omega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4
DSTEMR('V', 'I')
Tests 29 through 34 are disabled at present because DSTEMR does not handle partial spectrum requests. Not her fault, sheโs just built different ๐ซ
- Test (29) โ
| S - Z D Z' | / ( |S| n ulp )forDSTEMR('V', 'I') - Test (30) โ
| I - ZZ' | / ( n ulp )forDSTEMR('V', 'I') - Test (31) โ
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
DSTEMR('N', 'I') vs. SSTEMR('V', 'I')
- Test (32) โ
| S - Z D Z' | / ( |S| n ulp )forDSTEMR('V', 'V') - Test (33) โ
| I - ZZ' | / ( n ulp )forDSTEMR('V', 'V') - Test (34) โ
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
DSTEMR('N', 'V') vs. SSTEMR('V', 'V')
- Test (35) โ
| S - Z D Z' | / ( |S| n ulp )forDSTEMR('V', 'A') - Test (36) โ
| I - ZZ' | / ( n ulp )forDSTEMR('V', 'A') - Test (37) โ
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
DSTEMR('N', 'A') vs. SSTEMR('V', 'A')
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 that matrix type 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 orthogonal andDhas evenly spaced entries1, ..., ULPwith random signs on the diagonal. - A matrix of the form
U' D U, whereUis orthogonal andDhas geometrically spaced entries1, ..., ULPwith random signs on the diagonal. - A matrix of the form
U' D U, whereUis orthogonal 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 ) - Symmetric 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โNSIZES is INTEGERโ the number of sizes of matrices to use. If it is zero,DCHKSTdoes nothing. 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 will be skipped. The values must be at least zero.NTYPESโNTYPES is INTEGERโ the number of elements inDOTYPE. If it is zero,DCHKSTdoes nothing. It must be at least zero. If it isMAXTYP+1andNSIZESis 1, then an additional type,MAXTYP+1, is defined, which is to use whatever matrix is inA. This is only useful ifDOTYPE(1:MAXTYP)is.FALSE.andDOTYPE(MAXTYP+1)is.TRUE..DOTYPEโ ...
DOTYPE
LOGICAL array, dimension (NTYPES)
okay so this is the "which tea are we spilling today" array ๐
if DOTYPE(j) is .TRUE., then for each size in NN a matrix of that size and of type j gets generated. fr fr.
and here's the fine print bestie: if NTYPES is smaller than the maximum number of types defined (that's PARAMETER MAXTYP), then types NTYPES+1 through MAXTYP will not be generated. and if NTYPES is larger than MAXTYP, then DOTYPE(MAXTYP+1) through DOTYPE(NTYPES) will be ignored. so extra entries are justโฆ vibes. ignored vibes. ๐
ISEED
INTEGER array, dimension (4)
the seed of the random number generator, lowkey the main character here ๐ฑ on entry, the array elements should be between 0 and 4095; if they're not, they get reduced mod 4096. also, ISEED(4) must be odd. like, non-negotiable.
the generator uses a linear congruential sequence limited to small integers, so it should produce machine independent random numbers โจ and the values of ISEED get changed on exit โ you can feed them into the next call to DCHKST to continue the same random number sequence. continuity, slay ๐ซถ
THRESH
DOUBLE PRECISION
ngl the source text has a little gap here ๐ญ โ it literally reads "A test will count as if the , computed as described above, exceeds THRESH." so the words got eaten somewhere on the way to us. keeping it real with you instead of making stuff up.
the bit that survived and matters: note that the error is scaled to be O(1), so THRESH should be a reasonably small multiple of 1, e.g., 10 or 100. in particular, it should not depend on the precision (single vs. double) or the size of the matrix. and it must be at least zero. periodt.
NOUNIT
INTEGER
the FORTRAN unit number for printing out error messages (like, e.g., if a routine returns IINFO not equal to 0). your little oopsie inbox ๐ฌ
A
DOUBLE PRECISION array of dimension ( LDA , max(NN) )
holds the matrix whose eigenvalues are to be computed ๐ on exit, A contains the last matrix actually used. so it keeps receipts of the final glow-up. ๐
LDA
INTEGER
the leading dimension of A. it must be at least 1 and at least max( NN ). both. yes. and. ๐ซถ
AP
DOUBLE PRECISION array of dimension( max(NN)*max(NN+1)/2 )
the matrix A stored in packed format. same girl, smaller bag ๐
SD
DOUBLE PRECISION array of dimension( max(NN) )
the diagonal of the tridiagonal matrix computed by DSYTRD. on exit, SD and SE contain the tridiagonal form of the matrix in A. ๐ธ
SE
DOUBLE PRECISION array of dimension( max(NN) )
the off-diagonal of the tridiagonal matrix computed by DSYTRD. on exit, SD and SE contain the tridiagonal form of the matrix in A. like, they're a matching set, iykyk ๐
D1
DOUBLE PRECISION array of dimension( max(NN) )
the eigenvalues of A, as computed by DSTEQR simultaneously with Z. on exit, the eigenvalues in D1 correspond with the matrix in A. ๐ฅ
D2
DOUBLE PRECISION array of dimension( max(NN) )
the eigenvalues of A, as computed by DSTEQR if Z is not computed. on exit, the eigenvalues in D2 correspond with the matrix in A.
D3
DOUBLE PRECISION array of dimension( max(NN) )
the eigenvalues of A, as computed by DSTERF. on exit, the eigenvalues in D3 correspond with the matrix in A. ๐
D4
DOUBLE PRECISION array of dimension( max(NN) )
the eigenvalues of A, as computed by DPTEQR(V). DPTEQR factors S as Z4 D4 Z4*. on exit, the eigenvalues in D4 correspond with the matrix in A. โญ
D5
DOUBLE PRECISION array of dimension( max(NN) )
the eigenvalues of A, as computed by DPTEQR(N) when Z is not computed. on exit, the eigenvalues in D4 correspond with the matrix in A.
not a typo of ours bestie โ the source really does say D4 in that second sentence. we're reporting it exactly as it is ๐
WA1
DOUBLE PRECISION array of dimension( max(NN) )
all eigenvalues of A, computed to high absolute accuracy, with different range options. as computed by DSTEBZ. the whole squad, in high def โจ
WA2
DOUBLE PRECISION array of dimension( max(NN) )
selected eigenvalues of A, computed to high absolute accuracy, with different range options. as computed by DSTEBZ. choose random values for IL and IU, and ask for the IL-th through IU-th eigenvalues. a curated little guest list ๐
WA3
DOUBLE PRECISION array of dimension( max(NN) )
selected eigenvalues of A, computed to high absolute accuracy, with different range options. as computed by DSTEBZ. determine the values VL and VU of the IL-th and IU-th eigenvalues and ask for all eigenvalues in this range. slice it by vibes ๐
WR
DOUBLE PRECISION array of dimension( max(NN) )
all eigenvalues of A, computed to high absolute accuracy, with different options. as computed by DSTEBZ. ๐ฆ
U
DOUBLE PRECISION array of dimension( LDU, max(NN) )
the orthogonal matrix computed by DSYTRD + DORGTR. iconic combo ๐
LDU
INTEGER
the leading dimension of U, Z, and V. it must be at least 1 and at least max( NN ). one number, three besties ๐ซถ
V
DOUBLE PRECISION array of dimension( LDU, max(NN) )
the Housholder vectors computed by DSYTRD 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 DSYTRD, the sub- and superdiagonal are not set to 1, although the true Householder vector has a 1 in that position. the routines that use V, such as DORGTR, set those entries to 1 before using them, and then restore them later. so it's a whole put-it-back-where-you-found-it situation ๐)
VP
DOUBLE PRECISION array of dimension( max(NN)*max(NN+1)/2 )
the matrix V stored in packed format. ๐
TAU
DOUBLE PRECISION array of dimension( max(NN) )
the Householder factors computed by DSYTRD in reducing A to tridiagonal form. ๐
Z
DOUBLE PRECISION array of dimension( LDU, max(NN) )
the orthogonal matrix of eigenvectors computed by DSTEQR, DPTEQR, and DSTEIN. the whole ensemble cast โจ
WORK
DOUBLE PRECISION array of dimension( LWORK )
workspace. that's it, that's the description. do not perceive her ๐
LWORK
INTEGER
the number of entries in WORK. 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, it's giving calculator ๐งฎ
IWORK
INTEGER array,
workspace. the integer-flavoured one. ๐ซถ
LIWORK
INTEGER
the number of entries in IWORK. this must be at least:
6 + 6*Nmax + 5 * Nmax * lg Nmax
where Nmax = max( NN(j), 2 ) and lg = log base 2. yes the 6*Nmax and the 6 * Nmax * lg Nmax are spaced differently in the source and we are respecting that. periodt.
RESULT
DOUBLE PRECISION array, dimension (26)
the values computed by the tests described above. the values are currently limited to 1/ulp, to avoid overflow. twenty-six little report cards ๐ญ
INFO
and the source justโฆ stops here. the INFO block has no description text after it in the original, so there's literally nothing more for us to tell you. we don't invent lore ๐
INFO is INTEGER. If 0, then everything ran OK. If it's negative, here's the tea:
-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 DLATMR, SLATMS, DSYTRD, DORGTR, DSTEQR, SSTERF, or DORMC2 returns an error code, the absolute value of it is returned. No cap, that's literally what it says.
๐ธ Some Local Variables and Parameters:
The source has this lil' underline: ---- ----- --------- --- ---------- (yes, iconic).
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)โ 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 587 of file dchkst.f.
โจ Author
Generated automatically by Doxygen for LAPACK from the source code.
๐ Okay bestie, that's the whole page. The footer stamp is LAPACK Version 3.12.0 for TESTING/EIG/dchkst.f(3) โ source/version/date vibes, periodt. ๐ซถ
๐ฆ 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