On Mar 16, 10:47 pm, Alec Mihailovs <[email protected]> wrote: > By the way, vector doesn't work with integer numpy arrays, > > from numpy import array > vector(array([1,2])) > > Traceback (most recent call last):
That shouldn't be too hard to implement - in particular, the following works, sage: from numpy import array sage: vector(list(array([1,2]))) (1, 2) sage: vector(list(array([1,2],dtype=object))) (1, 2) sage: _.parent() Ambient free module of rank 2 over the principal ideal domain Integer Ring sage: vector(list(array([1,2],dtype=float))) (1.0, 2.0) sage: vector(list(array([1,2],dtype=complex))) (1.0, 2.0) sage: _.parent() Vector space of dimension 2 over Complex Double Field So it looks as if the conversion from one-dimensional numpy arrays to vectors could be done like that, independently of their dtype. Alec Mihailovs -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
