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'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.
- 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 rowmand rowipivot[, then moves to the next-to-last row, interchanging rowsm- 1][and rowm- 2]ipivot[, and so on. In terms of "2-cycles", the permutation ism- 2](1where the rightmost cycle is applied first. This is the inverse of the effect of pivoting in LINPACK. The idea is that factoring (with pivoting) an identity matrix which has been inverse-pivoted in this way should result in a pivot vector identical toipivot) (2ipivot) ... (mipivot[m- 1])ipivot. Not referenced if.pivtng='N'
- On entry, specifies the sparsity of the matrix if a sparse matrix is to be generated.sparseshould lie between 0 and 1. To generate a sparse matrix, for each matrix entry a uniform ( 0, 1 ) random numberxis generated and compared to sparse; ifxis larger the matrix entry is unchanged and ifxis smaller the entry is set to zero. Thus on the average a fractionsparseof the entries is set to zero.
- On entry, specifies the lower bandwidth of the matrix. For example,implies upper triangular,kl= 0implies upper Hessenberg, andkl= 1klat leastm-1 implies the matrix is not banded. Must equalkuif matrix is symmetric or Hermitian.
- On entry, specifies the upper bandwidth of the matrix. For example,implies lower triangular,ku= 0implies lower Hessenberg, andku= 1kuat leastn-1 implies the matrix is not banded. Must equalklif matrix is symmetric or Hermitian.
- On entry, specifies maximum entry of output matrix (output matrix is multiplied by a constant so that its largest absolute entry equalanorm) ifanormis nonnegative. Ifanormis negative no scaling is done.
- On entry, specifies packing of matrix as follows:If: no packingpack='N'If: zero out all subdiagonal entries (if symmetric or Hermitian)pack='U'If: zero out all superdiagonal entries (if symmetric or Hermitian)pack='L'If: store the upper triangle columnwise (only if matrix symmetric or Hermitian or square upper triangular)pack='C'If: store the lower triangle columnwise (only if matrix symmetric or Hermitian or square lower triangular) (same as upper half rowwise if symmetric) (same as conjugate upper half rowwise if Hermitian)pack='R'If: store the lower triangle in band storage scheme (only if matrix symmetric or Hermitian)pack='B'If: store the upper triangle in band storage scheme (only if matrix symmetric or Hermitian)pack='Q'If: store the entire matrix in band storage scheme (pivoting can be provided for by using this option to storepack='Z'Ain the trailing rows of the allocated storage)Using these options, the various LAPACK packed and banded storage schemes can be obtained:LAPACK storage schemeValue ofpackGB'Z'PB, HB or TB'B'or'Q'PP, HP or TP'C'or'R'If two calls to?latmrdiffer only in the pack parameter, they generate mathematically equivalent matrices.
- On entry,ldaspecifies the first dimension ofaas declared in the calling program.If,pack='N','U'or'L'ldamust be at least.max( 1,m)If,pack='C'or'R'ldamust be at least 1.If,pack='B', or'Q'ldamust bemin(ku+ 1,n).If,pack='Z'ldamust be at least, wherekuu+kll+ 1kuu=min(andku,n-1 )kll=min(.kl,n-1 )
- Array, size (norm). Workspace. Not referenced if. Changed on exit.pivtng='N'
- On exit, the seed is changed.
- May be changed on exit ifmodeis nonzero.
- On exit, array is changed.
- On exit, array is changed.
- On exit,ais the desired test matrix. Only those entries ofawhich are significant on output is referenced (even ifais in packed or band storage format). The unoccupied corners ofain band format are zeroed out.
- If, the execution is successful.info= 0If,info= -1mis negative or unequal tonand.sym='S'or'H'If,info= -2nis negative .If,info= -3distis an illegal string.If,info= -5symis an illegal string..If,info= -7modeis not in range -6 to 6.If,info= -8condis less than 1.0, andmodeis neither -6, 0 nor 6.If,info= -10modeis neither -6, 0 nor 6 andrsignis an illegal string.If,info= -11gradeis an illegal string, orandgrade='E'mis not equal ton, orandgrade='L','R','B','S'or'E'andsym='H', orgrade='L','R','B','H'or'E'sym='S'If,info= -12andgrade='E'dlcontains zero .If,info= -13modelis not in range -6 to 6 and.grade='L','B','H','S'or'E'If,info= -14condlis less than 1.0,, andgrade='L','B','H','S'or'E'modelis neither -6, 0 nor 6.If,info= -16moderis not in range -6 to 6 andgrade='R'or'B'.If,info= -17condris less than 1.0,, andgrade='R'or'B'moderis neither -6, 0 nor 6 .If,info= -18pivtngis an illegal string, orandpivtng='B'or'F'mis not equal ton, orandpivtng='L'or'R'.sym='S'or'H'If,info= -19ipivotcontains out of range number andpivtngis not equal to'N'.If,info= -20klis negative.If,info= -21kuis negative, orandsym='S'or'H'kunot equal tokl.If,info= -22sparseis not in range 0 to 1.If,info= -24packis an illegal string, orandpack='U','L','B'or'Q', orsym='N'pack