Misc matrix algorithms using FLINT#

sage.matrix.misc_flint.matrix_integer_dense_rational_reconstruction(A, N)#

Given a matrix over the integers and an integer modulus, do rational reconstruction on all entries of the matrix, viewed as numbers mod \(N\). This is done efficiently by assuming there is a large common factor dividing the denominators.

INPUT:

  • A – matrix

  • N – an integer

EXAMPLES:

sage: B = ((matrix(ZZ, 3,4, [1,2,3,-4,7,2,18,3,4,3,4,5])/3)%500).change_ring(ZZ)
sage: from sage.matrix.misc_flint import matrix_integer_dense_rational_reconstruction
sage: matrix_integer_dense_rational_reconstruction(B, 500)
[ 1/3  2/3    1 -4/3]
[ 7/3  2/3    6    1]
[ 4/3    1  4/3  5/3]