Generates random matrices of various types.
?latmrroutine 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
?latmrdiffer only in the pack parameter, they generate mathematically equivalent matrices. If two calls to
?latmrboth have full bandwidth (
), and differ only in the
packparameters, 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.
- Number of rows ofA.
- Number of columns ofA.
- 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'
- Array, size 4.On entry,iseedspecifies the seed of the random number generator. They should lie between 0 and 4095 inclusive, andiseedshould be odd. The random number generator uses a linear congruential sequence limited to small integers, and so should produce machine independent random numbers.
- If, generated matrix is symmetric.sym='S'If, generated matrix is Hermitian.sym='H'If, generated matrix is nonsymmetric.sym='N'
- 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.
- On entry describes howdis to be used:means usemode= 0das input.setsmode= 1andd=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.
- On entry, used as described undermodeabove. If used,condmust be≥1.
- 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).
- 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'
- 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.
- 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'
- This specifies how the diagonal arraydlis computed, just asmodespecifies howDis computed.
- Whenmodelis not zero, this specifies the condition number of the computeddl.
- 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'.
- This specifies how the diagonal arraydris to be computed, just as mode specifies howdis to be computed.
- Whenmoderis not zero, this specifies the condition number of the computeddr.
- 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'