[Numpy-discussion] Two bugs in numpy 0.9.2 and a suggestion.
Paulo J. S. Silva
pjssilva at ime.usp.br
Thu Jan 12 10:41:07 CST 2006
Thank Alan and David for calling my attention back to the matrix object
in numpy/numarray.
I usually avoided using it because my first contact comes from Numeric
where the Matrix objects don't play nicely with ufunctions:
In [1]:from Numeric import *
In [2]:from Matrix import Matrix
In [3]:a = Matrix([1.,2,3])
In [4]:sin(a)
Out[4]:array([ [ 0.84147098, 0.90929743, 0.14112001]])
See... The sine of a Matrix was not a Matrix anymore. I didn't realize
this was fixed in numarray:
In [1]:from numarray import *
In [2]:from numarray.matrix import Matrix
In [3]:a = Matrix([1.,2,3])
In [4]:sin(a)
Out[4]:_Matrix([ 0.84147098, 0.90929743, 0.14112001])
And numpy keeps the nice behavior:
In [1]:from numpy import *
In [2]:a = matrix([1.,2,3])
In [3]:sin(a)
Out[3]:matrix([[ 0.84147098, 0.90929743, 0.14112001]])
Great!
Best,
Paulo
More information about the Numpy-discussion
mailing list