On 04/19/2010 07:18 PM, Jason Grout wrote:
On 04/16/2010 05:41 AM, Bastian Weber wrote:
Hi,
what is the proper way to convert a sage matrix to a numpy 2d-array?
The obvious way, i.e.
a=np.array(matrix([3 4]))
produces a 0d-array (thus a.shape is an empty tuple) which is not what I
want.
The patch at http://trac.sagemath.org/sage_trac/ticket/8719 now fixes this:
sage: import numpy as np
sage: a=np.array(matrix([3, 4]))
sage: a.shape
(1, 2)
sage: a
array([[3, 4]])
sage: a.dtype
dtype('int64')
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