Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-11 Thread Gael Varoquaux
On Fri, Jan 12, 2007 at 12:44:15AM -0700, Charles R Harris wrote: >Trees are nice, but they are not efficient for array type data. Traversing >a tree usually requires some sort of stack (recursion), and a tree is not >well structured for addressing data using indices. They just aren't >

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-11 Thread Charles R Harris
On 1/12/07, Gael Varoquaux <[EMAIL PROTECTED]> wrote: Talking about the difference between the memory access model and the array API, maybe I am talking bullshit (I know next to nothing in these problems) but couldn' an efficient tree data structure be implemented on the memory buffer object ? I

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-11 Thread Charles R Harris
On 1/12/07, Charles R Harris <[EMAIL PROTECTED]> wrote: On 1/11/07, David Cournapeau <[EMAIL PROTECTED]> wrote: > > Travis Oliphant wrote: > > > > This is one thing I've exposed (and made use of in more than one > place) > > with NumPy. In Numeric, the magic was in a few lines of the > ufunco

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-11 Thread Charles R Harris
On 1/11/07, David Cournapeau <[EMAIL PROTECTED]> wrote: Travis Oliphant wrote: > > This is one thing I've exposed (and made use of in more than one place) > with NumPy. In Numeric, the magic was in a few lines of the ufuncobject > file). Now, it is exposed in the concept of an array iterator.

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-11 Thread Charles R Harris
On 1/11/07, David Cournapeau <[EMAIL PROTECTED]> wrote: Charles R Harris wrote: > > > On 1/11/07, *David Cournapeau* <[EMAIL PROTECTED] > > wrote: > > Timothy Hochberg wrote: > > > > > > On 1/11/07, *Christopher Barker* <[EMAIL PROTECTED] >

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-11 Thread Gael Varoquaux
Talking about the difference between the memory access model and the array API, maybe I am talking bullshit (I know next to nothing in these problems) but couldn' an efficient tree data structure be implemented on the memory buffer object ? I am pretty sure a simple tree read-only could, as for a t

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-11 Thread David Cournapeau
Travis Oliphant wrote: > > This is one thing I've exposed (and made use of in more than one place) > with NumPy. In Numeric, the magic was in a few lines of the ufuncobject > file). Now, it is exposed in the concept of an array iterator. Anybody > can take advantage of it as it there is a C-A

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-11 Thread David Cournapeau
Charles R Harris wrote: > > > On 1/11/07, *David Cournapeau* <[EMAIL PROTECTED] > > wrote: > > Timothy Hochberg wrote: > > > > > > On 1/11/07, *Christopher Barker* <[EMAIL PROTECTED] > > >

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-11 Thread Travis Oliphant
Timothy Hochberg wrote: > > > On 1/11/07, *Christopher Barker* <[EMAIL PROTECTED] > > wrote: > > [CHOP] > > > I'd still like to know if anyone knows how to efficiently loop through > all the elements of a non-contiguous array in C. > > > First, it's not that imp

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-11 Thread Charles R Harris
On 1/11/07, David Cournapeau <[EMAIL PROTECTED]> wrote: Timothy Hochberg wrote: > > > On 1/11/07, *Christopher Barker* <[EMAIL PROTECTED] > > wrote: > > [CHOP] > > > I'd still like to know if anyone knows how to efficiently loop through > all the elements of a n

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-11 Thread Travis Oliphant
Torgil Svensson wrote: > On 1/11/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > >> On 1/11/07, Torgil Svensson <[EMAIL PROTECTED]> wrote: >> >>> Sure. I'm not objecting the memory model, what I mean is that data >>> access between modules has a wider scope than just a memory model. >>> M

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-11 Thread David Cournapeau
Timothy Hochberg wrote: > > > On 1/11/07, *Christopher Barker* <[EMAIL PROTECTED] > > wrote: > > [CHOP] > > > I'd still like to know if anyone knows how to efficiently loop through > all the elements of a non-contiguous array in C. > > > First, it's not that imp

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-11 Thread David Cournapeau
Christopher Barker wrote: > >> autogen works well enough for me; > > I didn't know about autogen -- that may be all we need. > numpy has code which already does something similar to autogen: you declare a function, and some template with a generic name, and the code generator replaces the generi

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-11 Thread Timothy Hochberg
On 1/11/07, Christopher Barker <[EMAIL PROTECTED]> wrote: [CHOP] I'd still like to know if anyone knows how to efficiently loop through all the elements of a non-contiguous array in C. First, it's not that important if the array is contiguous for this sort of thing. What you really care abo

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-11 Thread Torgil Svensson
On 1/11/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > On 1/11/07, Torgil Svensson <[EMAIL PROTECTED]> wrote: > > Sure. I'm not objecting the memory model, what I mean is that data > > access between modules has a wider scope than just a memory model. > > Maybe i'm completely out-of-scope here,

Re: [Numpy-discussion] How do I test if an array contains NaN ?

2007-01-11 Thread belinda thom
> It's probably worth mentioning that IPython has (thanks to a user > contributed implementation) search capabilities besides tab completion > (which requires you to at least know the start of the string you > want): > > In [3]: N.*nan*? > N.isnan > N.nan > N.nan_to_num > N.nanargmax > N.nanargmin

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-11 Thread Christopher Barker
David Cournapeau wrote: > To do the actual clipping if the datatypes are 'native' is trivial in C: > a single loop, a comparison, that's it. only if it's also Contiguous. From a quick look at your posted code, it looks like it only works for contiguous arrays. > I don't think C++ is welcome

Re: [Numpy-discussion] No test file found

2007-01-11 Thread Keith Goodman
On 1/11/07, Robert Kern <[EMAIL PROTECTED]> wrote: > Keith Goodman wrote: > > I see a lot of 'No test file found' warnings when running > > numpy.test(). What does that mean? > > The test collector tries to find a test module for every actual module. So > numpy/dual.py would correspond to numpy/tes

Re: [Numpy-discussion] No test file found

2007-01-11 Thread Robert Kern
Keith Goodman wrote: > I see a lot of 'No test file found' warnings when running > numpy.test(). What does that mean? The test collector tries to find a test module for every actual module. So numpy/dual.py would correspond to numpy/tests/test_dual.py . A lot of modules don't need to be tested bec

Re: [Numpy-discussion] No test file found

2007-01-11 Thread Keith Goodman
On 1/11/07, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > On Thu, Jan 11, 2007 at 03:18:19PM -0800, Keith Goodman wrote: > > I see a lot of 'No test file found' warnings when running > > numpy.test(). What does that mean? > > It means your verbosity is set too high. You'll find that N.test(0,0)

Re: [Numpy-discussion] No test file found

2007-01-11 Thread Stefan van der Walt
On Thu, Jan 11, 2007 at 03:18:19PM -0800, Keith Goodman wrote: > I see a lot of 'No test file found' warnings when running > numpy.test(). What does that mean? It means your verbosity is set too high. You'll find that N.test(0,0) complains much less (although, realistically, you'd probably want t

[Numpy-discussion] No test file found

2007-01-11 Thread Keith Goodman
I see a lot of 'No test file found' warnings when running numpy.test(). What does that mean? >> M.__version__ '1.0.1' >> M.test(10,10) Warning: No test file found in /usr/lib/python2.4/site-packages/numpy/core/tests for module Found 13 tests for numpy.core.umath Found 9 tests for numpy.lib.ar

Re: [Numpy-discussion] Fwd: Advanced selection, duplicate indices, and augmented assignment

2007-01-11 Thread Sean Lynch
Timothy Hochberg wrote: > > > Sean, > > I'm pretty sure that at one point I had a way to do exactly what you > are doing, however it's been a while and I don't know where that code > wandered off to. I will think about it now that I'm done doing silly > stuff and see if I can recall what the trick

Re: [Numpy-discussion] Warning messages after upgrading to 1.0.1

2007-01-11 Thread Robert Kern
Keith Goodman wrote: > I get lots of warning messages after upgrading from 1.0rc1 to 1.0.1: > > Warning: divide by zero encountered in divide > Warning: invalid value encountered in log > Warning: invalid value encountered in subtract > Warning: invalid value encountered in multiply > > What's a

[Numpy-discussion] Warning messages after upgrading to 1.0.1

2007-01-11 Thread Keith Goodman
I get lots of warning messages after upgrading from 1.0rc1 to 1.0.1: Warning: divide by zero encountered in divide Warning: invalid value encountered in log Warning: invalid value encountered in subtract Warning: invalid value encountered in multiply What's a good way to turn off the warnings? __

Re: [Numpy-discussion] random permutation

2007-01-11 Thread Robert Kern
Keith Goodman wrote: > Why is the first element of the permutation always the same? Am I > using random.permutation in the right way? >>> M.__version__ > '1.0rc1' This has been fixed in more recent versions. http://projects.scipy.org/scipy/numpy/ticket/374 -- Robert Kern "I have come to bel

[Numpy-discussion] random permutation

2007-01-11 Thread Keith Goodman
Why is the first element of the permutation always the same? Am I using random.permutation in the right way? >> x matrix([[0], [1], [2], [3]]) >> M.random.permutation(x) array([[0], [1], [1], [0]]) >> M.random.permutation(x) array([[0], [1],

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-11 Thread Charles R Harris
On 1/11/07, Torgil Svensson <[EMAIL PROTECTED]> wrote: On 1/11/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: > Torgil Svensson wrote: >> Example1: We have a very large amount of data with a compressed >> internal representation >> >> Example2: We might want to generate data "on the fly" as it's

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-11 Thread Torgil Svensson
On 1/11/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: > Torgil Svensson wrote: >> Example1: We have a very large amount of data with a compressed >> internal representation >> >> Example2: We might want to generate data "on the fly" as it's needed >> >> Example3: If module creators to deal with di

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-11 Thread Francesc Altet
El dv 12 de 01 del 2007 a les 00:58 +0900, en/na David Cournapeau va escriure: > David Cournapeau wrote: > > Francesc Altet wrote: > >> A Dimecres 10 Gener 2007 22:49, Stefan van der Walt escrigué: > >>> On Wed, Jan 10, 2007 at 08:28:14PM +0100, Francesc Altet wrote: > El dt 09 de 01 del 2007

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-11 Thread David Cournapeau
David Cournapeau wrote: > Francesc Altet wrote: >> A Dimecres 10 Gener 2007 22:49, Stefan van der Walt escrigué: >>> On Wed, Jan 10, 2007 at 08:28:14PM +0100, Francesc Altet wrote: El dt 09 de 01 del 2007 a les 23:19 +0900, en/na David Cournapeau va escriure: time (putmask)--> 1

Re: [Numpy-discussion] Need help for implementing a fast clip in numpy (was slow clip)

2007-01-11 Thread David Cournapeau
Francesc Altet wrote: A Dimecres 10 Gener 2007 22:49, Stefan van der Walt escrigué: On Wed, Jan 10, 2007 at 08:28:14PM +0100, Francesc Altet wrote: El dt 09 de 01 del 2007 a les 23:19 +0900, en/na David Cournapeau va escriure: time (putmask)--> 1.38 time (where)--> 2.713 time (numexpr where)--

Re: [Numpy-discussion] Docstring standards for NumPy and SciPy

2007-01-11 Thread Jens Jørgen Mortensen
On Thu, 2007-01-11 at 07:08 -0700, Steven H. Rogers wrote: > I'd prefer reStructuredText. I don't find the markup particularly noisy and > it quickly fades into the background. I found some notes on the docutils page (about using reStructuredText in docstring): http://docutils.sourceforge.net/d

Re: [Numpy-discussion] Fwd: Advanced selection, duplicate indices, and augmented assignment

2007-01-11 Thread Timothy Hochberg
On 1/10/07, A. M. Archibald <[EMAIL PROTECTED]> wrote: On 10/01/07, Charles R Harris <[EMAIL PROTECTED]> wrote: > > You're the second or third person to recently come up with a useful > application for using inplace ops with repeated indices only to be stymied > by that fact that they don't act

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-11 Thread Travis Oliphant
Torgil Svensson wrote: > On 1/4/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: > >> still be used to describe a complicated block of memory to another user. >> > > Thinking of the scope "seamless data exchange between modules" my > concern with this PEP is that is might be too much focused

Re: [Numpy-discussion] Docstring standards for NumPy and SciPy

2007-01-11 Thread Steven H. Rogers
I'd prefer reStructuredText. I don't find the markup particularly noisy and it quickly fades into the background. Regards, Steve -- Steven H. Rogers, Ph.D., [EMAIL PROTECTED] Weblog: http://shrogers.com/weblog "He who refuses to do arithmetic is doomed to talk nonsense." -- John McCarthy _

Re: [Numpy-discussion] Need help for implementing a fa st clip in numpy (was slow clip)

2007-01-11 Thread Francesc Altet
A Dimecres 10 Gener 2007 22:49, Stefan van der Walt escrigué: > On Wed, Jan 10, 2007 at 08:28:14PM +0100, Francesc Altet wrote: > > El dt 09 de 01 del 2007 a les 23:19 +0900, en/na David Cournapeau va > > > > escriure: > > time (putmask)--> 1.38 > > time (where)--> 2.713 > > time (numexpr where)-->