On Thursday, December 4, 2014 6:43:40 AM UTC-8, kcrisman wrote:
>
>
> It's more surprising to me that Scipy can eat a Sage matrix, actually. 
>  Fredrik, any thoughts? 
>
My guess is that it's this:

sage: M=matrix(ZZ,5,5,[1..25]);
sage: [a for a in M]
[(1, 2, 3, 4, 5),
 (6, 7, 8, 9, 10),
 (11, 12, 13, 14, 15),
 (16, 17, 18, 19, 20),
 (21, 22, 23, 24, 25)]
That looks sufficiently 2-dimensional that scipy/numpy should be able to 
figure out a matrix from it. Indeed mpmath can do this too but is a little 
picky about lists/tuples  vs. iterables:

sage: mp.matrix(tuple(tuple(m) for m in M)) #with list instead of tuple 
works too
matrix(
[['1.0', '2.0', '3.0', '4.0', '5.0'],
 ['6.0', '7.0', '8.0', '9.0', '10.0'],
 ['11.0', '12.0', '13.0', '14.0', '15.0'],
 ['16.0', '17.0', '18.0', '19.0', '20.0'],
 ['21.0', '22.0', '23.0', '24.0', '25.0']])

You wouldn't want to do any of this on huge data sets.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to