DCHKST2STG.F(3)
π DCHKST2STG(3) π
okay bestie, this is the TESTING/EIG/dchkst2stg.f(3) page from the Library Functions Manual β manual name is literally TESTING/EIG/dchkst2stg.f, title is DCHKST2STG(3), and we are keeping every single character of these signatures. No cap, no merging, no βclose enoughβ energy. π«Άβ¨
β¨ NAME β¨
TESTING/EIG/dchkst2stg.f
πΈ SYNOPSIS πΈ
π Functions/Subroutines π
hereβs the synopsis subroutine, exact vibes only:
subroutine dchkst2stg (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)
DCHKST2STG
π₯ Function/Subroutine Documentation π₯
okay so this is the full typed-out declaration, and yes β every argument, every type, every dimension(...), every comma is staying right here. itβs giving iconic thoroughness, honestly. π
subroutine dchkst2stg (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)
DCHKST2STG
π Purpose: π
DCHKST2STG is the vibe check for the symmetric eigenvalue problem routines using the 2-stage reduction techniques. 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 DSYTRD. For that, we call the standard DSYTRD and compute D1 using DSTEQR, then we call the 2-stage DSYTRD_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. Tests 1 and 2 remain to verify that the 1-stage results are OK and can be trusted. This testing routine will converge to DCHKST in the next release when vectors and generation of Q will be implemented.
DSYTRDfactorsAasU S U', where'means transpose,Sis symmetric tridiagonal, andUis orthogonal.DSYTRDcan use either just the lower or just the upper triangle ofA;DCHKST2STGchecks 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.DSPTRDdoes the same asDSYTRD, except thatAandVare stored in format.DORGTRconstructs the matrixUfrom the contents ofVandTAU.DOPGTRconstructs the matrixUfrom the contents ofVPandTAU.DSTEQRfactorsSasZ D1 Z', whereZis the orthogonal 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.DPTEQRfactorsSasZ4 D4 Z4', for a symmetric 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.DSTEINcomputesY, the eigenvectors ofS, given the eigenvalues.DSTEDCfactorsSasZ D1 Z', whereZis the orthogonal matrix of eigenvectors andD1is a diagonal matrix with the eigenvalues on the diagonal ('I'option). It may also update an input orthogonal matrix, usually the output fromDSYTRD/DORGTRorDSPTRD/DOPGTR('V'option). It may also just compute eigenvalues ('N'option).DSTEMRfactorsSasZ D1 Z', whereZis the orthogonal matrix of eigenvectors andD1is a diagonal matrix with the eigenvalues on the diagonal ('I'option).DSTEMRuses the Relatively Robust Representation whenever possible.
When DCHKST2STG is called, a number of matrix sizes (NN) and a number of matrix types (DOTYPE) are specified. For each size (NN(j)) 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:
β¨ The 37 tests, aka the whole main-character checklist β¨
- Test (1) β
| A - V S V' | / ( |A| n ulp )viaDSYTRD( UPLO='U', ... ) - Test (2) β
| I - UV' | / ( n ulp )viaDORGTR( UPLO='U', ... ) - Test (3) β originally
| A - V S V' | / ( |A| n ulp )viaDSYTRD( UPLO='L', ... ), but replaced by| D1 - D2 | / ( |D1| ulp )whereD1is the eigenvalue matrix computed usingSandD2is the eigenvalue matrix computed usingS_2stage, the output ofDSYTRD_2STAGE(, ,....).D1andD2are computed viaDSTEQR('N',...). - Test (4) β originally
| I - UV' | / ( n ulp )viaDORGTR( UPLO='L', ... ), but replaced by| D1 - D3 | / ( |D1| ulp )whereD1is the eigenvalue matrix computed usingSandD3is the eigenvalue matrix computed usingS_2stage, the output ofDSYTRD_2STAGE(, ,....).D1andD3are computed viaDSTEQR('N',...). - Tests (5-8) β same as 1-4, but for
DSPTRDandDOPGTR. - Test (9) β
| S - Z D Z' | / ( |S| n ulp )viaDSTEQR('V',...) - Test (10) β
| I - ZZ' | / ( n ulp )viaDSTEQR('V',...) - Test (11) β
| D1 - D2 | / ( |D1| ulp )viaDSTEQR('N',...) - Test (12) β
| D1 - D3 | / ( |D1| ulp )viaDSTERF - 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 )viaDPTEQR('V',...) - Test (15) β
| I - Z4 Z4' | / ( n ulp )viaDPTEQR('V',...) - Test (16) β
| D4 - D5 | / ( 100 |D4| ulp )viaDPTEQR('N',...)
When S is also diagonally dominant by the factor gamma < 1:
- Test (17) β the max-omega situation:
max | D4(i) - WR(i) | / ( |D4(i)| omega ) ,
i
omega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4
via DSTEBZ( 'A', 'E', ...)
- Test (18) β
| WA1 - D3 | / ( |D3| ulp )viaDSTEBZ( 'A', 'E', ...) - Test (19) β the double min-max drama:
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
via DSTEBZ( 'I', 'E', ...)
- Test (20) β
| S - Y WA1 Y' | / ( |S| n ulp )viaDSTEBZ, SSTEIN - Test (21) β
| I - Y Y' | / ( n ulp )viaDSTEBZ, SSTEIN - Test (22) β
| S - Z D Z' | / ( |S| n ulp )viaDSTEDC('I') - Test (23) β
| I - ZZ' | / ( n ulp )viaDSTEDC('I') - Test (24) β
| S - Z D Z' | / ( |S| n ulp )viaDSTEDC('V') - Test (25) β
| I - ZZ' | / ( n ulp )viaDSTEDC('V') - Test (26) β
| D1 - D2 | / ( |D1| ulp )viaDSTEDC('V')andDSTEDC('N')
Test 27 is disabled at the moment because DSTEMR does not guarantee high relatvie accuracy.
- Test (27) β the disabled max-omega situation:
max | D6(i) - WR(i) | / ( |D6(i)| omega ) ,
i
omega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4
via DSTEMR('V', 'A')
- Test (28) β the max-omega situation again:
max | D6(i) - WR(i) | / ( |D6(i)| omega ) ,
i
omega = 2 (2n-1) ULP (1 + 8 gamma**2) / (1 - gamma)**4
via DSTEMR('V', 'I')
Tests 29 through 34 are disable at present because DSTEMR does not handle partial spectrum requests.
- Test (29) β
| S - Z D Z' | / ( |S| n ulp )viaDSTEMR('V', 'I') - Test (30) β
| I - ZZ' | / ( n ulp )viaDSTEMR('V', 'I') - Test (31) β the double min-max drama:
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
via DSTEMR('N', 'I') vs. SSTEMR('V', 'I')
- Test (32) β
| S - Z D Z' | / ( |S| n ulp )viaDSTEMR('V', 'V') - Test (33) β
| I - ZZ' | / ( n ulp )viaDSTEMR('V', 'V') - Test (34) β the double min-max drama:
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
via DSTEMR('N', 'V') vs. SSTEMR('V', 'V')
- Test (35) β
| S - Z D Z' | / ( |S| n ulp )viaDSTEMR('V', 'A') - Test (36) β
| I - ZZ' | / ( n ulp )viaDSTEMR('V', 'A') - Test (37) β the double min-max drama:
( max { min | WA2(i)-WA3(j) | } +
i j
max { min | WA3(i)-WA2(j) | } ) / ( |D3| ulp )
i j
via 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 matrix type will be generated. Currently, the list of possible types is:
π The matrix-type menu π
- 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 π
okay bestie, this is the parameter tour, and yes, every single one matters. no skipping. β¨
NSIZESβINTEGER. This is the number of sizes of matrices to use. If it is zero,DCHKST2STGdoes nothing. It must be at least zero. πNNβ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βINTEGER. The number of elements inDOTYPE. If it is zero,DCHKST2STGdoes 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βLOGICAL array, dimension (NTYPES). IfDOTYPE(j)is.TRUE., then for each size inNNa matrix of that size and of typejwill be generated. 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. πΈISEEDβINTEGER array, dimension (4). On entry,ISEEDspecifies the seed of the random number generator. The array elements should be between 0 and 4095; if not they will be reduced mod 4096. Also,ISEED(4)must be odd. 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 toDCHKST2STGto continue the same random number sequence. π₯THRESHβDOUBLE PRECISION. A test will count as ... if the ..., computed as described above, exceedsTHRESH. Note that the error is scaled to beO(1), soTHRESHshould 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βINTEGER. The FORTRAN unit number for printing out error messages (e.g., if a routine returnsIINFOnot equal to 0). πAβDOUBLE PRECISION arrayofdimension ( LDA , max(NN) ). Used to hold the matrix whose eigenvalues are to be computed. On exit,Acontains the last matrix actually used. πLDAβINTEGER. The leading dimension ofA. It must be at least 1 and at leastmax( NN ). πAPβDOUBLE PRECISION arrayofdimension( max(NN)*max(NN+1)/2 ). The matrixAstored in packed format. πSDβDOUBLE PRECISION arrayofdimension( max(NN) ). The diagonal of the tridiagonal matrix computed byDSYTRD. On exit,SDandSEcontain the tridiagonal form of the matrix inA. β¨SEβDOUBLE PRECISION arrayofdimension( max(NN) ). The off-diagonal of the tridiagonal matrix computed byDSYTRD. On exit,SDandSEcontain the tridiagonal form of the matrix inA. πD1βDOUBLE PRECISION arrayofdimension( max(NN) ). The eigenvalues ofA, as computed byDSTEQRsimultaneously withZ. On exit, the eigenvalues inD1correspond with the matrix inA. βD2βDOUBLE PRECISION arrayofdimension( max(NN) ). The eigenvalues ofA, as computed byDSTEQRifZis not computed. On exit, the eigenvalues inD2correspond with the matrix inA. π§D3βDOUBLE PRECISION arrayofdimension( max(NN) ). The eigenvalues ofA, as computed byDSTERF. On exit, the eigenvalues inD3correspond with the matrix inA. π«D4βDOUBLE PRECISION arrayofdimension( max(NN) ). The eigenvalues ofA, as computed byDPTEQR(V).DPTEQRfactorsSasZ4 D4 Z4*. On exit, the eigenvalues inD4correspond with the matrix inA. πD5βDOUBLE PRECISION arrayofdimension( max(NN) ). The eigenvalues ofA, as computed byDPTEQR(N)whenZis not computed. On exit, the eigenvalues inD4correspond with the matrix inA. πWA1βDOUBLE PRECISION arrayofdimension( max(NN) ). All eigenvalues ofA, computed to high absolute accuracy, with different range options, as computed byDSTEBZ. π¦WA2βDOUBLE PRECISION arrayofdimension( 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 arrayofdimension( 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 arrayofdimension( max(NN) ). All eigenvalues ofA, computed to high absolute accuracy, with different options, as computed byDSTEBZ. πUβDOUBLE PRECISION arrayofdimension( LDU, max(NN) ). The orthogonal matrix computed byDSYTRD+DORGTR. πLDUβINTEGER. The leading dimension ofU,Z, andV. It must be at least 1 and at leastmax( NN ). πVβDOUBLE PRECISION arrayofdimension( LDU, max(NN) ). The Householder vectors computed byDSYTRDin 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 inDSYTRD, the sub- and superdiagonal are not set to 1, although the true Householder vector has a 1 in that position. The routines that useV, such asDORGTR, set those entries to 1 before using them, and then restore them later.) πVPβDOUBLE PRECISION arrayofdimension( max(NN)*max(NN+1)/2 ). The matrixVstored in packed format. πTAUβDOUBLE PRECISION arrayofdimension( max(NN) ). The Householder factors computed byDSYTRDin reducingAto tridiagonal form. β¨ZβDOUBLE PRECISION arrayofdimension( LDU, max(NN) ). The orthogonal matrix of eigenvectors computed byDSTEQR,DPTEQR, andDSTEIN. πWORKβDOUBLE PRECISION arrayofdimension( LWORK ). βLWORKβINTEGER. The number of entries inWORK. This must be at least1 + 4 * Nmax + 2 * Nmax * lg Nmax + 3 * Nmax**2whereNmax = max( NN(j), 2 )andlg = log base 2. π§IWORKβINTEGER array, Workspace. π«LIWORKβINTEGER. The number of entries inIWORK. This must be at least6 + 6*Nmax + 5 * Nmax * lg NmaxwhereNmax = max( NN(j), 2 )andlg = log base 2. πRESULTβDOUBLE PRECISION array, dimension (26). The values computed by the tests described above. The values are currently limited to1/ulp, to avoid overflow. πINFOβ that's the entry, bestie. the page just listsINFOhere. π
Okay bestie, let's talk about INFO, because it's an INTEGER and it is literally the report card for this whole subroutine. π
- If
INFOis0, then everything ran OK. Slay. β¨ -1:NSIZES < 0β the size list said no. π-2: SomeNN(j) < 0β nope, not it.-3:NTYPES < 0β type count is giving negative.-5:THRESH < 0β threshold cannot be out here being negative.-9:LDA < 1orLDA < NMAX, whereNMAXismax( NN(j) ). Keep your leading dimension behaving, bestie.-23:LDU < 1orLDU < NMAX.-29:LWORK too smallβ the workspace is not giving, give it more room. π
Also: if DLATMR, SLATMS, DSYTRD, DORGTR, DSTEQR, SSTERF, or DORMC2 returns an error code, the absolute value of it is returned. Periodt.
π§ Some Local Variables and Parameters π§
ZERO,ONEβ real0and1. The math girlies.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 608 of file dchkst2stg.f.
Author: Generated automatically by Doxygen for LAPACK from the source code.
Cute sign-off: this page is from LAPACK Version 3.12.0, source file TESTING/EIG/dchkst2stg.f(3). Bye bestie β go off and test those eigen things! π«Άπ
π¦ 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