TESTING/MATGEN/slatm7.f(3)
π TESTING/MATGEN/slatm7.f π
okay bestie, so this one is a Fortran subroutine page from the LAPACK docs β it lives in TESTING/MATGEN/slatm7.f and honestly? it's a whole vibe. it's a little helper that builds you a diagonal array D full of exactly the kind of numbers you asked for. let's get into it β¨
β¨ SYNOPSIS β¨
πΈ Functions/Subroutines
subroutine slatm7 (mode, cond, irsign, idist, iseed, d, n, rank, info)β literally the one and only,SLATM7herself π
π Function/Subroutine Documentation π
subroutine slatm7 (integer mode, real cond, integer irsign, integer idist,
integer, dimension( 4 ) iseed, real, dimension( * ) d, integer n,
integer rank, integer info)
SLATM7 β that's her name, don't wear it out π
π¦ Purpose:
!> !> SLATM7 computes the entries of D as specified by MODE !> COND and IRSIGN. IDIST and ISEED determine the generation !> of random numbers. SLATM7 is called by SLATMT to generate !> random test matrices. !>
so basically: SLATM7 fills in the entries of D following whatever MODE, COND and IRSIGN say, and IDIST + ISEED are the ones running the random number situation. she gets called by SLATMT to make random test matrices. teamwork, no cap π«Ά
π The Arguments, One By One π
!> MODE - INTEGER !> On entry describes how D is to be computed: !> MODE = 0 means do not change D. !> !> MODE = 1 sets D(1)=1 and D(2:RANK)=1.0/COND !> MODE = 2 sets D(1:RANK-1)=1 and D(RANK)=1.0/COND !> MODE = 3 sets D(I)=COND**(-(I-1)/(RANK-1)) I=1:RANK !> !> MODE = 4 sets D(i)=1 - (i-1)/(N-1)*(1 - 1/COND) !> MODE = 5 sets D to random numbers in the range !> ( 1/COND , 1 ) such that their logarithms !> are uniformly distributed. !> MODE = 6 set D to 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, !> Not modified. !>
okay so MODE is the main character here β she decides the whole game plan for D:
MODE = 0β leaveDexactly as it is, hands off πMODE = 1β setsD(1)=1andD(2:RANK)=1.0/CONDMODE = 2β setsD(1:RANK-1)=1andD(RANK)=1.0/CONDMODE = 3β setsD(I)=COND**(-(I-1)/(RANK-1))forI=1:RANKMODE = 4β setsD(i)=1 - (i-1)/(N-1)*(1 - 1/COND)MODE = 5β setsDto random numbers in the range( 1/COND , 1 )such that their logarithms are uniformly distributed π²MODE = 6β setsDto random numbers from the same distribution as the rest of the matrixMODE < 0β same meaning asABS(MODE), EXCEPT the order of the elements ofDgets reversed π
so if MODE is positive, D runs from 1 to 1/COND; if it's negative, it runs from 1/COND to 1. and note: not modified. π
!> COND - REAL !> On entry, used as described under MODE above. !> If used, it must be >= 1. Not modified. !>
COND β a REAL, used exactly how MODE said up there. if it's actually used, it must be >= 1 (put that in your notes bestie). not modified. β
!> IRSIGN - INTEGER !> On entry, if MODE neither -6, 0 nor 6, determines sign of !> entries of D !> 0 => leave entries of D unchanged !> 1 => multiply each entry of D by 1 or -1 with probability .5 !>
IRSIGN β an INTEGER. when MODE is neither -6, 0 nor 6, this decides the sign of D's entries:
0β leave entries ofDunchanged1β multiply each entry ofDby1or-1with probability.5π²
!> IDIST - CHARACTER*1 !> On entry, IDIST specifies the type of distribution to be !> used to generate a random matrix . !> 1 => UNIFORM( 0, 1 ) !> 2 => UNIFORM( -1, 1 ) !> 3 => NORMAL( 0, 1 ) !> Not modified. !>
IDIST β documented here as CHARACTER*1 (yes, even though the signature declares it integer β that's just how the page do π). it picks the distribution for generating the random matrix:
1βUNIFORM( 0, 1 )2βUNIFORM( -1, 1 )3βNORMAL( 0, 1 )
not modified. π
!> ISEED - INTEGER array, dimension ( 4 ) !> On entry ISEED specifies the seed of the random number !> generator. 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 SLATM7 !> to continue the same random number sequence. !> Changed on exit. !>
ISEED β INTEGER array, dimension ( 4 ), the seed of the random number generator β¨ the generator uses a linear congruential sequence limited to small integers, so it should produce machine independent random numbers (iconic behaviour honestly). the values of ISEED get changed on exit, and you can pass them into the next SLATM7 call to continue the same sequence. changed on exit β clock it. β°
!> D - REAL array, dimension ( MIN( M , N ) ) !> Array to be computed according to MODE, COND and IRSIGN. !> May be changed on exit if MODE is nonzero. !>
D β REAL array, dimension ( MIN( M , N ) ). the array that gets computed according to MODE, COND and IRSIGN. may be changed on exit if MODE is nonzero. she's the star of the show π«
!> N - INTEGER !> Number of entries of D. Not modified. !>
N β INTEGER, the number of entries of D. not modified. π
!> RANK - INTEGER !> The rank of matrix to be generated for modes 1,2,3 only. !> D( RANK+1:N ) = 0. !> Not modified. !>
RANK β INTEGER, the rank of the matrix to be generated, for modes 1, 2, 3 only. also: D( RANK+1:N ) = 0. not modified. π
!> INFO - INTEGER !> 0 => normal termination !> -1 => if MODE not in range -6 to 6 !> -2 => if MODE neither -6, 0 nor 6, and !> IRSIGN neither 0 nor 1 !> -3 => if MODE neither -6, 0 nor 6 and COND less than 1 !> -4 => if MODE equals 6 or -6 and IDIST not in range 1 to 3 !> -7 => if N negative !>
INFO β INTEGER, the receipts π:
0β normal termination (we love a happy ending)-1β ifMODEnot in range-6to6-2β ifMODEneither-6,0nor6, andIRSIGNneither0nor1-3β ifMODEneither-6,0nor6andCONDless than1-4β ifMODEequals6or-6andIDISTnot in range1to3-7β ifNnegative
and yes, there's genuinely no-5or-6in that list β don't come for me, that's just what the page says π
π Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
the whole squad behind it π«Ά
β Definition
Definition at line 120 of file slatm7.f.
π§ Sign-off π§
this page was generated automatically by Doxygen for LAPACK from the source code β so nobody hand-wrote it, it just manifested β¨ and it's from LAPACK, Version 3.12.0. slay, go build your test matrices bestie ππ
π¦ 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