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.

If I use a sympy Matrix instead

b=np.array(sp.Matrix([3 4]))

it works as expected (b.shape == (2,1), i.e. a row vector)

Maybe there is an easy way to convert a sage matrix to a sympy matrix?

Just for explanation:
I use numpy arrays (with dtype=object) to perform things like element
wise multiplication and flattening.


Greetings,
Bastian

-- 
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

Reply via email to