[NumPy-Tickets] [NumPy] #274: Speed up N-D Boolean indexing

NumPy Trac numpy-tickets@scipy....
Tue Mar 22 19:45:35 CDT 2011


#274: Speed up N-D Boolean indexing
-------------------------+--------------------------------------------------
 Reporter:  oliphant     |       Owner:  somebody   
     Type:  enhancement  |      Status:  new        
 Priority:  normal       |   Milestone:  Unscheduled
Component:  numpy.core   |     Version:  devel      
 Keywords:               |  
-------------------------+--------------------------------------------------
Changes (by mwiebe):

  * version:  => devel


Comment:

 Here's a small benchmark illustrating the problem:

 {{{
 In [1]: import numpy as np

 In [2]: np.__version__
 Out[2]: '2.0.0.dev-7219ac2'

 In [3]: a = np.random.random(100000)

 In [4]: amask = a > 0.9

 In [5]: b = a.reshape(100,1000)

 In [6]: bmask = amask.reshape(100,1000)

 In [7]: timeit a[amask]
 1000 loops, best of 3: 787 us per loop

 In [8]: timeit b[bmask]
 1000 loops, best of 3: 1.22 ms per loop
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/274#comment:4>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list