TESTING/EIG/cchkst.f(3)

๐Ÿ“ฆ
version 3.12.1 ยท 2 versions
, in arch rolling

๐Ÿ’œ 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:

  • CHETRD factors A as U S U*, where * means conjugate transpose, S is real symmetric tridiagonal, and U is unitary.
  • CHETRD can use either just the lower or just the upper triangle of A; CCHKST checks both cases. thorough queen behavior ๐Ÿ‘‘
  • 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.
  • CHPTRD does the same as CHETRD, except that A and V are stored in ??? format. (there's a missing word there in the original โ€” not my fault, I promise ๐Ÿ˜ญ)
  • CUNGTR constructs the matrix U from the contents of V and TAU.
  • CUPGTR constructs the matrix U from the contents of VP and TAU.
  • CSTEQR factors S as Z D1 Z*, where Z is the unitary 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.
  • SSTERF computes D3, the matrix of eigenvalues, by the PWK method, which does not yield eigenvectors.
  • CPTEQR 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.
  • SSTEBZ 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. accuracy is the moment, periodt โœจ
  • CSTEIN computes Y, the eigenvectors of S, given the eigenvalues.
  • CSTEDC factors S as Z D1 Z*, where Z is the unitary matrix of eigenvectors and D1 is a diagonal matrix with the eigenvalues on the diagonal (the 'I' option). it may also update an input unitary matrix, usually the output from CHETRD/CUNGTR or CHPTRD/CUPGTR (the 'V' option). it may also just compute eigenvalues (the 'N' option). multitasking icon ๐Ÿ’…
  • CSTEMR factors S as Z D1 Z*, where Z is the unitary matrix of eigenvectors and D1 is a diagonal matrix with the eigenvalues on the diagonal (the 'I' option). CSTEMR uses 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 CHPTRD and CUPGTR.
  • (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) 0 if the true eigenvalues (computed by sturm count) of S are within THRESH of those in D1. 2*THRESH if they are not. (tested using SSTECH)

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 i of | 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') and CSTEDC('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 i of | 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 i of | 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, ..., ULP and 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, where U is unitary and D has evenly spaced entries 1, ..., ULP with random signs on the diagonal.
  • (9) A matrix of the form U* D U, where U is unitary and D has geometrically spaced entries 1, ..., ULP with random signs on the diagonal.
  • (10) A matrix of the form U* D U, where U is unitary and D has ??? entries 1, ULP,..., ULP with 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, CCHKST literally 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 in DOTYPE. If it's zero, CCHKST does nothing. Must be at least zero. โœจ Special case alert โœจ: if it's MAXTYP+1 and NSIZES is 1, then one extra type โ€” MAXTYP+1 โ€” gets defined, and that one just uses whatever matrix is already sitting in A. This is only useful if DOTYPE(1:MAXTYP) is .FALSE. and DOTYPE(MAXTYP+1) is .TRUE..
  • DOTYPE โ€” LOGICAL array, dimension (NTYPES). If DOTYPE(j) is .TRUE., then for each size in NN a matrix of that size and of type j gets generated ๐ŸŽ€. If NTYPES is smaller than the maximum number of types defined (PARAMETER MAXTYP), then types NTYPES+1 through MAXTYP won't be generated. If NTYPES is bigger than MAXTYP, then DOTYPE(MAXTYP+1) through DOTYPE(NTYPES) get ignored (rude, but that's the rule).
  • ISEED โ€” INTEGER array, dimension (4). On entry, ISEED sets 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 โ€” 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 of ISEED get changed on exit, and you can pass them into the next CCHKST call 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, exceeds THRESH. Note that the error is scaled to be O(1), so THRESH should be a reasonably small multiple of 1, like 10 or 100. 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 returns IINFO not equal to 0). So like, where the complaints get filed ๐Ÿ“ฌ.
  • A โ€” COMPLEX array of dimension ( LDA , max(NN) ). Holds the matrix whose eigenvalues are gonna be computed. On exit, A contains the last matrix actually used โ€” she remembers where she's been ๐Ÿ’….
  • LDA โ€” INTEGER. The leading dimension of A. Must be at least 1 and at least max( NN ).
  • AP โ€” COMPLEX array of dimension( max(NN)*max(NN+1)/2 ). The matrix A, but stored in packed format (compact icon behaviour).
  • SD โ€” REAL array 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 โ€” REAL array 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 โ€” REAL array of dimension( max(NN) ). The eigenvalues of A, as computed by CSTEQR simultaneously with Z (multitasking queen). On exit, the eigenvalues in D1 correspond with the matrix in A.
  • D2 โ€” REAL array 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 โ€” REAL array 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 โ€” REAL array of dimension( max(NN) ). The eigenvalues of A, as computed by CPTEQR(V). ZPTEQR factors S as Z4 D4 Z4*. On exit, the eigenvalues in D4 correspond with the matrix in A.
  • D5 โ€” REAL array of dimension( max(NN) ). The eigenvalues of A, as computed by ZPTEQR(N) when Z is not computed. On exit, the eigenvalues in D4 correspond with the matrix in A. (Yes, it says D4 on a D5 entry โ€” that's what the source says, don't come for me ๐Ÿ™ˆ.)
  • WA1 โ€” REAL array of dimension( max(NN) ). All eigenvalues of A, computed to high absolute accuracy, with different range options, as computed by SSTEBZ โญ.
  • WA2 โ€” REAL array of dimension( max(NN) ). Selected eigenvalues of A, computed to high absolute accuracy, with different range options, as computed by SSTEBZ. The move here: pick random values for IL and IU, then ask for the IL-th through IU-th eigenvalues ๐ŸŽฏ.
  • WA3 โ€” REAL array of dimension( max(NN) ). Selected eigenvalues of A, computed to high absolute accuracy, with different range options, as computed by SSTEBZ. The move here: determine the values VL and VU of the IL-th and IU-th eigenvalues, then ask for all eigenvalues in that range.
  • WR โ€” DOUBLE PRECISION array of dimension( max(NN) ). All eigenvalues of A, computed to high absolute accuracy, with different options, as computed by DSTEBZ. (Note the precision glow-up โ€” this one's DOUBLE PRECISION, not REAL ๐Ÿ’–.)
  • U โ€” COMPLEX array of dimension( LDU, max(NN) ). The unitary matrix computed by CHETRD + CUNGTR.
  • LDU โ€” INTEGER. The leading dimension of U, Z, and V โ€” one dimension to rule them all ๐Ÿ‘‘. Must be at least 1 and at least max( NN ).
  • V โ€” COMPLEX array 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. Considerate kings ๐Ÿซถ.)
  • VP โ€” COMPLEX array of dimension( max(NN)*max(NN+1)/2 ). The matrix V, stored in packed format.
  • TAU โ€” COMPLEX array of dimension( max(NN) ). The Householder factors computed by CHETRD in reducing A to tridiagonal form.
  • Z โ€” COMPLEX array of dimension( LDU, max(NN) ). The unitary matrix of eigenvectors computed by CSTEQR, CPTEQR, and CSTEIN.
  • WORK โ€” COMPLEX array of dimension( LWORK ).
  • 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, don't skip the math ๐Ÿงฎ.

  • IWORK โ€” INTEGER array. Workspace. That's it. That's the whole description ๐Ÿ’€.
  • 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.

  • RWORK โ€” REAL array. (Yes, literally just that. No dimension note, no nothing. Iconic minimalism ๐ŸŒธ.)
  • LRWORK โ€” INTEGER. The number of entries in LRWORK โ€” 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 to 1/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 โ€” Some NN(j) < 0
  • -3 โ€” NTYPES < 0
  • -5 โ€” THRESH < 0
  • -9 โ€” LDA < 1 or LDA < NMAX, where NMAX is max( NN(j) ).
  • -23 โ€” LDU < 1 or LDU < NMAX.
  • -29 โ€” LWORK too 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 โ€” 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 by ENVIR.
  • NMAX โ€” Largest value in NN.
  • NMATS โ€” The number of matrices generated so far.
  • NERRS โ€” The number of tests which have exceeded THRESH so far.
  • COND, IMODE โ€” Values to be passed to the matrix generators.
  • ANORM โ€” Norm of A; 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