[Numpy-discussion] Numpy array slicing

2012-02-09 Thread Eirik Gjerløw
Hello, (also sent to Scipy-User, sorry for duplicates). This is (I think) a rather basic question about numpy slicing. I have the following code: In [29]: a.shape Out[29]: (3, 4, 12288, 2) In [30]: mask.shape Out[30]: (3, 12288) In [31]: mask.dtype Out[31]: dtype('bool') In [32]:

Re: [Numpy-discussion] Numpy array slicing

2012-02-09 Thread Eirik Gjerløw
Ok, that was an enlightening discussion, I guess I signed up for this list a couple of days too late! Thanks, Eirik On 09. feb. 2012 12:55, Olivier Delalleau wrote: This was actually discussed very recently (for more details:

[Numpy-discussion] Cython question

2012-02-09 Thread Charles R Harris
Hi All, Does anyone know how to make Cython emit a C macro? I would like to be able to #define NO_DEPRECATED_API and can do so by including a header file or futzing with the generator script, but I was wondering if there was an easy way to do it in Cython. Chuck

Re: [Numpy-discussion] just the date part of a datetime64[s]?

2012-02-09 Thread John Salvatier
Thanks Mark! John On Wed, Feb 8, 2012 at 6:48 PM, Mark Wiebe mwwi...@gmail.com wrote: Converting between date and datetime requires caution, because it depends on your time zone. Because all datetime64's are internally stored in UTC, simply casting as in your example treats it in UTC. The

Re: [Numpy-discussion] Moving to gcc 4.* for win32 installers ?

2012-02-09 Thread Sturla Molden
On 07.02.2012 18:38, Sturla Molden wrote: One potential problem I just discovered is dependency on a DLL called libpthreadGC2.dll. This is not correct!!! :-D Two threading APIs can be used for OpenBLAS/GotoBLAS2, Win32 threads or OpenMP. driver/others/blas_server_omp.c

Re: [Numpy-discussion] numpy.arange() error?

2012-02-09 Thread Charles R Harris
On Thu, Feb 9, 2012 at 12:20 PM, Drew Frank drewfr...@gmail.com wrote: Eric Firing efiring at hawaii.edu writes: On 02/08/2012 09:31 PM, teomat wrote: Hi, Am I wrong or the numpy.arange() function is not correct 100%? Try to do this: In [7]: len(np.arange(3.1, 4.9,

Re: [Numpy-discussion] numpy.arange() error?

2012-02-09 Thread Eric Firing
On 02/09/2012 09:20 AM, Drew Frank wrote: Eric Firingefiringat hawaii.edu writes: On 02/08/2012 09:31 PM, teomat wrote: Hi, Am I wrong or the numpy.arange() function is not correct 100%? Try to do this: In [7]: len(np.arange(3.1, 4.9, 0.1)) Out[7]: 18 In [8]: len(np.arange(8.1,

Re: [Numpy-discussion] numpy.arange() error?

2012-02-09 Thread eat
Hi, On Thu, Feb 9, 2012 at 9:47 PM, Eric Firing efir...@hawaii.edu wrote: On 02/09/2012 09:20 AM, Drew Frank wrote: Eric Firingefiringat hawaii.edu writes: On 02/08/2012 09:31 PM, teomat wrote: Hi, Am I wrong or the numpy.arange() function is not correct 100%? Try to do

Re: [Numpy-discussion] numpy.arange() error?

2012-02-09 Thread Benjamin Root
On Thursday, February 9, 2012, Sturla Molden stu...@molden.no wrote: Den 9. feb. 2012 kl. 22:44 skrev eat e.antero.ta...@gmail.com: Maybe this issue is raised also earlier, but wouldn't it be more consistent to let arange operate only with integers (like Python's range) and let linspace

Re: [Numpy-discussion] numpy.arange() error?

2012-02-09 Thread Drew Frank
On Thu, Feb 9, 2012 at 3:40 PM, Benjamin Root ben.r...@ou.edu wrote: On Thursday, February 9, 2012, Sturla Molden stu...@molden.no wrote: Den 9. feb. 2012 kl. 22:44 skrev eat e.antero.ta...@gmail.com: Maybe this issue is raised also earlier, but wouldn't it be more consistent to

[Numpy-discussion] cumsum much slower than simple loop?

2012-02-09 Thread Dave Cook
Why is numpy.cumsum (along axis=0) so much slower than a simple loop? The same goes for numpy.add.accumulate # cumsumtest.py import numpy as np def loopcumsum(a): csum = np.empty_like(a) s = 0.0 for i in range(len(a)): csum[i] = s = s + a[i] return csum npcumsum =

Re: [Numpy-discussion] cumsum much slower than simple loop?

2012-02-09 Thread josef . pktd
On Thu, Feb 9, 2012 at 11:39 PM, Dave Cook dav...@gmail.com wrote: Why is numpy.cumsum (along axis=0) so much slower than a simple loop?  The same goes for numpy.add.accumulate # cumsumtest.py import numpy as np def loopcumsum(a):     csum = np.empty_like(a)     s = 0.0     for i in

Re: [Numpy-discussion] cumsum much slower than simple loop?

2012-02-09 Thread Dave Cook
On Thu, Feb 9, 2012 at 9:21 PM, josef.p...@gmail.com wrote: strange (if I didn't make a mistake) In [12]: timeit a.cumsum(0) 100 loops, best of 3: 7.17 ms per loop In [13]: timeit a.T.cumsum(-1).T 1000 loops, best of 3: 1.78 ms per loop In [14]: (a.T.cumsum(-1).T == a.cumsum(0)).all()

Re: [Numpy-discussion] cumsum much slower than simple loop?

2012-02-09 Thread Elliot Saba
numpy 1.6.1, OSX, Core 2 Duo: In [7]: timeit a.cumsum(0) 100 loops, best of 3: 6.67 ms per loop In [8]: timeit a.T.cumsum(-1).T 100 loops, best of 3: 6.75 ms per loop -E On Thu, Feb 9, 2012 at 9:51 PM, Dave Cook dav...@gmail.com wrote: On Thu, Feb 9, 2012 at 9:41 PM, Dave Cook