![](https://secure.gravatar.com/avatar/915f9e3213021d75d43bb4262167b067.jpg?s=120&d=mm&r=g)
![](https://secure.gravatar.com/avatar/4d021a1d1319f36ad861ebef0eb5ba44.jpg?s=120&d=mm&r=g)
I think it's time for a new release of NumPy. There have been several important bug-fixes and speed improvements recently. Please log any outstanding issues to the ticket system on http://projects.scipy.org/scipy/numpy/timeline I'd like to put another release out over the weekend. -Travis
![](https://secure.gravatar.com/avatar/4d021a1d1319f36ad861ebef0eb5ba44.jpg?s=120&d=mm&r=g)
Sven Schreiber wrote:
We should be doing better in this regard. The __array_wrap__ is being applied (correctly now) in all the linalg functions, so that matrices are returned if they are used. All the ufuncs already preserve arguments. But, we should also peruse the code for asarray calls, save the __array_wrap__ method if available and wrap back the results so that types can be preserved. Someone spoke of writing a decorator to do that automatically which would indeed be nice. If you have examples of functions that are not being preserved, please report them. -Travis
![](https://secure.gravatar.com/avatar/5a7d8a4d756bb1f1b2ea729a7e5dcbce.jpg?s=120&d=mm&r=g)
Travis Oliphant wrote:
Someone spoke of writing a decorator to do that automatically which would indeed be nice.
As long as it's used in the 'old-fashioned' way (i.e., as func = decorator(func) and not @decorator func so that numpy remains 2.3-compatible. Just a heads-up so that 2.4-isms don't appear unintentionally. Cheers, f
![](https://secure.gravatar.com/avatar/915f9e3213021d75d43bb4262167b067.jpg?s=120&d=mm&r=g)
Workarounds I know of are: asmatrix(scalar * m.A) or I noticed the other day that scalar division works ok, so if you know scalar is != 0, m / (1.0/scalar) where m is a numpy.matrix, of course. I find myself repeatedly getting bitten by this, since I'm writing code that does lots of lerping between vectors. This is pretty dang ugly to see all over the place: vlerp = asmatrix((1-t) * v1.A + t * v2.A) when it should just be vlerp = (1-t)*v1 + t*v2 yeh yeh, I should write a function... --bb On 3/9/06, Sven Schreiber <svetosch@gmx.net> wrote:
-- William V. Baxter III OLM Digital Kono Dens Building Rm 302 1-8-8 Wakabayashi Setagaya-ku Tokyo, Japan 154-0023 +81 (3) 3422-3380
![](https://secure.gravatar.com/avatar/39916bae984cb93b797efd2b175f59c0.jpg?s=120&d=mm&r=g)
On Fri, 24 Feb 2006, Bill Baxter apparently wrote:
Multiplying a matrix times a scalar seems to return junk for some reason:
Confirmed. Alan Isaac Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
#this works ok
# this does not work ok
b*0.2 matrix([[ 1.99217540e-002, 2.22617305e-309]])
![](https://secure.gravatar.com/avatar/4d021a1d1319f36ad861ebef0eb5ba44.jpg?s=120&d=mm&r=g)
I think it's time for a new release of NumPy. There have been several important bug-fixes and speed improvements recently. Please log any outstanding issues to the ticket system on http://projects.scipy.org/scipy/numpy/timeline I'd like to put another release out over the weekend. -Travis
![](https://secure.gravatar.com/avatar/4d021a1d1319f36ad861ebef0eb5ba44.jpg?s=120&d=mm&r=g)
Sven Schreiber wrote:
We should be doing better in this regard. The __array_wrap__ is being applied (correctly now) in all the linalg functions, so that matrices are returned if they are used. All the ufuncs already preserve arguments. But, we should also peruse the code for asarray calls, save the __array_wrap__ method if available and wrap back the results so that types can be preserved. Someone spoke of writing a decorator to do that automatically which would indeed be nice. If you have examples of functions that are not being preserved, please report them. -Travis
![](https://secure.gravatar.com/avatar/5a7d8a4d756bb1f1b2ea729a7e5dcbce.jpg?s=120&d=mm&r=g)
Travis Oliphant wrote:
Someone spoke of writing a decorator to do that automatically which would indeed be nice.
As long as it's used in the 'old-fashioned' way (i.e., as func = decorator(func) and not @decorator func so that numpy remains 2.3-compatible. Just a heads-up so that 2.4-isms don't appear unintentionally. Cheers, f
![](https://secure.gravatar.com/avatar/915f9e3213021d75d43bb4262167b067.jpg?s=120&d=mm&r=g)
Workarounds I know of are: asmatrix(scalar * m.A) or I noticed the other day that scalar division works ok, so if you know scalar is != 0, m / (1.0/scalar) where m is a numpy.matrix, of course. I find myself repeatedly getting bitten by this, since I'm writing code that does lots of lerping between vectors. This is pretty dang ugly to see all over the place: vlerp = asmatrix((1-t) * v1.A + t * v2.A) when it should just be vlerp = (1-t)*v1 + t*v2 yeh yeh, I should write a function... --bb On 3/9/06, Sven Schreiber <svetosch@gmx.net> wrote:
-- William V. Baxter III OLM Digital Kono Dens Building Rm 302 1-8-8 Wakabayashi Setagaya-ku Tokyo, Japan 154-0023 +81 (3) 3422-3380
![](https://secure.gravatar.com/avatar/39916bae984cb93b797efd2b175f59c0.jpg?s=120&d=mm&r=g)
On Fri, 24 Feb 2006, Bill Baxter apparently wrote:
Multiplying a matrix times a scalar seems to return junk for some reason:
Confirmed. Alan Isaac Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
#this works ok
# this does not work ok
b*0.2 matrix([[ 1.99217540e-002, 2.22617305e-309]])
participants (6)
-
Alan G Isaac
-
Bill Baxter
-
Fernando Perez
-
Sven Schreiber
-
Travis Oliphant
-
Travis Oliphant