?latmr
?latmr
Generates random matrices of various types.
Syntax
void slatmr
(
lapack_int
*m
,
lapack_int
*n
,
char
*dist
,
lapack_int
*iseed
,
char
*sym
,
float
*d
,
lapack_int
*mode
,
float
*cond
,
float
*dmax
,
char
*rsign
,
char
*grade
,
float
*dl
,
lapack_int
*model
,
float
*condl
,
float
*dr
,
lapack_int
*moder
,
float
*condr
,
char
*pivtng
,
lapack_int
*ipivot
,
lapack_int
*kl
,
lapack_int
*ku
,
float
*sparse
,
float
*anorm
,
char
*pack
,
float
*a
,
lapack_int
*lda
,
lapack_int
*iwork
,
lapack_int
*info
);
void dlatmr
(
lapack_int
*m
,
lapack_int
*n
,
char
*dist
,
lapack_int
*iseed
,
char
*sym
,
double
*d
,
lapack_int
*mode
,
double
*cond
,
double
*dmax
,
char
*rsign
,
char
*grade
,
double
*dl
,
lapack_int
*model
,
double
*condl
,
double
*dr
,
lapack_int
*moder
,
double
*condr
,
char
*pivtng
,
lapack_int
*ipivot
,
lapack_int
*kl
,
lapack_int
*ku
,
double
*sparse
,
double
*anorm
,
char
*pack
,
double
*a
,
lapack_int
*lda
,
lapack_int
*iwork
,
lapack_int
*info
);
void clatmr
(
lapack_int
*m
,
lapack_int
*n
,
char
*dist
,
lapack_int
*iseed
,
char
*sym
,
lapack_complex
*d
,
lapack_int
*mode
,
float
*cond
,
lapack_complex
*dmax
,
char
*rsign
,
char
*grade
,
lapack_complex
*dl
,
lapack_int
*model
,
float
*condl
,
lapack_complex
*dr
,
lapack_int
*moder
,
float
*condr
,
char
*pivtng
,
lapack_int
*ipivot
,
lapack_int
*kl
,
lapack_int
*ku
,
float
*sparse
,
float
*anorm
,
char
*pack
,
float
*a
,
lapack_int
*lda
,
lapack_int
*iwork
,
lapack_int
*info
);
void zlatmr
(
lapack_int
*m
,
lapack_int
*n
,
char
*dist
,
lapack_int
*iseed
,
char
*sym
,
lapack_complex_double
*d
,
lapack_int
*mode
,
float
*cond
,
lapack_complex_double
*dmax
,
char
*rsign
,
char
*grade
,
lapack_complex_double
*dl
,
lapack_int
*model
,
float
*condl
,
lapack_complex_double
*dr
,
lapack_int
*moder
,
float
*condr
,
char
*pivtng
,
lapack_int
*ipivot
,
lapack_int
*kl
,
lapack_int
*ku
,
float
*sparse
,
float
*anorm
,
char
*pack
,
float
*a
,
lapack_int
*lda
,
lapack_int
*iwork
,
lapack_int
*info
);
Description
The
?latmr
routine operates by applying the following sequence of operations:
- Generate a matrixAwith random entries of distributiondist:If, the matrix is symmetric,sym='S'If, the matrix is Hermitian,sym='H'If, the matrix is nonsymmetric.sym='N'
- Set the diagonal toD, whereDmay be input or computed according tomode,cond,dmaxandrsignas described below.
- Grade the matrix, if desired, from the left or right as specified by grade. The inputsdl,model,condl,dr,moderandcondralso determine the grading as described below.
- Permute, if desired, the rows and/or columns as specified bypivtngandipivot.
- Set random entries to zero, if desired, to get a random sparse matrix as specified bysparse.
- MakeAa band matrix, if desired, by zeroing out the matrix outside a band of lower bandwidthkland upper bandwidthku.
- ScaleA, if desired, to have maximum entryanorm.
- Pack the matrix if desired. See options specified by thepackparameter.
If two calls to and ), and differ only in the
?latmr
differ only in the pack parameter, they generate
mathematically equivalent matrices. If two calls to ?latmr
both
have full bandwidth (kl
= m
-1ku
= n
-1pivtng
and pack
parameters, then the matrices generated differ
only in the order of the rows and columns, and otherwise contain
the same data. This consistency cannot be and is not maintained
with less than full bandwidth.
Input Parameters
- m
- Number of rows ofA.
- n
- Number of columns ofA.
- dist
- On entry,distspecifies the type of distribution to be used to generate a random matrix .If, real and imaginary parts are independent uniform( 0, 1 ).dist='U'If, real and imaginary parts are independent uniform( -1, 1 ).dist='S'If, real and imaginary parts are independent normal( 0, 1 ).dist='N'If, distribution is uniform on interior of unit disk.dist='D'
- iseed
- Array, size 4.On entry,iseedspecifies the seed of the random number generator. They should lie between 0 and 4095 inclusive, andiseed[3]should be odd. The random number generator uses a linear congruential sequence limited to small integers, and so should produce machine independent random numbers.
- sym
- If, generated matrix is symmetric.sym='S'If, generated matrix is Hermitian.sym='H'If, generated matrix is nonsymmetric.sym='N'
- d
- On entry this array specifies the diagonal entries of the diagonal ofA.dmay either be specified on entry, or set according tomodeandcondas described below. If the matrix is Hermitian, the real part ofdis taken. May be changed on exit ifmodeis nonzero.
- mode
- On entry describes howdis to be used:means usemode= 0das input.setsmode= 1andd[0]=1.d[1:=1.0/n- 1]condsetsmode= 2d[0:=1 andn- 2]d[n- 1]=1.0/.condsetsmode= 3.d[=i- 1]cond**(-(i-1)/(n-1))setsmode= 4.d[=1 - (i- 1]i-1)/(n-1)*(1 - 1/cond)setsmode= 5dto random numbers in the range( 1/such that their logarithms are uniformly distributed.cond, 1 )setsmode= 6dto random numbers from same distribution as the rest of the matrix.has the same meaning asmode< 0abs(, except that the order of the elements ofmode)dis reversed.Thus ifmodeis between 1 and 4,dhas entries ranging from 1 to 1/cond, if between -1 and -4,Dhas entries ranging from 1/condto 1.
- cond
- On entry, used as described undermodeabove. If used,condmust be≥1.
- dmax
- Ifmodeis not -6, 0, or 6, the diagonal is scaled by, so that maximum absolute entry of diagonal isdmax/ max(abs(d[))i]abs(. Ifdmax)dmaxis complex (or zero), the diagonal is scaled by a complex number (or zero).
- rsign
- Ifmodeis not -6, 0, or 6, specifies the sign of the diagonal as follows:Forslatmranddlatmr, if, diagonal entries are multiplied 1 or -1 with a probability of 0.5.rsign='T'Forclatmrandzlatmr, if, diagonal entries are multiplied by a random complex number uniformly distributed with absolute value 1.rsign='T'Ifr, diagonal entries are unchanged.sign='F'
- grade
- Specifies grading of matrix as follows:If, there is no gradinggrade='N'If, matrix is premultiplied by diag(grade='L'dl) (only if matrix is nonsymmetric)If, matrix is postmultiplied by diag(grade='R'dr) (only if matrix is nonsymmetric)If, matrix is premultiplied by diag(grade='B'dl) and postmultiplied by diag(dr) (only if matrix is nonsymmetric)If, matrix is premultiplied by diag(grade='H'dl) and postmultiplied by diag(conjg() (only if matrix is Hermitian or nonsymmetric)dl)If, matrix is premultiplied by diag(grade='S'dl) and postmultiplied by diag(dl) (only if matrix is symmetric or nonsymmetric)If, matrix is premultiplied by diag(grade='E'dl) and postmultiplied byinv( diag((only if matrix is nonsymmetric)dl) )if, thengrade='E'mmust equaln.
- dl
- Array, size (m).If, then on entry this array specifies the diagonal entries of a diagonal matrix used as described under grade above.model= 0Ifmodelis not zero, thendlis set according tomodelandcondl, analogous to the wayDis set according tomodeandcond(except there is nodmaxparameter fordl).If, thengrade='E'dlcannot have zero entries.Not referenced if. Changed on exit.grade='N'or'R'
- model
- This specifies how the diagonal arraydlis computed, just asmodespecifies howDis computed.
- condl
- Whenmodelis not zero, this specifies the condition number of the computeddl.
- dr
- If, then on entry this array specifies the diagonal entries of a diagonal matrix used as described undermoder= 0gradeabove.Ifmoderis not zero, thendris set according tomoderandcondr, analogous to the waydis set according tomodeandcond(except there is nodmaxparameter fordr).Not referenced ifgrade='N','L','H''S'or'E'.
- moder
- This specifies how the diagonal arraydris to be computed, just as mode specifies howdis to be computed.
- condr
- Whenmoderis not zero, this specifies the condition number of the computeddr.
- pivtng
- On entry specifies pivoting permutations as follows:If: no pivoting permutation.pivtng='N'or' 'If: left or row pivoting (matrix must be nonsymmetric).pivtng='L'If: right or column pivoting (matrix must be nonsymmetric).pivtng='R'If: both or full pivoting, i.e., on both sides. In this case,pivtng='B'or'F'mmust equaln.If two calls to?latmrboth have full bandwidth (andkl=m- 1), and differ only in theku=n-1pivtngandpackparameters, then the matrices generated differs only in the order of the rows and columns, and otherwise contain the same data. This consistency cannot be maintained with less than full bandwidth.
- ipivot
- Array, size (norm) This array specifies the permutation used. After the basic matrix is generated, the rows, columns, or both are permuted.If row pivoting is selected,?latmrstarts with the last row and interchanges rowm<