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

Elliot Saba staticfloat at gmail.com
Fri Feb 10 02:15:07 EST 2012


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 <daverz at gmail.com> wrote:

> On Thu, Feb 9, 2012 at 9:41 PM, Dave Cook <daverz at gmail.com> wrote:
>
>>
>> Interesting.  I should have mentioned that I'm using numpy 1.5.1 on
>> 64-bit Ubuntu 10.10.  This transpose/compute/transpose trick did not work
>> for me.
>>
>>
> Nor does it work under numpy 1.6.1 built with MKL under Windows 7 on a
> core i7.
>
> Dave Cook
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120209/15111306/attachment.html>


More information about the NumPy-Discussion mailing list