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

fillMatrix -- fill a mutable matrix with random numbers

Synopsis

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       243/835 89/26 0     76/169 0       0 473/389 2/9    |
     | 0 0       0       0     0     0      0       0 0       0      |
     | 0 250/159 519/809 0     79/74 0      701/437 0 377/614 0      |
     | 0 0       0       0     0     0      0       0 0       0      |
     | 0 0       0       0     0     0      0       0 31/951  38/707 |

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

o5 = | 0   0   0   0   693 0   0   0 0   0   |
     | 830 622 0   655 817 0   170 0 851 155 |
     | 948 0   520 0   0   897 0   0 591 0   |
     | 0   391 0   274 0   968 0   0 0   596 |
     | 12  0   0   366 0   625 181 0 0   0   |

o5 : MutableMatrix

See also

Ways to use fillMatrix :

For the programmer

The object fillMatrix is a method function with options.