Macaulay2 » Documentation
Packages » DeterminantalRepresentations :: roundMatrix
next | previous | forward | backward | up | index | toc

roundMatrix -- lifts matrix over RR to matrix over QQ

Description

This method converts a real matrix to a rational matrix, by rounding each entry. The input $n$ specifies the number of (decimal) digits used for rounding.

i1 : A = matrix{{1, 2.5, -13/17}, {2*pi, 4.7, sqrt(2)}}

o1 = | 1       2.5 -.764706 |
     | 6.28319 4.7 1.41421  |

                2         3
o1 : Matrix RR    <-- RR
              53        53
i2 : roundMatrix(5, A)

o2 = | 1             5/2   -76471/100000 |
     | 628319/100000 47/10 141421/100000 |

              2       3
o2 : Matrix QQ  <-- QQ

See also

Ways to use roundMatrix:

  • roundMatrix(ZZ,Matrix)

For the programmer

The object roundMatrix is a method function.


The source of this document is in /build/reproducible-path/macaulay2-1.25.05+ds/M2/Macaulay2/packages/DeterminantalRepresentations.m2:1291:0.