Re: [Numpy-discussion] A surprising result from benchmarking

2007-03-10 Thread Kevin Jacobs <[EMAIL PROTECTED]>
The inefficiency comes in the generic iteration and construction of int objects needed by the builtin sum function. Using the native numarray sum method on each row is much much faster, summing over the axis directly even faster still: t1=time.time() highEnough=myMat>0.6 greaterPerLine=[x.sum()

Re: [Numpy-discussion] A surprising result from benchmarking

2007-03-10 Thread Dan Becker
As soon as I posted that I realized it's due to the type conversions from True to 1. For some reason, this --- myMat=scipy.randn(500,500) t1=time.time() highEnough=(myMat>0.6)+0 greaterPerLine=[sum(x) for x in highEnough] elapsed1=time.time()-t1 print("method 1 took %f seconds"%elapsed1) --- rem

[Numpy-discussion] A surprising result from benchmarking

2007-03-10 Thread Dan Becker
Hi Everyone, I'm new to numpy, and I'm finding it hard to predict what is fast in python/numpy and what is slow. The following seems puzzling: I am doing the same thing an ugly way and a cleaner way. But the ugly map/lambda/filter expression is 15x faster than using numpy's internals. Can anyon

Re: [Numpy-discussion] setmember1d: docstring vs. code

2007-03-10 Thread Charles R Harris
On 3/10/07, Robert Kern <[EMAIL PROTECTED]> wrote: Jouni K. Seppänen wrote: > I think that either the docstring (and the book) should be corrected > to mention the assumption, or the code should be made to work in the > arbitrary case. This is the current docstring: In [2]: setmember1d? Type:

Re: [Numpy-discussion] Teaching Array Languages

2007-03-10 Thread Steven H. Rogers
Sebastian Haase wrote: > Sorry for being so dense - what do the numbers mean ? > S.H. > Sorry for being unclear. The numbers are the number of responses for the category. There were 7 total responses for NumPy, all at the college/university level, and 3 respondents cited physics/astronomy as

Re: [Numpy-discussion] Teaching Array Languages

2007-03-10 Thread Sebastian Haase
Sorry for being so dense - what do the numbers mean ? S.H. On 3/10/07, Steven H. Rogers <[EMAIL PROTECTED]> wrote: > Thanks to all who responded to my question about teaching array > programming. I've compiled a brief summary of the responses. > > NumPy > = > * Subject > - Physics/Astronom

[Numpy-discussion] email notification from the TRAC systems

2007-03-10 Thread Sebastian Haase
Hi, Myself and a friend of mine were surprised that we did not get emailed when someone commented on a bug reports we made on the numpy or scipy TRAC bug tracker system. (I started at some point adding an explicit CC entry for myself :-( ) I just googled for this, an I found that in a trac.ini

[Numpy-discussion] Teaching Array Languages

2007-03-10 Thread Steven H. Rogers
Thanks to all who responded to my question about teaching array programming. I've compiled a brief summary of the responses. NumPy = * Subject - Physics/Astronomy 3 - Biotechnology 1 - Engineering 2 - Microeconomics 1 * Level - College/University 7 J = * Subject - Math 1

Re: [Numpy-discussion] in place random generation

2007-03-10 Thread Robert Kern
Mark P. Miller wrote: > Robert: Just a thought on this topic: > > Would it be possible for the Scipy folks to add a new module based > solely off your old mtrand code (pre-broadcast)? I have to say that the > mtrand code from numpy 0.9.8 has some excellent advantages over the core > python ra

Re: [Numpy-discussion] setmember1d: docstring vs. code

2007-03-10 Thread Robert Kern
Jouni K. Seppänen wrote: > I think that either the docstring (and the book) should be corrected > to mention the assumption, or the code should be made to work in the > arbitrary case. This is the current docstring: In [2]: setmember1d? Type: function Base Class: Namespace: I

Re: [Numpy-discussion] [PATCH] a fix for compiling numexpr with MSVC Toolkit 2003

2007-03-10 Thread Timothy Hochberg
On 3/9/07, David M. Cooke <[EMAIL PROTECTED]> wrote: On Fri, 9 Mar 2007 16:11:28 + [EMAIL PROTECTED] wrote: > Hi, > > I've done a patch for allowing compiling the last version of numexpr with > the MSVC Toolkit 2003 compiler on Windows platforms. You can fetch it > from: > > http://www.pyta

Re: [Numpy-discussion] Python vector and matrix formatter similar to Matlab

2007-03-10 Thread Simon Wood
On 10 Mar 2007 16:57:30 +, Alexander Schmolck <[EMAIL PROTECTED]> wrote: "Simon Wood" <[EMAIL PROTECTED]> writes: > To all, > I came across an old thread in the archives in which Alexander Schmolck gave > an example of a Matlab like matrix formatter he authored for Python. Is this > formatt

Re: [Numpy-discussion] in place random generation

2007-03-10 Thread Mark P. Miller
Robert: Just a thought on this topic: Would it be possible for the Scipy folks to add a new module based solely off your old mtrand code (pre-broadcast)? I have to say that the mtrand code from numpy 0.9.8 has some excellent advantages over the core python random number generators. This woul

Re: [Numpy-discussion] Python vector and matrix formatter similar to Matlab

2007-03-10 Thread Alexander Schmolck
"Simon Wood" <[EMAIL PROTECTED]> writes: > To all, > I came across an old thread in the archives in which Alexander Schmolck gave > an example of a Matlab like matrix formatter he authored for Python. Is this > formatter still available some where? Yup. I've still got it as part of a matrix clas

[Numpy-discussion] setmember1d: docstring vs. code

2007-03-10 Thread Jouni K . Seppänen
Hi, According to an earlier posting on this list, the elements of the first argument to setmember1d are assumed to be unique: http://thread.gmane.org/gmane.comp.python.numeric.general/13251/focus=13307 The docstring for setmember1d does not state this: | Definition: numpy.setmember1d(ar1, a