Re: [Numpy-discussion] Setup failure on Max OS X Lion

2011-07-22 Thread Chad Netzer
On Fri, Jul 22, 2011 at 4:52 AM, Mark Higgins wrote: > I just tried to set up numpy on a new laptop with Mac OS X Lion (10.7) and am > running into some problems. > > Any suggestions? On a freshly upgraded-to Lion installation: $ which python /usr/bin/python $ python Python 2.7.1 (r271:86832,

Re: [Numpy-discussion] Array vectorization in numpy

2011-07-20 Thread Chad Netzer
On Wed, Jul 20, 2011 at 3:57 AM, eat wrote: > Perhaps slightly OT, but here is something very odd going on. I would expect > the performance to be in totally different ballpark. >> >> >>> t=timeit.Timer('m =- 0.5', setup='import numpy as np;m = >> >>> np.ones([8092,8092],float)') >> >>> np.mean(t.

Re: [Numpy-discussion] Array vectorization in numpy

2011-07-20 Thread Chad Netzer
On Tue, Jul 19, 2011 at 11:49 PM, Carlos Becker wrote: > Those are very interesting examples. Cool. > I think that pre-allocation is very > important, and something similar happens in Matlab if no pre-allocation is > done: it takes 3-4x longer than with pre-allocation. Can you provide a simple

Re: [Numpy-discussion] Array vectorization in numpy

2011-07-19 Thread Chad Netzer
On Tue, Jul 19, 2011 at 6:10 PM, Pauli Virtanen wrote: >        k = m - 0.5 > > does here the same thing as > >        k = np.empty_like(m) >        np.subtract(m, 0.5, out=k) > > The memory allocation (empty_like and the subsequent deallocation) > costs essentially nothing, and there are no temp

Re: [Numpy-discussion] Array vectorization in numpy

2011-07-19 Thread Chad Netzer
On Tue, Jul 19, 2011 at 3:35 PM, Carlos Becker wrote: > Thanks Chad for the explanation on those details. I am new to python and I > However, if I don't, I obtain this 4x penalty with numpy, even with the > 8092x8092 array. Would it be possible to do k = m - 0.5 and pre-alllocate k > such that py

Re: [Numpy-discussion] Array vectorization in numpy

2011-07-19 Thread Chad Netzer
On Tue, Jul 19, 2011 at 2:27 PM, Carlos Becker wrote: > Hi, everything was run on linux. > Placing parentheses around the scalar multipliers shows that it seems to > have to do with how expressions are handled, is there sometihng that can be > done about this so that numpy can deal with expressio

Re: [Numpy-discussion] Array vectorization in numpy

2011-07-19 Thread Chad Netzer
On Tue, Jul 19, 2011 at 4:05 AM, Carlos Becker wrote: > Hi, I started with numpy a few days ago. I was timing some array operations > and found that numpy takes 3 or 4 times longer than Matlab on a simple > array-minus-scalar operation. Doing these kinds of timings correctly is a tricky issue, a

Re: [Numpy-discussion] Huge arrays

2009-09-11 Thread Chad Netzer
On Tue, Sep 8, 2009 at 6:41 PM, Charles R Harris wrote: > > More precisely, 2GB for windows and 3GB for (non-PAE enabled) linux. And just to further clarify, even with PAE enabled on linux, any individual process has about a 3 GB address limit (there are hacks to raise that to 3.5 or 4GB, but wi

Re: [Numpy-discussion] iteration slowing, no increase in memory

2009-09-10 Thread Chad Netzer
On Thu, Sep 10, 2009 at 10:03 AM, John [H2O] wrote: > It runs very well for the first few iterations, but then slows tremendously > - there is nothing significantly different about the files or directory in > which it slows. I've monitored the memory use, and it is not increasing. The memory use

Re: [Numpy-discussion] snow leopard issues with numpy

2009-09-03 Thread Chad Netzer
On Thu, Sep 3, 2009 at 4:02 PM, Wolfgang Kerzendorf wrote: > my version of python is the one that comes with snow leopard: 2.6.1 > hope that helps Huh? I upgraded to Snow Leopard over my Leopard system (i.e not a fresh install), and my default is python2.5: $ python Python 2.5 (r25:51918, Sep 1

Re: [Numpy-discussion] A faster median (Wirth's method)

2009-09-02 Thread Chad Netzer
On Wed, Sep 2, 2009 at 10:28 PM, Robert Kern wrote: > When he is talking about 2D, I believe he is referring to median > filtering rather than computing the median along an axis. I.e., > replacing each pixel with the median of a specified neighborhood > around the pixel. That's right, Robert. Ba

Re: [Numpy-discussion] A faster median (Wirth's method)

2009-09-02 Thread Chad Netzer
On Mon, Aug 31, 2009 at 9:06 PM, Sturla Molden wrote: > > We recently has a discussion regarding an optimization of NumPy's median > to average O(n) complexity. After some searching, I found out there is a > selection algorithm competitive in speed with Hoare's quick select. It > has the advantage

Re: [Numpy-discussion] A better median function?

2009-08-24 Thread Chad Netzer
pute the even-median. Maybe I'll just guarantee for partitioning "short" ranges, that the pivot will be sorted after partitioning. It avoids an additional Python sort call, and is trivially fast for insertion sort to do... Thanks, Chad Netzer ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] A better median function?

2009-08-22 Thread Chad Netzer
The good news is that it was trivial to adapt numpy/core/src/_sortmodule.c.src:quicksort() to do a quickselect(). When I'm back home I'll follow up with discussion on how (if it all) to expose this to numpy.median() or numpy in general. -Chad ___ NumPy-D

Re: [Numpy-discussion] A better median function?

2009-08-21 Thread Chad Netzer
On Fri, Aug 21, 2009 at 8:47 AM, Mike Ressler wrote: > I presented this during a lightning talk at the scipy conference > yesterday, so again, at the risk of painting myself as a flaming > idiot: > > - > Wanted: A Better/Faster median() Function > > numpy implementation uses sim