Macaulay2 » Documentation
Packages » Macaulay2Doc » matrices » mutable matrices » fillMatrix
next | previous | forward | backward | up | index | toc

fillMatrix -- fill a mutable matrix with random numbers

Description

i1 : printingPrecision = 2

o1 = 2
i2 : fillMatrix(mutableMatrix(RR,5,10))

o2 = | .89  .71 .91  .71 .35 .54 .19  .39 .28 .89  |
     | .67  .89 .31  .13 .56 .87 .4   .56 .61 .17  |
     | .29  .23 .074 .25 .25 .42 .62  .87 .97 .97  |
     | .63  .46 .81  .74 .15 .61 .015 .7  .68 .065 |
     | .026 .78 .36  .11 .83 .85 .22  .68 .91 .88  |

o2 : MutableMatrix
i3 : fillMatrix(mutableMatrix(ZZ,5,10),UpperTriangular=>true)

o3 = | 0 8 2 1 6 4 2 5 6 7 |
     | 0 0 2 7 7 0 6 4 4 9 |
     | 0 0 0 5 4 1 1 9 8 0 |
     | 0 0 0 0 5 4 1 7 4 9 |
     | 0 0 0 0 0 4 4 4 2 3 |

o3 : MutableMatrix
i4 : fillMatrix(mutableMatrix(QQ,5,10),Density=>.2,Height=>1000)

o4 = | 0 0       519/809 473/389 0       31/951 0      0 71/831  543/449 |
     | 0 0       0       0       0       0      0      0 0       0       |
     | 0 243/835 701/437 0       377/614 0      38/707 0 71/182  0       |
     | 0 0       0       0       0       0      0      0 0       0       |
     | 0 0       0       0       0       0      0      0 969/694 560/949 |

o4 : MutableMatrix
i5 : fillMatrix(mutableMatrix(ZZ,5,10),25,Height=>1000)

o5 = | 0   0   0   0   591 0   0   0 0   0   |
     | 851 968 0   625 366 0   12  0 596 245 |
     | 622 0   253 0   0   259 0   0 876 0   |
     | 0   520 0   704 0   655 0   0 0   311 |
     | 940 0   0   631 0   249 897 0 0   0   |

o5 : MutableMatrix

See also

Ways to use fillMatrix:

  • fillMatrix(MutableMatrix)
  • fillMatrix(MutableMatrix,ZZ)

For the programmer

The object fillMatrix is a method function with options.


The source of this document is in Macaulay2Doc/functions/random-doc.m2:315:0.