[Numpy-tickets] [NumPy] #636: Faster array version of ndindex

NumPy numpy-tickets@scipy....
Fri Feb 1 05:35:31 CST 2008

#636: Faster array version of ndindex
 Reporter:  jarrod.millman  |        Owner:  jarrod.millman
     Type:  enhancement     |       Status:  new           
 Priority:  normal          |    Milestone:  1.0.5         
Component:  Other           |      Version:  none          
 Severity:  normal          |   Resolution:                
 Keywords:                  |  
Comment (by stefan):

 Some feedback on the patch after comments received:

  - Note that the patch is not only for 2-dimensional shapes
  - The name was chosen for testing purposes and should be modified to
 something more suitable.

 In [27]: import numpy as np

 In [28]: timeit np.array(list(np.ndindex((15,12,8))))
 10 loops, best of 3: 23.2 ms per loop

 In [29]: timeit np.lib.function_base.ndindex2((15,12,8))
 1000 loops, best of 3: 418 µs per loop

 In [30]: assert np.all(np.array(list(np.ndindex((15,12,8))) ==

Ticket URL: <http://scipy.org/scipy/numpy/ticket/636#comment:3>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.

More information about the Numpy-tickets mailing list