[Numpy-discussion] Unexpected output using numpy.ndarray and __radd__

2006-12-17 Thread Mark Hoffmann
> Hi, > > The following issue has puzzled me for a while. I want to add a > numpy.ndarray and an instance of my own class. I define this operation > by implementing the methods __add__ and __radd__. My programme > (including output) looks like: > > #!/usr/local/bin/python > > import numpy > >

[Numpy-discussion] slow numpy.clip ?

2006-12-17 Thread David Cournapeau
Hi, When trying to speed up some matplotlib routines with the matplotlib dev team, I noticed that numpy.clip is pretty slow: clip(data, m, M) is slower than a direct numpy implementation (that is data[dataM] = M; return data.copy()). My understanding is that the code does the same thing, ri

Re: [Numpy-discussion] sum of two arrays with different shape?

2006-12-17 Thread Robert Kern
zhang yunfeng wrote: > Hi, I'm newbie to Numpy. > > When reading tutorials at > http://www.scipy.org/Tentative_NumPy_Tutorial > , I found a snippet about > addition of two arrays with different shape, Does it make sense? If > array shapes are not same

[Numpy-discussion] sum of two arrays with different shape?

2006-12-17 Thread zhang yunfeng
Hi, I'm newbie to Numpy. When reading tutorials at http://www.scipy.org/Tentative_NumPy_Tutorial, I found a snippet about addition of two arrays with different shape, Does it make sense? If array shapes are not same, why it doesn't throw out an error? see the code below (taken from the above web