On 7/22/10 1:21 PM, VictorMiller wrote:
I had thought that repr(A) (where A is some object) was supposed to be
a string with property that eval(repr(A)) == A.
However, if A is a dense matrix (whose size is above some threshold)
what I get instead is
something like:
'212 x 212 dense matrix over Finite Field of size 2'
I could understand is str produces this, but not repr. So if I wanted
to write out a string representing this matrix to a file (say) what
function or method should I use?
We've intentionally broken that convention for lots of things in Sage.
However, Carl Witty did a fantastic job of writing some code to get back
what you are talking about. See the sage_input command:
sage: a=random_matrix(GF(2), 5)
sage: a
[1 0 1 1 0]
[0 1 1 0 1]
[1 1 0 1 1]
[1 1 0 1 1]
[0 1 1 1 1]
sage: sage_input(a)
matrix(GF(2), [[1, 0, 1, 1, 0], [0, 1, 1, 0, 1], [1, 1, 0, 1, 1], [1, 1,
0, 1, 1], [0, 1, 1, 1, 1]])
Like kcrisman, I've also used a.rows() for this sort of thing.
Thanks,
Jason
--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org