Functions for changing the base ring of matrices quickly#

sage.matrix.change_ring.integer_to_real_double_dense(A)[source]#

Fast conversion of a matrix over the integers to a matrix with real double entries.

INPUT:

A – a dense matrix over the integers

OUTPUT:

– a dense real double matrix

EXAMPLES:

sage: a = matrix(ZZ,2,3,[-2,-5,3,4,8,1030339830489349908])
sage: a.change_ring(RDF)
[                  -2.0                   -5.0                    3.0]
[                   4.0                    8.0 1.0303398304893499e+18]
sage: import sage.matrix.change_ring
sage: sage.matrix.change_ring.integer_to_real_double_dense(a)
[                  -2.0                   -5.0                    3.0]
[                   4.0                    8.0 1.0303398304893499e+18]
>>> from sage.all import *
>>> a = matrix(ZZ,Integer(2),Integer(3),[-Integer(2),-Integer(5),Integer(3),Integer(4),Integer(8),Integer(1030339830489349908)])
>>> a.change_ring(RDF)
[                  -2.0                   -5.0                    3.0]
[                   4.0                    8.0 1.0303398304893499e+18]
>>> import sage.matrix.change_ring
>>> sage.matrix.change_ring.integer_to_real_double_dense(a)
[                  -2.0                   -5.0                    3.0]
[                   4.0                    8.0 1.0303398304893499e+18]