[Numpy-discussion] pull request for testing/review: ufunc 'where=' parameter

Mark Wiebe mwwiebe@gmail....
Wed Jun 29 12:07:12 CDT 2011


https://github.com/numpy/numpy/pull/99

In [24]: a = np.ones((1000,1000))
In [25]: b = np.ones((1000,1000))
In [26]: c = np.zeros((1000, 1000))
In [27]: m = np.random.rand(1000,1000) > 0.5

In [28]: timeit c[m] = a[m] + b[m]
1 loops, best of 3: 246 ms per loop

In [29]: timeit np.add(a, b, out=c, where=m)
10 loops, best of 3: 20.3 ms per loop

-Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110629/ce3e9fe6/attachment.html 


More information about the NumPy-Discussion mailing list