On Fri, Sep 5, 2008 at 11:52 PM, Keith Goodman <[EMAIL PROTECTED]> wrote:

> Here's another difference:
>
>>> a = np.random.randn(100000)
>>> timeit np.sum(a[np.where(a>0)])
> 100 loops, best of 3: 3.44 ms per loop
>>> timeit a[a > 0].sum()
> 100 loops, best of 3: 2.21 ms per loop

But you're not comparing the same thing: why calling where in one case
and not in the other ? The difference is in the where call, not in the
a.sum() vs sum(a)

cheers,

David
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to