Hello, Are you running a 64-bit machine?
I looked at the code, and the problem seems to come from the fact that it is doing a naive check on the type of the numpy array; it is currently assuming that your float32 array is a float64 array which is why you are getting the strange results you are. See below: sage: a = numpy.array([[1,2,3],[4,5,6],[7,8,9]],float) sage: a.dtype dtype('float64') sage: matrix(a) [1.0 2.0 3.0] [4.0 5.0 6.0] [7.0 8.0 9.0] sage: a = numpy.array([[1,2,3],[4,5,6],[7,8,9]],'float64') sage: a.dtype dtype('float64') sage: matrix(a) [1.0 2.0 3.0] [4.0 5.0 6.0] [7.0 8.0 9.0] sage: a = numpy.array([[1,2,3],[4,5,6],[7,8,9]],'float32') sage: a.dtype dtype('float32') sage: matrix(a) [ 2.00000047311 512.000122547 8192.0019722] [ 131072.031677 2.34082748762e-310 0.0] [3.16202013338e-322 4.74797085653e-321 4.94065645841e-324] I will submit a trac ticket, and post a patch for you later tonight. Thanks for the report! --Mike On 10/11/07, adrianmatematico <[EMAIL PROTECTED]> wrote: > > When I call matrix(a) and a is a numpy array, things do not work: > > sage: import numpy > sage: a=numpy.array([[1,2,3],[4,5,6],[7,8,9]],'f') > sage: a > > array([[ 1., 2., 3.], > [ 4., 5., 6.], > [ 7., 8., 9.]], dtype=float32) > sage: matrix(a) > > [ 2.00000047311 512.000122547 8192.0019722] > [ 131072.031677 6.64723988631e-312 9.63032207325e-270] > [ nan 6.01334411715e-154 1.20061630269e+195] > sage: b=matrix(a) > sage: b > > [ 2.00000047311 512.000122547 8192.0019722] > [ 131072.031677 6.64723988631e-312 9.63032207325e-270] > [ nan 6.01334411715e-154 1.20061630269e+195] > sage: > > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---