[SciPy-User] scipy.linalg.solve()'s overwrite option does not work

David Warde-Farley wardefar@iro.umontreal...
Fri Nov 5 21:19:39 CDT 2010

On 2010-11-05, at 9:21 PM, braingateway wrote:

> Hi everyone,
> I believe the overwrite option is used for reduce memory usage. But I
> did following test, and find out it does not work at all. Maybe I
> misunderstood the purpose of overwrite option. If anybody could explain
> this, I shall highly appreciate your help.

First of all, this is a SciPy issue, so please don't crosspost to NumPy-discussion.

>>>> a=npy.random.randn(20,20)
>>>> x=npy.random.randn(20,4)
>>>> a=npy.matrix(a)
>>>> x=npy.matrix(x)
>>>> b=a*x
>>>> import scipy.linalg as sla
>>>> a0=npy.matrix(a)
>>>> a is a0
> False
>>>> b0=npy.matrix(b)
>>>> b is b0
> False

You shouldn't use 'is' to compare arrays unless you mean to compare them by object identity. Use all(b == b0) to compare by value.


More information about the SciPy-User mailing list