Re: [Numpy-discussion] Adding an ndarray.dot method

2010-04-29 Thread Charles R Harris
On Thu, Apr 29, 2010 at 1:30 PM, Pauli Virtanen wrote: > Wed, 28 Apr 2010 14:12:07 -0400, Alan G Isaac wrote: > [clip] > > Here is a related ticket that proposes a more explicit alternative: > > adding a ``dot`` method to ndarray. > > http://projects.scipy.org/numpy/ticket/1456 > > I kind of like

Re: [Numpy-discussion] What should be the value of nansum of nan's?

2010-04-29 Thread Keith Goodman
On Thu, Apr 29, 2010 at 9:56 AM, Charles R Harris wrote: > It looks like the consensus is that zero should be returned. This is a > change from current behaviour and that bothers me a bit. Here are some other > oddities > > In [6]: nanmax([nan]) > Out[6]: nan > > In [7]: nanargmax([nan]) > Out[7]:

Re: [Numpy-discussion] What should be the value of nansum of nan's?

2010-04-29 Thread josef . pktd
On Thu, Apr 29, 2010 at 12:56 PM, Charles R Harris wrote: > > > On Wed, Apr 28, 2010 at 11:56 AM, T J wrote: >> >> On Mon, Apr 26, 2010 at 10:03 AM, Charles R Harris >> wrote: >> > >> > >> > On Mon, Apr 26, 2010 at 10:55 AM, Charles R Harris >> > wrote: >> >> >> >> Hi All, >> >> >> >> We need t

Re: [Numpy-discussion] Adding an ndarray.dot method

2010-04-29 Thread Travis Oliphant
On Apr 29, 2010, at 2:30 PM, Pauli Virtanen wrote: Wed, 28 Apr 2010 14:12:07 -0400, Alan G Isaac wrote: [clip] Here is a related ticket that proposes a more explicit alternative: adding a ``dot`` method to ndarray. http://projects.scipy.org/numpy/ticket/1456 I kind of like this idea. Simple,

Re: [Numpy-discussion] Adding an ndarray.dot method

2010-04-29 Thread Matthew Brett
Hi, > I kind of like this idea. Simple, obvious, and leads > to clear code: > >        a.dot(b).dot(c) > > or in another multiplication order, > >        a.dot(b.dot(c)) > > And here's an implementation: > >         > http://github.com/pv/numpy-work/commit/414429ce0bb0c4b7e780c4078c5ff71c113050b6

Re: [Numpy-discussion] ndimage.label - howto force SWIG to use int32 - even on 64bit Linux ?

2010-04-29 Thread Charles R Harris
On Thu, Apr 29, 2010 at 1:52 AM, Sebastian Haase wrote: > Thanks for those replies. > But isn't npy_intp about pointers ? > At one point perhaps, but how it is used is to get 32 bits on 32 OS's and 64 bits on 64 bit OS's, For the common architectures int will always be 32 bits regardless, it i

Re: [Numpy-discussion] Numpy compilation error

2010-04-29 Thread Pradeep Jha
Hi, I have a few questions: 1) I downloaded numpy1.3.0 and installed it in a directory using the command *python setup.py install --prefix=$HOME/src/numpy *and I see that numpy files have been generated in that directory. Now when I tried to install matplotlib, it complained that my numpy versio

[Numpy-discussion] Adding an ndarray.dot method

2010-04-29 Thread Pauli Virtanen
Wed, 28 Apr 2010 14:12:07 -0400, Alan G Isaac wrote: [clip] > Here is a related ticket that proposes a more explicit alternative: > adding a ``dot`` method to ndarray. > http://projects.scipy.org/numpy/ticket/1456 I kind of like this idea. Simple, obvious, and leads to clear code: a.dot(b

Re: [Numpy-discussion] What should be the value of nansum of nan's?

2010-04-29 Thread Charles R Harris
On Wed, Apr 28, 2010 at 11:56 AM, T J wrote: > On Mon, Apr 26, 2010 at 10:03 AM, Charles R Harris > wrote: > > > > > > On Mon, Apr 26, 2010 at 10:55 AM, Charles R Harris > > wrote: > >> > >> Hi All, > >> > >> We need to make a decision for ticket #1123 regarding what nansum should > >> return w

Re: [Numpy-discussion] put with increment ?

2010-04-29 Thread Robert Kern
On Thu, Apr 29, 2010 at 03:28, Jon Wright wrote: > Hello everyone, > > Is there a 'numpy' efficient way to do the following loop: > > for i, v in indices, values: >     total[ i ] += v > > > The behaviour is like numpy.put, but instead of overwriting the array > element, it is incremented. Current

[Numpy-discussion] put with increment ?

2010-04-29 Thread Jon Wright
Hello everyone, Is there a 'numpy' efficient way to do the following loop: for i, v in indices, values: total[ i ] += v The behaviour is like numpy.put, but instead of overwriting the array element, it is incremented. Currently I have a little C extension which does the job, but I'm lazy

Re: [Numpy-discussion] proposing a "beware of [as]matrix()" warning

2010-04-29 Thread Dag Sverre Seljebotn
Alan G Isaac wrote: > On 4/28/2010 12:08 PM, Dag Sverre Seljebotn wrote: > >> it would be good to deprecate the matrix class >> from NumPy >> > > > Please let us not have this discussion all over again. > > The matrix class is very useful for teaching. > In economics for example, the use

Re: [Numpy-discussion] ndimage.label - howto force SWIG to use int32 - even on 64bit Linux ?

2010-04-29 Thread Sebastian Haase
Thanks for those replies. But isn't npy_intp about pointers ? I would need something likenpy_int32 . But does that exist ? Where is the list of types that numpy.i supports ? Also, BTW, is there code duplication if numpy.i supports (let's say) both npy_int and npy_int32 on a machine, where

Re: [Numpy-discussion] proposing a "beware of [as]matrix()" warning

2010-04-29 Thread Alan G Isaac
On 4/28/2010 5:46 PM, David Warde-Farley wrote: > Would it be acceptable to retain the matrix class but not have it > imported in the default namespace, and have to import e.g. > numpy.matlib to get at them? If we can have A * M undefined, then I do not think this is a needed addition. But I do n

Re: [Numpy-discussion] proposing a "beware of [as]matrix()" warning

2010-04-29 Thread Alan G Isaac
> Alan wrote: >> There is one change I would not mind: let >> A * M be undefined if A is an ndarray and >> M is a NumPy matrix. On 4/28/2010 5:46 PM, David Warde-Farley wrote: > What about the other binary ops? I would say, matrix goes with matrix, > array with array, never the two shall meet unl

Re: [Numpy-discussion] proposing a "beware of [as]matrix()" warning

2010-04-29 Thread Travis Oliphant
On Apr 28, 2010, at 4:46 PM, David Warde-Farley wrote: On 2010-04-28, at 2:30 PM, Alan G Isaac wrote: Please let us not have this discussion all over again. Agreed. See my preface to this discussion. My main objection is that it's not easy to explain to a newcomer what the difference pre