TESTING/MATGEN/dlatmt.f(3)
π
TESTING/MATGEN/dlatmt.f(3) π
From the Library Functions Manual, bestie β this is the DLATMT page, and it is genuinely so good at making random matrices for LAPACK testing. π¦
πΈ NAME πΈ
TESTING/MATGEN/dlatmt.f β the manual page for the DLATMT routine, straight out of the Library Functions Manual π
π¦ SYNOPSIS π¦
β¨ Functions/Subroutines β¨
subroutine dlatmt (m, n, dist, iseed, sym, d, mode, cond, dmax, rank,
kl, ku, pack, a, lda, work, info)
DLATMT π
π Function/Subroutine Documentation π
π subroutine dlatmt (...) π
subroutine dlatmt (integer m, integer n, character dist, integer, dimension(
4 ) iseed, character sym, double precision, dimension( * ) d, integer
mode, double precision cond, double precision dmax, integer rank,
integer kl, integer ku, character pack, double precision, dimension(
lda, * ) a, integer lda, double precision, dimension( * ) work, integer
info)
DLATMT π
β¨ Purpose β¨
Okay so bestie, DLATMT generates random matrices with specified singular values β or symmetric/hermitian matrices with specified eigenvalues β for testing LAPACK programs. Iconic behavior, honestly. π
It operates by applying this sequence of operations:
- Set the diagonal to
D, whereDmay be input or computed according toMODE,COND,DMAX, andSYMas described below. π - Generate a matrix with the appropriate band structure, by one of two methods:
π Method A π
- Generate a dense
M x Nmatrix by multiplyingDon the left and the right by random unitary matrices, then: - Reduce the bandwidth according to
KLandKU, using Householder transformations.
π¦ Method B π¦
- Convert the bandwidth-0 (i.e., diagonal) matrix to a bandwidth-1 matrix using Givens rotations, out-of-band elements back, much as in QR; then convert the bandwidth-1 to a bandwidth-2 matrix, etc.
- Note that for reasonably small bandwidths (relative to
MandN) this requires less storage, as a dense matrix is not generated. - Also, for symmetric matrices, only one triangle is generated. π
Method A is chosen if the bandwidth is a large fraction of the order of the matrix, and LDA is at least M (so a dense matrix can be stored.)
Method B is chosen if the bandwidth is small (< 1/2 N for symmetric, < .3 N+M for non-symmetric), or LDA is less than M and not less than the bandwidth.
Pack the matrix if desired. Options specified by PACK are:
- no packing
- zero out upper half (if symmetric)
- zero out lower half (if symmetric)
- store the upper half columnwise (if symmetric or upper triangular)
- store the lower half columnwise (if symmetric or lower triangular)
- store the lower triangle in banded format (if symmetric or lower triangular)
- store the upper triangle in banded format (if symmetric or upper triangular)
- store the entire matrix in banded format
If Method B is chosen, and band format is specified, then the matrix will be generated in the band format, so no repacking will be necessary. No cap. β¨
π«Ά Parameters π«Ά
MβM is INTEGER. Itβs the number of rows ofA. Not modified. πNβN is INTEGER. Itβs the number of columns ofA. Not modified. πDISTβDIST is CHARACTER*1. On entry,DISTspecifies the type of distribution to be used to generate the random eigen-/singular values:'U'=>UNIFORM( 0, 1 )('U'for uniform)'S'=>UNIFORM( -1, 1 )('S'for symmetric)'N'=>NORMAL( 0, 1 )('N'for normal) Not modified. π
ISEEDβISEED is INTEGER array, dimension ( 4 ). On entry,ISEEDspecifies the seed of the random number generator. They should lie between0and4095inclusive, andISEED(4)should 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 toDLATMTto continue the same random number sequence. Changed on exit. πSYMβSYM is CHARACTER*1.- If
SYM='S'or'H', the generated matrix is symmetric, with eigenvalues specified byD,COND,MODE, andDMAX; they may be positive, negative, or zero. - If
SYM='P', the generated matrix is symmetric, with eigenvalues (= singular values) specified byD,COND,MODE, andDMAX; they will not be negative. - If
SYM='N', the generated matrix is nonsymmetric, with singular values specified byD,COND,MODE, andDMAX; they will not be negative. Not modified. πΈ
- If
DβD is DOUBLE PRECISION array, dimension ( MIN( M , N ) ). This array is used to specify the singular values or eigenvalues ofA(seeSYM, above.) IfMODE=0, thenDis assumed to contain the singular/eigenvalues, otherwise they will be computed according toMODE,COND, andDMAX, and placed inD. Modified ifMODEis nonzero. πMODEβMODE is INTEGER. On entry this describes how the singular/eigenvalues are to be specified:MODE = 0means useDas inputMODE = 1setsD(1)=1andD(2:RANK)=1.0/CONDMODE = 2setsD(1:RANK-1)=1andD(RANK)=1.0/CONDMODE = 3setsD(I)=COND**(-(I-1)/(RANK-1))MODE = 4setsD(i)=1 - (i-1)/(N-1)*(1 - 1/COND)MODE = 5setsDto random numbers in the range( 1/COND , 1 )such that their logarithms are uniformly distributed.MODE = 6setDto random numbers from same distribution as the rest of the matrix.MODE < 0has the same meaning asABS(MODE), except that the order of the elements ofDis reversed.- Thus if
MODEis positive,Dhas entries ranging from1to1/COND, if negative, from1/CONDto1. - If
SYM='S'or'H', andMODEis neither0,6, nor-6, then the elements ofDwill also be multiplied by a random sign (i.e.,+1or-1.) Not modified. π¦
CONDβCOND is DOUBLE PRECISION. On entry, this is used as described underMODEabove. If used, it must be>= 1. Not modified. β¨DMAXβDMAX is DOUBLE PRECISION. IfMODEis neither-6,0nor6, the contents ofD, as computed according toMODEandCOND, will be scaled byDMAX / max(abs(D(i))); thus, the maximum absolute eigen- or singular value (which is to say the norm) will beabs(DMAX). Note thatDMAXneed not be positive: ifDMAXis negative (or zero),Dwill be scaled by a negative number (or zero). Not modified. πRANKβRANK is INTEGER. The rank of matrix to be generated for modes1,2,3only.D( RANK+1:N ) = 0. Not modified. πKLβKL is INTEGER. This specifies the lower bandwidth of the matrix. For example,KL=0implies upper triangular,KL=1implies upper Hessenberg, andKLbeing at leastM-1means that the matrix has full lower bandwidth.KLmust equalKUif the matrix is symmetric. Not modified. πKUβKU is INTEGER. This specifies the upper bandwidth of the matrix. For example,KU=0implies lower triangular,KU=1implies lower Hessenberg, andKUbeing at leastN-1means that the matrix has full upper bandwidth.KLmust equalKUif the matrix is symmetric. Not modified. πPACKβPACK is CHARACTER*1. This specifies packing of matrix as follows:'N'=> no packing'U'=> zero out all subdiagonal entries (if symmetric)'L'=> zero out all superdiagonal entries (if symmetric)'C'=> store the upper triangle columnwise (only if the matrix is symmetric or upper triangular)'R'=> store the lower triangle columnwise (only if the matrix is symmetric or lower triangular)'B'=> store the lower triangle in band storage scheme (only if matrix symmetric or lower triangular)'Q'=> store the upper triangle in band storage scheme (only if matrix symmetric or upper triangular)'Z'=> store the entire matrix in band storage scheme (pivoting can be provided for by using this option to storeAin the trailing rows of the allocated storage)
Using these options, the various LAPACK packed and banded storage schemes can be obtained:
GBβ use'Z'PB,SBorTBβ use'B'or'Q'PP,SPorTPβ use'C'or'R'
If two calls to DLATMT differ only in the PACK parameter, they will generate mathematically equivalent matrices. Not modified. π
AAβ soAis aDOUBLE PRECISIONarray, dimension( LDA, N ). On exit,Ais literally the desired test matrix π . It gets generated in full (unpacked) form first, and then packed ifPACKsays so. That means the firstMelements of the firstNcolumns will always be modified. IfPACKspecifies a packed or banded storage scheme, then allLDAelements of the firstNcolumns get modified; any elements of the array that donβt correspond to elements of the generated matrix are set to zero. Modified. β¨LDAβLDAisINTEGER. It specifies the first dimension ofAas declared in the calling program. IfPACK='N','U','L','C', or'R', thenLDAmust be at leastM. IfPACK='B'or'Q', thenLDAmust be at leastMIN( KL, M-1)(which is equal toMIN(KU,N-1)). IfPACK='Z',LDAmust be large enough to hold the packed array:MIN( KU, N-1) + MIN( KL, M-1) + 1. Not modified. π«ΆWORKβWORKis aDOUBLE PRECISIONarray, dimension( 3*MAX( N , M ) ). Itβs workspace. Modified. π οΈINFOβINFOisINTEGER. Itβs the error code. On exit,INFOwill be set to one of these values, bestie:0=> normal return-1=>Mnegative or unequal toNandSYM='S','H', or'P'-2=>Nnegative-3=>DISTillegal string-5=>SYMillegal string-7=>MODEnot in range-6to6-8=>CONDless than1.0, andMODEneither-6,0nor6-10=>KLnegative-11=>KUnegative, orSYM='S'or'H'andKUnot equal toKL-12=>PACKillegal string, orPACK='U'or'L', andSYM='N'; orPACK='C'or'Q'andSYM='N'andKLis not zero; orPACK='R'or'B'andSYM='N'andKUis not zero; orPACK='U','L','C','R','B', or'Q', andMis notN.-14=>LDAis less thanM, orPACK='Z'andLDAis less thanMIN(KU,N-1) + MIN(KL,M-1) + 1.1=> Error return fromDLATM72=> Cannot scale toDMAX(max. sing. value is0)3=> Error return fromDLAGGEorDLAGSY
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Definition at line 329 of file dlatmt.f.
Author
Generated automatically by Doxygen for LAPACK from the source code.
Thatβs the whole vibe, bestie β source: LAPACK Version 3.12.0, page TESTING/MATGEN/dlatmt.f(3). Go off, you got this πβ¨π
π¦ 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