/home/abui...N/clatmt.f(3)
π¦ clatmt.f(3) β Library Functions Manual π
Okay bestie, this is the clatmt.f(3) page β the LAPACK testing matrix-gen corner of the universe, and it's lowkey iconic. It generates random matrices with specified singular values (or hermitian matrices with specified eigenvalues) for testing LAPACK programs. Main character energy for test matrices, no cap. β¨
πΈ NAME πΈ
/home/abuild/rpmbuild/BUILD/lapack-
static-3.12.0-build/lapack-3.12.0/TESTING/MATGEN/clatmt.f
β¨ SYNOPSIS β¨
π§ Functions/Subroutines
subroutine CLATMT (m, n, dist, iseed, sym, d, mode, cond, dmax, rank,
kl, ku, pack, a, lda, work, info)
CLATMT
π Function/Subroutine Documentation π
subroutine CLATMT (integer m, integer n, character dist, integer, dimension(
4 ) iseed, character sym, real, dimension( * ) d, integer mode, real
cond, real dmax, integer rank, integer kl, integer ku, character pack,
complex, dimension( lda, * ) a, integer lda, complex, dimension( * )
work, integer info)
CLATMT
π Purpose π
Okay so CLATMT generates random matrices with specified singular values (or hermitian matrices with specified eigenvalues) for testing LAPACK programs. It's giving lab-grown test matrix, but make it glam. π
CLATMT operates by applying the following 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 N matrix by multiplying D on 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 M and N) this requires less storage, as a dense matrix is not generated. Also, for hermitian or 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 hermitian or 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 hermitian)
- zero out lower half (if hermitian)
- store the upper half columnwise (if hermitian or upper triangular)
- store the lower half columnwise (if hermitian or lower triangular)
- store the lower triangle in banded format (if hermitian or lower triangular)
- store the upper triangle in banded format (if hermitian 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.
π«Ά Parameters π«Ά
M
M is INTEGER β the number of rows of A. Not modified. π
ββοΈ
N
N is INTEGER β the number of columns of A. N must equal M if the matrix is symmetric or hermitian (i.e., if SYM is not 'N'). Not modified.
DIST
DIST is CHARACTER*1. On entry, DIST specifies 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 ISEED specifies the seed of the random number generator. They should lie between 0 and 4095 inclusive, and ISEED(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 of ISEED are changed on exit, and can be used in the next call to CLATMT to continue the same random number sequence. Changed on exit. π
SYM
SYM is CHARACTER*1.
- If
SYM='H', the generated matrix is hermitian, with eigenvalues specified byD,COND,MODE, andDMAX; they may be positive, negative, or zero. - If
SYM='P', the generated matrix is hermitian, 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. - If
SYM='S', the generated matrix is (complex) symmetric, with singular values specified byD,COND,MODE, andDMAX; they will not be negative.
Not modified.
D
D is REAL array, dimension ( MIN( M, N ) ). This array is used to specify the singular values or eigenvalues of A (see SYM, above.) If MODE=0, then D is assumed to contain the singular/eigenvalues, otherwise they will be computed according to MODE, COND, and DMAX, and placed in D. Modified if MODE is 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 < 0 has the same meaning as ABS(MODE), except that the order of the elements of D is reversed.
Thus if MODE is positive, D has entries ranging from 1 to 1/COND; if negative, from 1/COND to 1.
If SYM='H', and MODE is neither 0, 6, nor -6, then the elements of D will also be multiplied by a random sign (i.e., +1 or -1.)
Not modified.
COND
COND is REAL. On entry, this is used as described under MODE above. If used, it must be >= 1. Not modified.
DMAX
DMAX is REAL. If MODE is neither -6, 0 nor 6, the contents of D, as computed according to MODE and COND, will be scaled by DMAX / max(abs(D(i))); thus, the maximum absolute eigen- or singular value (which is to say the norm) will be abs(DMAX). Note that DMAX need not be positive: if DMAX is negative (or zero), D will be scaled by a negative number (or zero). Not modified. β οΈ
RANK
RANK is INTEGER. The rank of matrix to be generated for modes 1,2,3 only. D( RANK+1:N ) = 0. Not modified.
KL
KL is INTEGER. This specifies the lower bandwidth of the matrix. For example, KL=0 implies upper triangular, KL=1 implies upper Hessenberg, and KL being at least M-1 means that the matrix has full lower bandwidth. KL must equal KU if the matrix is symmetric or hermitian. Not modified.
KU
KU is INTEGER. This specifies the upper bandwidth of the matrix. For example, KU=0 implies lower triangular, KU=1 implies lower Hessenberg, and KU being at least N-1 means that the matrix has full upper bandwidth. KL must equal KU if the matrix is symmetric or hermitian. Not modified.
π¦ PACK
PACKβCHARACTER*1. This is the β¨aestheticβ¨ setting, bestie: it tells CLATMT how to tuck the matrix into storage. The options are:'N'=> no packing at all, just vibes, matrix laid out plain'U'=> zero out all subdiagonal entries (only if it's symmetric or hermitian)'L'=> zero out all superdiagonal entries (again, only if symmetric or hermitian)'C'=> store the upper triangle columnwise (only if the matrix is symmetric, hermitian, or upper triangular)'R'=> store the lower triangle columnwise (only if the matrix is symmetric, hermitian, or lower triangular)'B'=> store the lower triangle in band storage scheme (only if symmetric, hermitian, or lower triangular)'Q'=> store the upper triangle in band storage scheme (only if symmetric, hermitian, or upper triangular)'Z'=> store the entire matrix in band storage scheme (and yes, pivoting can be provided for by using this option to storeAin the trailing rows of the allocated storage π)
Okay so with these options you can get all the LAPACK packed and banded storage schemes, like:
GBβ use'Z'PB,SB,HB, orTBβ use'B'or'Q'PP,SP,HB, orTPβ use'C'or'R'
And the cute part: if two calls to CLATMT differ only in the PACK parameter, they'll generate mathematically equivalent matrices. Periodt. π
Not modified.
AβCOMPLEXarray, dimension( LDA, N ). On exit,Ais the desired test matrix β the main character, honestly.Agets generated in full (unpacked) form first, and then packed ifPACKsays so. So the firstMelements of the firstNcolumns are always modified. But ifPACKspecifies a packed or banded storage scheme, then allLDAelements of the firstNcolumns get modified, and the elements of the array that don't correspond to elements of the generated matrix are just set to zero (they're filler, they're the extras, they're background characters π).
Modified.
LDAβINTEGER. This is the first dimension ofAas declared in the calling program, iykyk. The rules, fr fr:- If
PACK='N','U','L','C', or'R', thenLDAmust be at leastM. - If
PACK='B'or'Q', thenLDAmust be at leastMIN( KL, M-1)(which is equal toMIN(KU,N-1)). - If
PACK='Z',LDAmust be large enough to hold the packed array:MIN( KU, N-1) + MIN( KL, M-1) + 1.
- If
Not modified.
WORKβCOMPLEXarray, dimension( 3*MAX( N, M ) ). It's the workspace. The little helper. The emotional support array. π«Ά
Modified.
INFOβINTEGER. The error code! On exit,INFOgets set to one of these, so pay attention bestie:
0 => normal return
-1 => M negative or unequal to N and SYM='S', 'H', or 'P'
-2 => N negative
-3 => DIST illegal string
-5 => SYM illegal string
-7 => MODE not in range -6 to 6
-8 => COND less than 1.0, and MODE neither -6, 0 nor 6
-10 => KL negative
-11 => KU negative, or SYM is not 'N' and KU is not equal to
KL
-12 => PACK illegal string, or PACK='U' or 'L', and SYM='N';
or PACK='C' or 'Q' and SYM='N' and KL is not zero;
or PACK='R' or 'B' and SYM='N' and KU is not zero;
or PACK='U', 'L', 'C', 'R', 'B', or 'Q', and M is not
N.
-14 => LDA is less than M, or PACK='Z' and LDA is less than
MIN(KU,N-1) + MIN(KL,M-1) + 1.
1 => Error return from SLATM7
2 => Cannot scale to DMAX (max. sing. value is 0)
3 => Error return from CLAGGE, CLAGHE or CLAGSY
Note the gaps, bestie β there's no-4,-6,-9, or-13in that list. That's not me skipping anything, that's literally how it is. π
π Author
Slay, honestly. The credit goes to:
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Definition at line 338 of file clatmt.f. π
π§ Author (the meta one)
Generated automatically by Doxygen for LAPACK from the source code. The robots did this part, not me. π€β¨
Okay that's the whole page bestie, you ate that π
πΈ This was LAPACK Version 3.12.0, living over at /home/abui...N/clatmt.f(3) β go be iconic with your matrices, mwah πππ¦
π¦ 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