SCHKST2STG.F(3)

πŸ“¦
version 3.12.1 Β· 3 versions
, in arch rolling

πŸŽ€ NAME πŸŽ€

okay bestie, this is the manual page for TESTING/EIG/schkst2stg.f(3) from the Library Functions Manual, and the manual name folded in right up top is TESTING/EIG/schkst2stg.f. It’s giving β€œI live in TESTING/EIG and I have a whole subroutine to introduce” energy πŸ’…


✨ SYNOPSIS ✨

🧚 Functions/Subroutines 🧚

  • subroutine schkst2stg (...) β€” this is the SCHKST2STG subroutine, and here’s the full signature exactly as written, no edits, no cap:
       subroutine schkst2stg (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)
           SCHKST2STG

πŸ”₯ Function/Subroutine Documentation πŸ”₯

bestie, this is the full β€œwho dis” for the subroutine. Same name, same whole squad of arguments, now with all the types and dimensions. Keep your eyes on the code block β€” every integer, real, dimension, lda, ldu, etc. is exactly as the page says 🫢

   subroutine schkst2stg (integer nsizes, integer, dimension( * ) nn, integer
       ntypes, logical, dimension( * ) dotype, integer, dimension( 4 ) iseed,
       real thresh, integer nounit, real, dimension( lda, * ) a, integer lda,
       real, 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, real, dimension( ldu, * ) u, integer ldu, real,
       dimension( ldu, * ) v, real, dimension( * ) vp, real, dimension( * )
       tau, real, dimension( ldu, * ) z, real, dimension( * ) work, integer
       lwork, integer, dimension( * ) iwork, integer liwork, real, dimension( *
       ) result, integer info)
       SCHKST2STG

🎯 Purpose: 🎯

okay so SCHKST2STG checks the symmetric eigenvalue problem routines using the 2-stage reduction techniques. 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 SSYTRD. For that, we call the standard SSYTRD and compute D1 using SSTEQR, then we call the 2-stage SSYTRD_2STAGE with Upper and Lower and we compute D2 and D3 using SSTEQR 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 SCHKST in the next release when vectors and generation of Q will be implemented. πŸ’…


the cast of routines, no cap:

  • SSYTRD factors A as U S U', where ' means transpose, S is symmetric tridiagonal, and U is orthogonal. SSYTRD can use either just the lower or just the upper triangle of A; SCHKST2STG checks both cases. 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.
  • SSPTRD does the same as SSYTRD, except that A and V are stored in format.
  • SORGTR constructs the matrix U from the contents of V and TAU.
  • SOPGTR constructs the matrix U from the contents of VP and TAU.
  • SSTEQR 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.
  • SSTERF computes D3, the matrix of eigenvalues, by the PWK method, which does not yield eigenvectors.
  • SPTEQR 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.
  • 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.
  • SSTEIN computes Y, the eigenvectors of S, given the eigenvalues.
  • SSTEDC 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 SSYTRD/SORGTR or SSPTRD/SOPGTR ('V' option). It may also just compute eigenvalues ('N' option).
  • SSTEMR 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). SSTEMR uses the Relatively Robust Representation whenever possible.

When SCHKST2STG 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 symmetric eigenroutines. For each matrix, a number of tests will be performed:

  • Test (1): | A - V S V' | / ( |A| n ulp ) for SSYTRD( UPLO='U', ... )
  • Test (2): | I - UV' | / ( n ulp ) for SORGTR( UPLO='U', ... )
  • Test (3): | A - V S V' | / ( |A| n ulp ) for SSYTRD( UPLO='L', ... ), replaced by | D1 - D2 | / ( |D1| ulp ) where D1 is the eigenvalue matrix computed using S and D2 is the eigenvalue matrix computed using S_2stage the output of SSYTRD_2STAGE(, ,....). D1 and D2 are computed via SSTEQR('N',...)
  • Test (4): | I - UV' | / ( n ulp ) for SORGTR( UPLO='L', ... ), replaced by | D1 - D3 | / ( |D1| ulp ) where D1 is the eigenvalue matrix computed using S and D3 is the eigenvalue matrix computed using S_2stage the output of SSYTRD_2STAGE(, ,....). D1 and D3 are computed via SSTEQR('N',...)
  • Tests (5–8): Same as 1–4, but for SSPTRD and SOPGTR.
  • Test (9): | S - Z D Z' | / ( |S| n ulp ) for SSTEQR('V',...)
  • Test (10): | I - ZZ' | / ( n ulp ) for SSTEQR('V',...)
  • Test (11): | D1 - D2 | / ( |D1| ulp ) for SSTEQR('N',...)
  • Test (12): | D1 - D3 | / ( |D1| ulp ) for SSTERF
  • Test (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)

For S positive definite,

  • Test (14): | S - Z4 D4 Z4' | / ( |S| n ulp ) for SPTEQR('V',...)
  • Test (15): | I - Z4 Z4' | / ( n ulp ) for SPTEQR('V',...)
  • Test (16): | D4 - D5 | / ( 100 |D4| ulp ) for SPTEQR('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

for SSTEBZ( 'A', 'E', ... )

  • Test (18): | WA1 - D3 | / ( |D3| ulp ) for SSTEBZ( 'A', 'E', ... )
  • Test (19):
( max { min | WA2(i)-WA3(j) | } +
   i     j
  max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
   i     j

for SSTEBZ( 'I', 'E', ... )

  • Test (20): | S - Y WA1 Y' | / ( |S| n ulp ) for SSTEBZ, SSTEIN
  • Test (21): | I - Y Y' | / ( n ulp ) for SSTEBZ, SSTEIN
  • Test (22): | S - Z D Z' | / ( |S| n ulp ) for SSTEDC('I')
  • Test (23): | I - ZZ' | / ( n ulp ) for SSTEDC('I')
  • Test (24): | S - Z D Z' | / ( |S| n ulp ) for SSTEDC('V')
  • Test (25): | I - ZZ' | / ( n ulp ) for SSTEDC('V')
  • Test (26): | D1 - D2 | / ( |D1| ulp ) for SSTEDC('V') and SSTEDC('N')
⚠️ Test 27 is disabled at the moment because SSTEMR does not guarantee high relatvie accuracy.
  • Test (27):
max | D6(i) - WR(i) | / ( |D6(i)| omega ) ,
 i
omega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4

for SSTEMR('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

for SSTEMR('V', 'I')

⚠️ Tests 29 through 34 are disable at present because SSTEMR does not handle partial spectrum requests.
  • Test (29): | S - Z D Z' | / ( |S| n ulp ) for SSTEMR('V', 'I')
  • Test (30): | I - ZZ' | / ( n ulp ) for SSTEMR('V', 'I')
  • Test (31):
( max { min | WA2(i)-WA3(j) | } +
   i     j
  max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
   i     j

for SSTEMR('N', 'I') vs. SSTEMR('V', 'I')

  • Test (32): | S - Z D Z' | / ( |S| n ulp ) for SSTEMR('V', 'V')
  • Test (33): | I - ZZ' | / ( n ulp ) for SSTEMR('V', 'V')
  • Test (34):
( max { min | WA2(i)-WA3(j) | } +
   i     j
  max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
   i     j

for SSTEMR('N', 'V') vs. SSTEMR('V', 'V')

  • Test (35): | S - Z D Z' | / ( |S| n ulp ) for SSTEMR('V', 'A')
  • Test (36): | I - ZZ' | / ( n ulp ) for SSTEMR('V', 'A')
  • Test (37):
( max { min | WA2(i)-WA3(j) | } +
   i     j
  max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
   i     j

for SSTEMR('N', 'A') vs. SSTEMR('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:

  • (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 orthogonal 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 orthogonal 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 orthogonal 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) Symmetric 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 🌸

ok so here's the whole cast of characters πŸ’– every single one of these gets passed in, and every single one has rules, so let's go through them one by one, no skipping, bestie.

  • NSIZES β€” NSIZES is INTEGER. It's the number of sizes of matrices we're gonna use. If it's zero, SCHKST2STG does literally nothing (iconic but useless). It must be at least zero.
  • NN β€” NN is INTEGER array, dimension (NSIZES). This array holds the sizes we're using for the matrices. Zero values get skipped, bestie, they're just not invited. The values must be at least zero.
  • NTYPES β€” NTYPES is INTEGER. It's the number of elements in DOTYPE. If it's zero, again, SCHKST2STG does nothing. Must be at least zero. BUT β€” and this is the fun part β€” if it's MAXTYP+1 and NSIZES is 1, then an 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.. very niche, very specific, we respect it 🫢
  • DOTYPE β€” DOTYPE is 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 max number of types defined (PARAMETER MAXTYP), then types NTYPES+1 through MAXTYP just won't be generated. And if NTYPES is larger than MAXTYP, then DOTYPE(MAXTYP+1) through DOTYPE(NTYPES) get straight-up ignored. rude but fair πŸ’…
  • ISEED β€” ISEED is INTEGER array, dimension (4). On entry, ISEED specifies 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. (yes, mandatory oddness, it's a whole thing). The random number 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 use them in the next call to SCHKST2STG to continue the same random number sequence. continuity queen.
  • THRESH β€” THRESH is REAL. A test will count as if the , 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, e.g., 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 β€” NOUNIT is INTEGER. It's the FORTRAN unit number for printing out error messages (e.g., if a routine returns IINFO not equal to 0). your designated snitch unit, honestly.
  • A β€” A is REAL array of dimension ( LDA , max(NN) ). It holds the matrix whose eigenvalues are gonna be computed. On exit, A contains the last matrix actually used. it keeps receipts.
  • LDA β€” LDA is INTEGER. The leading dimension of A. It must be at least 1 and at least max( NN ).
  • AP β€” AP is REAL array of dimension ( max(NN)*max(NN+1)/2 ). It's the matrix A stored in packed format. lil compact icon.
  • SD β€” SD is REAL array of dimension ( max(NN) ). The diagonal of the tridiagonal matrix computed by SSYTRD. On exit, SD and SE contain the tridiagonal form of the matrix in A.
  • SE β€” SE is REAL array of dimension ( max(NN) ). The off-diagonal of the tridiagonal matrix computed by SSYTRD. On exit, SD and SE contain the tridiagonal form of the matrix in A. (yes, same sentence, they're a package deal πŸŽ€)
  • D1 β€” D1 is REAL array of dimension ( max(NN) ). The eigenvalues of A, as computed by SSTEQR simultaneously with Z. On exit, the eigenvalues in D1 correspond with the matrix in A.
  • D2 β€” D2 is REAL array of dimension ( max(NN) ). The eigenvalues of A, as computed by SSTEQR if Z is not computed. On exit, the eigenvalues in D2 correspond with the matrix in A.
  • D3 β€” D3 is 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 β€” D4 is REAL array of dimension ( max(NN) ). The eigenvalues of A, as computed by SPTEQR(V). SPTEQR factors S as Z4 D4 Z4*. On exit, the eigenvalues in D4 correspond with the matrix in A.
  • D5 β€” D5 is REAL array of dimension ( max(NN) ). The eigenvalues of A, as computed by SPTEQR(N) when Z is not computed. On exit, the eigenvalues in D4 correspond with the matrix in A. (yes, it says D4 in the docs, we're reporting it exactly, don't come for me πŸ™ˆ)
  • WA1 β€” WA1 is REAL array of dimension ( max(NN) ). All eigenvalues of A, computed to high absolute accuracy, with different range options, as computed by SSTEBZ. highkey accurate.
  • WA2 β€” WA2 is 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: choose random values for IL and IU, and ask for the IL-th through IU-th eigenvalues 🎲
  • WA3 β€” WA3 is REAL array of dimension ( max(NN) ). Selected eigenvalues of A, computed to high absolute accuracy, with different range options, as computed by SSTEBZ. This time: determine the values VL and VU of the IL-th and IU-th eigenvalues, and ask for all eigenvalues in this range.
  • WR β€” WR is REAL array of dimension ( max(NN) ). All eigenvalues of A, computed to high absolute accuracy, with different options, as computed by SSTEBZ.
  • U β€” U is REAL array of dimension ( LDU, max(NN) ). The orthogonal matrix computed by SSYTRD + SORGTR. teamwork makes the dream work πŸ’œ
  • LDU β€” LDU is INTEGER. The leading dimension of U, Z, and V. It must be at least 1 and at least max( NN ).
  • V β€” V is REAL array of dimension ( LDU, max(NN) ). The Householder vectors computed by SSYTRD 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 SSYTRD, 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 SORGTR, set those entries to 1 before using them, and then restore them later. iconic cleanup behaviour honestly.)
  • VP β€” VP is REAL array of dimension ( max(NN)*max(NN+1)/2 ). The matrix V stored in packed format.
  • TAU β€” TAU is REAL array of dimension ( max(NN) ). The Householder factors computed by SSYTRD in reducing A to tridiagonal form.
  • Z β€” Z is REAL array of dimension ( LDU, max(NN) ). The orthogonal matrix of eigenvectors computed by SSTEQR, SPTEQR, and SSTEIN.
  • WORK β€” WORK is REAL array of dimension ( LWORK ).
  • LWORK β€” LWORK is 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 not skimp on the workspace bestie, it WILL notice 😭
  • IWORK β€” IWORK is INTEGER array. Workspace. that's it, that's the whole description, and honestly? respect.
  • LIWORK β€” LIWORK is 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.

  • RESULT β€” RESULT is REAL 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 β€” INFO is INTEGER. (and that's exactly where this part hands off, don't worry, more coming πŸ¦‹)

INFO is an INTEGER 🫢 and honestly it's the vibe check at the end of the run. If it comes back as 0, then everything ran OK β€” periodt. ✨

  • -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.

If SLATMR, SLATMS, SSYTRD, SORGTR, SSTEQR, SSTERF, or SORMC2 returns an error code, the absolute value of it is returned. 😭


🌸 Some Local Variables and Parameters

okay bestie these are the backstage girlies keeping the receipts πŸ‘‘

  • 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 608 of file schkst2stg.f.

Generated automatically by Doxygen for LAPACK from the source code.


and that's a wrap on this one, bestie πŸ’… β€” LAPACK Version 3.12.0, from TESTING/EIG/schkst2stg.f(3). Doxygen really said β€œI'll do it myself” and honestly? iconic πŸŽ€

πŸ“¦ where this page comes from