SCHKBD(3)
π SCHKBD(3) β schkbd.f, Library Functions Manual π
okay so welcome to the group chat for SCHKBD(3), bestie. This is the Library Functions Manual page for the file path below, and it is literally the LAPACK test routine for the SVD stack. β¨
πΈ NAME πΈ
/home/abuild/rpmbuild/BUILD/lapack-static-3.12.0-build/lapack-3.12.0/TESTING/EIG/schkbd.f
β¨ SYNOPSIS β¨
π«Ά Functions/Subroutines π«Ά
subroutine SCHKBD (nsizes, mval, nval, ntypes, dotype, nrhs, iseed,
thresh, a, lda, bd, be, s1, s2, x, ldx, y, z, q, ldq, pt, ldpt, u,
vt, work, lwork, iwork, nout, info)
SCHKBD
π§ Function/Subroutine Documentation π§
subroutine SCHKBD (integer nsizes, integer, dimension( * ) mval, integer,
dimension( * ) nval, integer ntypes, logical, dimension( * ) dotype,
integer nrhs, integer, dimension( 4 ) iseed, real thresh, real,
dimension( lda, * ) a, integer lda, real, dimension( * ) bd, real,
dimension( * ) be, real, dimension( * ) s1, real, dimension( * ) s2,
real, dimension( ldx, * ) x, integer ldx, real, dimension( ldx, * ) y,
real, dimension( ldx, * ) z, real, dimension( ldq, * ) q, integer ldq,
real, dimension( ldpt, * ) pt, integer ldpt, real, dimension( ldpt, * )
u, real, dimension( ldpt, * ) vt, real, dimension( * ) work, integer
lwork, integer, dimension( * ) iwork, integer nout, integer info)
SCHKBD
π― Purpose π―
okay so SCHKBD checks the singular value decomposition (SVD) routines. It is not the main character doing the SVD itself β it is the bestie holding the clipboard and yelling βvibe checkβ at every routine. π
SGEBRD reduces a real general m by n matrix A to upper or lower bidiagonal form B by an orthogonal transformation: Q' * A * P = B (or A = Q * B * P'). The matrix B is upper bidiagonal if m >= n and lower bidiagonal if m < n. π¦
SORGBR generates the orthogonal matrices Q and P' from SGEBRD. Note that Q and P are not necessarily square. π
SBDSQR computes the singular value decomposition of the bidiagonal matrix B as B = U S V'. It is called three times to compute:
B = U S1 V', whereS1is the diagonal matrix of singular values and the columns of the matricesUandVare the left and right singular vectors, respectively, ofB.- Same as 1), but the singular values are stored in
S2and the singular vectors are not computed. A = (UQ) S (P'V'), the SVD of the original matrixA.
In addition, SBDSQR has an option to apply the left orthogonal matrix U to a matrix X, useful in least squares applications. π
SBDSDC computes the singular value decomposition of the bidiagonal matrix B as B = U S V' using divide-and-conquer. It is called twice to compute:
B = U S1 V', whereS1is the diagonal matrix of singular values and the columns of the matricesUandVare the left and right singular vectors, respectively, ofB.- Same as 1), but the singular values are stored in
S2and the singular vectors are not computed.
SBDSVDX computes the singular value decomposition of the bidiagonal matrix B as B = U S V' using bisection and inverse iteration. It is called six times to compute:
B = U S1 V',RANGE='A', whereS1is the diagonal matrix of singular values and the columns of the matricesUandVare the left and right singular vectors, respectively, ofB.- Same as 1), but the singular values are stored in
S2and the singular vectors are not computed. B = U S1 V',RANGE='I', with whereS1is the diagonal matrix of singular values and the columns of the matricesUandVare the left and right singular vectors, respectively, ofB- Same as 3), but the singular values are stored in
S2and the singular vectors are not computed. B = U S1 V',RANGE='V', with whereS1is the diagonal matrix of singular values and the columns of the matricesUandVare the left and right singular vectors, respectively, ofB- Same as 5), but the singular values are stored in
S2and the singular vectors are not computed.
For each pair of matrix dimensions (M,N) and each selected matrix type, an M by N matrix A and an M by NRHS matrix X are generated. The problem dimensions are as follows:
A:M x NQ:M x min(M,N)(butM x MifNRHS > 0)P:min(M,N) x NB:min(M,N) x min(M,N)U, V:min(M,N) x min(M,N)S1, S2: diagonal, ordermin(M,N)X:M x NRHS
For each generated matrix, 14 tests are performed:
π₯ Test SGEBRD and SORGBR π₯
- (1)
| A - Q B PT | / ( |A| max(M,N) ulp ), PT = P' - (2)
| I - Q' Q | / ( M ulp ) - (3)
| I - PT PT' | / ( N ulp )
π Test SBDSQR on bidiagonal matrix B π
- (4)
| B - U S1 VT | / ( |B| min(M,N) ulp ), VT = V' - (5)
| Y - U Z | / ( |Y| max(min(M,N),k) ulp ), where Y = Q' XandZ = U' Y. - (6)
| I - U' U | / ( min(M,N) ulp ) - (7)
| I - VT VT' | / ( min(M,N) ulp ) - (8)
S1 contains min(M,N) nonnegative values in decreasing order.(Return 0 if true, 1/ULP if false.) - (9)
| S1 - S2 | / ( |S1| ulp ), where S2 is computed without computing U and V. - (10)
0 if the true singular values of B are within THRESH of those in S1. 2*THRESH if they are not.(Tested usingSSVDCH)
π Test SBDSQR on matrix A π
- (11)
| A - (QU) S (VT PT) | / ( |A| max(M,N) ulp ) - (12)
| X - (QU) Z | / ( |X| max(M,k) ulp ) - (13)
| I - (QU)'(QU) | / ( M ulp ) - (14)
| I - (VT PT) (PT'VT') | / ( N ulp )
π¦ Test SBDSDC on bidiagonal matrix B π¦
- (15)
| B - U S1 VT | / ( |B| min(M,N) ulp ), VT = V' - (16)
| I - U' U | / ( min(M,N) ulp ) - (17)
| I - VT VT' | / ( min(M,N) ulp ) - (18)
S1 contains min(M,N) nonnegative values in decreasing order.(Return 0 if true, 1/ULP if false.) - (19)
| S1 - S2 | / ( |S1| ulp ), where S2 is computed without computing U and V.
π Test SBDSVDX on bidiagonal matrix B π
- (20)
| B - U S1 VT | / ( |B| min(M,N) ulp ), VT = V' - (21)
| I - U' U | / ( min(M,N) ulp ) - (22)
| I - VT VT' | / ( min(M,N) ulp ) - (23)
S1 contains min(M,N) nonnegative values in decreasing order.(Return 0 if true, 1/ULP if false.) - (24)
| S1 - S2 | / ( |S1| ulp ), where S2 is computed without computing U and V. - (25)
| S1 - U' B VT' | / ( |S| n ulp ) SBDSVDX('V', 'I') - (26)
| I - U' U | / ( min(M,N) ulp ) - (27)
| I - VT VT' | / ( min(M,N) ulp ) - (28)
S1 contains min(M,N) nonnegative values in decreasing order.(Return 0 if true, 1/ULP if false.) - (29)
| S1 - S2 | / ( |S1| ulp ), where S2 is computed without computing U and V. - (30)
| S1 - U' B VT' | / ( |S1| n ulp ) SBDSVDX('V', 'V') - (31)
| I - U' U | / ( min(M,N) ulp ) - (32)
| I - VT VT' | / ( min(M,N) ulp ) - (33)
S1 contains min(M,N) nonnegative values in decreasing order.(Return 0 if true, 1/ULP if false.) - (34)
| S1 - S2 | / ( |S1| ulp ), where S2 is computed without computing U and V.
π The possible matrix types are π
- (1) The zero matrix.
- (2) The identity matrix.
- (3) A diagonal matrix with evenly spaced entries
1, ..., ULPand random signs. (ULP = (first number larger than 1) - 1) - (4) A diagonal matrix with geometrically spaced entries
1, ..., ULPand random signs. - (5) A diagonal matrix with entries
1, ULP, ..., ULPand random signs. - (6) Same as
(3), but multiplied bySQRT( overflow threshold ) - (7) Same as
(3), but multiplied bySQRT( underflow threshold ) - (8) A matrix of the form
U D V, whereUandVare orthogonal andDhas evenly spaced entries1, ..., ULPwith random signs on the diagonal. - (9) A matrix of the form
U D V, whereUandVare orthogonal andDhas geometrically spaced entries1, ..., ULPwith random signs on the diagonal. - (10) A matrix of the form
U D V, whereUandVare orthogonal 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) Rectangular 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 )
Special case: π
- (16) A bidiagonal matrix with random entries chosen from a logarithmic distribution on
[ulp^2,ulp^(-2)](I.e., each entry ise^x, wherexis chosen uniformly on[ 2 log(ulp), -2 log(ulp) ].) For this type:- (a)
SGEBRDis not called to reduce it to bidiagonal form. - (b) the bidiagonal is
min(M,N) x min(M,N); ifM<N, the matrix will be lower bidiagonal, otherwise upper. - (c) only tests
5--8and14are performed.
- (a)
A subset of the full set of matrix types may be selected through the logical array DOTYPE.
π Parameters π
π§Έ NSIZES π§Έ
NSIZES is INTEGER. It is the number of values of M and N contained in the vectors MVAL and NVAL. The matrix sizes are used in pairs (M,N). π
π§Έ MVAL π§Έ
MVAL is INTEGER array, dimension (NM). These are the values of the matrix row dimension M. π«
π§Έ NVAL π§Έ
NVALβNVALisINTEGER array, dimension (NM)</p> and it holds the values of the matrix column dimensionN. That's it, bestie, it's giving "just the N values" energy β¨NTYPESβNTYPESisINTEGERand it's the number of elements inDOTYPE. If it's zero,SCHKBDdoes nothing. It must be at least zero. If it'sMAXTYP+1andNSIZESis1, then an additional type,MAXTYP+1, is defined, which is to use whatever matrices are inAandB. This is only useful ifDOTYPE(1:MAXTYP)is.FALSE.andDOTYPE(MAXTYP+1)is.TRUE.π«ΆDOTYPEβDOTYPEisLOGICAL array, dimension (NTYPES). IfDOTYPE(j)is.TRUE., then for each size(m,n), a matrix 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. No cap, that's the rule πNRHSβNRHSisINTEGERand it's the number of columns in the matricesX,Y, andZ, used in testingSBDSQR. IfNRHS = 0, then the operations on the right-hand side will not be tested.NRHSmust be at least0. Zero means we're skipping the right-hand-side era πISEEDβISEEDisINTEGER array, dimension (4). On entry,ISEEDspecifies the seed of the random number generator. The array elements should be between0and4095; if not, they will be reduced mod4096. Also,ISEED(4)must be odd. The values ofISEEDare changed on exit, and can be used in the next call toSCHKBDto continue the same random number sequence. RNG lore, fr fr π²THRESHβTHRESHisREALand it's the threshold value for the test ratios. A result is included in the output file ifRESULT >= THRESH. To have every test ratio printed, useTHRESH = 0. Note that the expected value of the test ratios isO(1), soTHRESHshould be a reasonably small multiple of1, e.g.,10or100. Keep it cute and small, bestie πΈAβAisREAL array, dimension (LDA,NMAX)whereNMAXis the maximum value ofNinNVAL. Main character matrix energy πLDAβLDAisINTEGERand it's the leading dimension of the arrayA.LDA >= max(1,MMAX), whereMMAXis the maximum value ofMinMVAL. Respect the leading dimension, okay? πBDβBDisREAL array, dimension(max(min(MVAL(j),NVAL(j)))). Bidiagonal bestie, no notes πBEβBEisREAL array, dimension(max(min(MVAL(j),NVAL(j)))). Same energy asBD, different name π¦S1βS1isREAL array, dimension(max(min(MVAL(j),NVAL(j)))). She's a real one β¨S2βS2isREAL array, dimension(max(min(MVAL(j),NVAL(j)))). Sister ofS1, slay πXβXisREAL array, dimension (LDX,NRHS). Right-hand-side icon behavior πLDXβLDXisINTEGERand it's the leading dimension of the arraysX,Y, andZ.LDX >= max(1,MMAX). One leading dimension to rule them all πYβYisREAL array, dimension (LDX,NRHS). Another right-hand-side bestie, we love to see it πZβZisREAL array, dimension (LDX,NRHS). Third one, completing the trio πQβQisREAL array, dimension (LDQ,MMAX). Orthogonal-ish queen behavior, iykyk π§LDQβLDQisINTEGERand it's the leading dimension of the arrayQ.LDQ >= max(1,MMAX). Don't forget it πPTβPTisREAL array, dimension (LDPT,NMAX). She's giving transposed-pretty energy β¨LDPTβLDPTisINTEGERand it's the leading dimension of the arraysPT,U, andV.LDPT >= max(1, max(min(MVAL(j),NVAL(j)))). Big leading-dimension energy π₯UβUisREAL array, dimension(LDPT,max(min(MVAL(j),NVAL(j)))). U are doing amazing, sweetie πVTβVTisREAL array, dimension(LDPT,max(min(MVAL(j),NVAL(j)))). Transposed V, main character vibes π¦WORKβWORKisREAL array, dimension (LWORK). Workspace bestie, gotta have somewhere to put the math π«ΆLWORKβLWORKisINTEGERand it's the number of entries inWORK. This must be at least3(M+N)andM(M + max(M,N,k) + 1) + N*min(M,N)for all pairs(M,N)=(MM(j),NN(j)). Do not skip this, bestie, workspace math is real πIWORKβIWORKisINTEGER array, dimension at least 8*min(M,N). Integer workspace, living her best life πNOUTβNOUTisINTEGERand it's the FORTRAN unit number for printing out error messages (e.g., if a routine returnsIINFOnot equal to0). Yes,IINFO, that's the one πINFOβINFOisINTEGER. If0, then everything ran OK. The error codes are giving very specific, and we respect that:-1:NSIZES < 0-2: SomeMM(j) < 0-3: SomeNN(j) < 0-4:NTYPES < 0-6:NRHS < 0-8:THRESH < 0-11:LDA < 1 or LDA < MMAX, whereMMAXismax( MM(j) ).-17:LDB < 1 or LDB < MMAX.-21:LDQ < 1 or LDQ < MMAX.-23:LDPT< 1 or LDPT< MNMAX.-27:LWORKtoo small.
If SLATMR, SLATMS, SGEBRD, SORGBR, or SBDSQR, returns an error code, the absolute value of it is returned. So yeah, negative numbers with lore π
π§ Some Local Variables and Parameters π§
Okay bestie, these are the local variables and parameters β lore drop time π
ZERO, ONEβ Real0and1. Simple, iconic, foundational β¨MAXTYPβ The number of types defined.NTESTβ The number of tests performed, or which can be performed so far, for the current matrix.MMAXβ Largest value inNN. Yes,NN, that's what it says πNMAXβ Largest value inNN. Again,NN. The page said it, not me πMNMINβmin(MM(j), NN(j))(the dimension of the bidiagonal matrix.)MNMAXβ The maximum value ofMNMINforj=1,...,NSIZES.NFAILβ The number of tests which have exceededTHRESHCOND, IMODEβ Values to be passed to the matrix generators.ANORMβ Norm ofA; passed to matrix generators.OVFL, UNFLβ Overflow and underflow thresholds.RTOVFL, RTUNFLβ Square roots of the previous2values.ULP, ULPINVβ Finest relative precision and its inverse.
The following four arrays decode JTYPE (yes, four β the page says four, and we're just carrying the message π«Ά):
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 489 of file schkbd.f.
π Author (again, because Doxygen said so) π
Generated automatically by Doxygen for LAPACK from the source code.
And that's the whole page, bestie β LAPACK Version 3.12.0, source /home/abui...IG/schkbd.f(3). Bye, ily, go test those matrices πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: lapack-man 3.12.0-160000.2.2 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms