TESTING/EIG/cdrvbd.f(3)

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

πŸ’– NAME πŸ’–

okay bestie, this is TESTING/EIG/cdrvbd.f from the Library Functions Manual, and it's giving the CDRVBD test routine: literally the vibe check for the SVD drivers. 🫢

✨ SYNOPSIS ✨

πŸŒ€ Functions/Subroutines πŸŒ€

subroutine cdrvbd (nsizes, mm, nn, ntypes, dotype, iseed, thresh, a,
    lda, u, ldu, vt, ldvt, asav, usav, vtsav, s, ssav, e, work, lwork,
    rwork, iwork, nounit, info)
    CDRVBD

πŸ¦‹ Function/Subroutine Documentation πŸ¦‹

subroutine cdrvbd (integer nsizes, integer, dimension( * ) mm, integer,
    dimension( * ) nn, integer ntypes, logical, dimension( * ) dotype,
    integer, dimension( 4 ) iseed, real thresh, complex, dimension( lda, * )
    a, integer lda, complex, dimension( ldu, * ) u, integer ldu, complex,
    dimension( ldvt, * ) vt, integer ldvt, complex, dimension( lda, * )
    asav, complex, dimension( ldu, * ) usav, complex, dimension( ldvt, * )
    vtsav, real, dimension( * ) s, real, dimension( * ) ssav, real,
    dimension( * ) e, complex, dimension( * ) work, integer lwork, real,
    dimension( * ) rwork, integer, dimension( * ) iwork, integer nounit,
    integer info)
    CDRVBD

πŸŽ€ Purpose πŸŽ€

okay so CDRVBD checks the singular value decomposition (SVD) driver CGESVD, CGESDD, CGESVJ, CGEJSV, CGESVDX, and CGESVDQ. no cap, that's the whole assignment. πŸ’…

CGESVD and CGESDD factors A = U diag(S) VT, where U and VT are unitary and diag(S) is diagonal with the entries of the array S on its diagonal. The entries of S are the singular values, nonnegative and stored in decreasing order. U and VT can be optionally not computed, overwritten on A, or computed partially.

A is M by N. Let MNMIN = min( M, N ). S has dimension MNMIN. U can be M by M or M by MNMIN. VT can be N by N or MNMIN by N.

When CDRVBD is called, a number of matrix (M's and N's) and a number of matrix are specified. For each size (M,N) and each type of matrix, and for the minimal workspace as well as workspace adequate to permit blocking, an M x N matrix will be generated and used to test the SVD routines. For each matrix, A will be factored as A = U diag(S) VT and the following 12 tests computed (and yes, the list keeps going with more batches for the other routines β€” iconic πŸ’€):

Test for CGESVD:

  • (1) β€” | A - U diag(S) VT | / ( |A| max(M,N) ulp )
  • (2) β€” | I - U'U | / ( M ulp )
  • (3) β€” | I - VT VT' | / ( N ulp )
  • (4) β€” S contains MNMIN nonnegative values in decreasing order. (Return 0 if true, 1/ULP if false.)
  • (5) β€” | U - Upartial | / ( M ulp ) where Upartial is a partially computed U.
  • (6) β€” | VT - VTpartial | / ( N ulp ) where VTpartial is a partially computed VT.
  • (7) β€” | S - Spartial | / ( MNMIN ulp |S| ) where Spartial is the vector of singular values from the partial SVD

Test for CGESDD:

  • (8) β€” | A - U diag(S) VT | / ( |A| max(M,N) ulp )
  • (9) β€” | I - U'U | / ( M ulp )
  • (10) β€” | I - VT VT' | / ( N ulp )
  • (11) β€” S contains MNMIN nonnegative values in decreasing order. (Return 0 if true, 1/ULP if false.)
  • (12) β€” | U - Upartial | / ( M ulp ) where Upartial is a partially computed U.
  • (13) β€” | VT - VTpartial | / ( N ulp ) where VTpartial is a partially computed VT.
  • (14) β€” | S - Spartial | / ( MNMIN ulp |S| ) where Spartial is the vector of singular values from the partial SVD

Test for CGESVDQ:

  • (36) β€” | A - U diag(S) VT | / ( |A| max(M,N) ulp )
  • (37) β€” | I - U'U | / ( M ulp )
  • (38) β€” | I - VT VT' | / ( N ulp )
  • (39) β€” S contains MNMIN nonnegative values in decreasing order. (Return 0 if true, 1/ULP if false.)

Test for CGESVJ:

  • (15) β€” | A - U diag(S) VT | / ( |A| max(M,N) ulp )
  • (16) β€” | I - U'U | / ( M ulp )
  • (17) β€” | I - VT VT' | / ( N ulp )
  • (18) β€” S contains MNMIN nonnegative values in decreasing order. (Return 0 if true, 1/ULP if false.)

Test for CGEJSV:

  • (19) β€” | A - U diag(S) VT | / ( |A| max(M,N) ulp )
  • (20) β€” | I - U'U | / ( M ulp )
  • (21) β€” | I - VT VT' | / ( N ulp )
  • (22) β€” S contains MNMIN nonnegative values in decreasing order. (Return 0 if true, 1/ULP if false.)

Test for CGESVDX( 'V', 'V', 'A' )/CGESVDX( 'N', 'N', 'A' ):

  • (23) β€” | A - U diag(S) VT | / ( |A| max(M,N) ulp )
  • (24) β€” | I - U'U | / ( M ulp )
  • (25) β€” | I - VT VT' | / ( N ulp )
  • (26) β€” S contains MNMIN nonnegative values in decreasing order. (Return 0 if true, 1/ULP if false.)
  • (27) β€” | U - Upartial | / ( M ulp ) where Upartial is a partially computed U.
  • (28) β€” | VT - VTpartial | / ( N ulp ) where VTpartial is a partially computed VT.
  • (29) β€” | S - Spartial | / ( MNMIN ulp |S| ) where Spartial is the vector of singular values from the partial SVD

Test for CGESVDX( 'V', 'V', 'I' ):

  • (30) β€” | U' A VT''' - diag(S) | / ( |A| max(M,N) ulp )
  • (31) β€” | I - U'U | / ( M ulp )
  • (32) β€” | I - VT VT' | / ( N ulp )

Test for CGESVDX( 'V', 'V', 'V' ):

  • (33) β€” | U' A VT''' - diag(S) | / ( |A| max(M,N) ulp )
  • (34) β€” | I - U'U | / ( M ulp )
  • (35) β€” | I - VT VT' | / ( N ulp )

The are specified by the arrays MM(1:NSIZES) and NN(1:NSIZES); the value of each element pair (MM(j),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 matrix of the form U D V, where U and V are unitary and D has evenly spaced entries 1, ..., ULP with random signs on the diagonal.
  • (4) β€” Same as (3), but multiplied by the underflow-threshold / ULP.
  • (5) β€” Same as (3), but multiplied by the overflow-threshold * ULP.

🌸 Parameters 🌸

πŸ’« NSIZES

NSIZES is INTEGER. The number of sizes of matrices to use. If it is zero, CDRVBD does nothing. It must be at least zero. ✨

πŸ’« MM

MM is INTEGER array, dimension (NSIZES). An array containing the matrix to be used. For each j=1,...,NSIZES, if MM(j) is zero, then MM(j) and NN(j) will be ignored. The MM(j) values must be at least zero. πŸ’–

πŸ’« NN

NN is INTEGER array, dimension (NSIZES). An array containing the matrix to be used. For each j=1,...,NSIZES, if NN(j) is zero, then MM(j) and NN(j) will be ignored. The NN(j) values must be at least zero. πŸŽ€

πŸ’« NTYPES

NTYPES is INTEGER. The number of elements in DOTYPE. If it is zero, CDRVBD does nothing. It must be at least zero. If it is MAXTYP+1 and NSIZES is 1, then an additional type, MAXTYP+1 is defined, which is to use whatever matrices are in A and B. This is only useful if DOTYPE(1:MAXTYP) is .FALSE. and DOTYPE(MAXTYP+1) is .TRUE. . 🫢

πŸ’« DOTYPE

DOTYPE is LOGICAL array, dimension (NTYPES). If DOTYPE(j) is .TRUE., then for each size (m,n), a matrix of type j will be generated. If NTYPES is smaller than the maximum number of types defined (PARAMETER MAXTYP), then types NTYPES+1 through MAXTYP will not be generated. If NTYPES is larger than MAXTYP, DOTYPE(MAXTYP+1) through DOTYPE(NTYPES) will be ignored. πŸ‘‘

πŸ’« 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 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 of ISEED are changed on exit, and can be used in the next call to CDRVBD to continue the same random number sequence. πŸŽ€

πŸ’« 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. πŸ”₯

πŸ’« A

A is COMPLEX array, dimension (LDA,max(NN)). Used to hold the matrix whose singular values are to be computed. On exit, A contains the last matrix actually used. πŸ¦‹

πŸ’« LDA

LDA is INTEGER. The leading dimension of A. It must be at least 1 and at least max( MM ). ✨

πŸ’« U

U is COMPLEX array, dimension (LDU,max(MM)). Used to hold the computed matrix of right singular vectors. On exit, U contains the last such vectors actually computed. πŸ’œ

πŸ’« LDU

LDU is INTEGER. The leading dimension of U. It must be at least 1 and at least max( MM ). 🌈

πŸ’« VT

VT is COMPLEX array, dimension (LDVT,max(NN)). Used to hold the computed matrix of left singular vectors. On exit, VT contains the last such vectors actually computed. 🌸

πŸ’« LDVT

LDVT is INTEGER. The leading dimension of VT. It must be at least 1 and at least max( NN ). πŸŽ€

ASAV πŸ’…

ASAV is a COMPLEX array, dimension (LDA,max(NN)). It holds a different copy of the matrix whose singular values are to be computed. On exit, A contains the last matrix actually used. Bestie, it's the backup copy doing main-character work ✨

USAV πŸ¦‹

USAV is a COMPLEX array, dimension (LDU,max(MM)). It holds a different copy of the computed matrix of right singular vectors. On exit, USAV contains the last such vectors actually computed. Slay, right singular vectors, get copied πŸ’–

VTSAV 🌸

VTSAV is a COMPLEX array, dimension (LDVT,max(NN)). It holds a different copy of the computed matrix of left singular vectors. On exit, VTSAV contains the last such vectors actually computed. Left singular vectors also deserve a backup bestie 🫢

S ⭐

S is a REAL array, dimension (max(min(MM,NN))). It contains the computed singular values. The math girlies are literally in there πŸ”₯

SSAV πŸŽ€

SSAV is a REAL array, dimension (max(min(MM,NN))). It contains another copy of the computed singular values. Because one copy of the singular values is cute, but two is iconic πŸ’…

E πŸ’œ

E is a REAL array, dimension (max(min(MM,NN))). Workspace for CGESVD. No cap, it's just here to help 🧚

WORK πŸ”₯

WORK is a COMPLEX array, dimension (LWORK). That's the workspace vibe ✨

LWORK πŸ‘‘

LWORK is INTEGER. It's the number of entries in WORK. This must be at least

MAX(3*MIN(M,N)+MAX(M,N)**2,5*MIN(M,N),3*MAX(M,N))

for all pairs (M,N)=(MM(j),NN(j)). Do not skimp on this, bestie β€” it's giving "must be at least" for a reason 😭

RWORK 🌈

RWORK is a REAL array, dimension ( 5*max(max(MM,NN)) ). Real workspace realness πŸ’–

IWORK πŸ“

IWORK is an INTEGER array, dimension at least 8*min(M,N). Integer workspace, doing its little integer thing πŸ’…

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.). Error messages need a lane too, fr fr πŸ“£

INFO πŸ’€

INFO is INTEGER. If 0, then everything ran OK. The mood is immaculate when INFO is 0 ✨

  • -1: NSIZES < 0
  • -2: Some MM(j) < 0
  • -3: Some NN(j) < 0
  • -4: NTYPES < 0
  • -7: THRESH < 0
  • -10: LDA < 1 or LDA < MMAX, where MMAX is max( MM(j) ).
  • -12: LDU < 1 or LDU < MMAX.
  • -14: LDVT < 1 or LDVT < NMAX, where NMAX is max( NN(j) ).
  • -29: LWORK too small.

If CLATMS, or CGESVD returns an error code, the absolute value of it is returned. So yeah, INFO is basically the group chat receipts 😭


Author πŸŽ€

  • Univ. of Tennessee
  • Univ. of California Berkeley
  • Univ. of Colorado Denver
  • NAG Ltd.

Definition at line 397 of file cdrvbd.f.

Author (auto-gen moment) πŸ’»

Generated automatically by Doxygen for LAPACK from the source code.

Cute sign-off: this is the auto-generated source/version/date footer moment β€” LAPACK, Version 3.12.0, page TESTING/EIG/cdrvbd.f(3) β€” and that's the tea, bestie πŸ’–βœ¨

πŸ“¦ where this page comes from