Should conversion from numpy arrays/matrices to lists and sage vectors/
matrices be implemented by a .sage() method on the numpy array/
matrix?  This is more consistent with the behaviour interface objects.

diagonal_matrix(), matrix(), etc could then outsource the conversion
steps to .sage(), rather than the numpy-specific conversions being
separately implemented in each of the functions.

.sage() would behave like this:
sage: a = numpy.array([1,2,6.4], dtype='float')
sage: type(a[0])
<type 'numpy.float64'>
sage: a_s = a.sage()
sage: type(a_s)
<type 'list'>
sage: a_s[0].parent()
Real Field with 53 bits of precision

sage: m = numpy.matrix([[1.,3,],[4.,5.6]],dtype='float')
sage: m_s = m.sage()
sage: m_s.parent()
Full MatrixSpace of 2 by 2 dense matrices over Real Field with 53 bits
of precision

I don't know where .sage() would be defined though.

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to