[Numpy-tickets] [NumPy] #425: Faster clip for scalar clipping values

NumPy numpy-tickets at scipy.net
Wed Jan 17 22:29:57 CST 2007

#425: Faster clip for scalar clipping values
 Reporter:  david cournapeau  |       Owner:  somebody
     Type:  enhancement       |      Status:  new     
 Priority:  normal            |   Milestone:          
Component:  Other             |     Version:  devel   
 Severity:  normal            |    Keywords:          
 Here is a patch against numpy svn 3511 for faster clip. It adds
  * a function fastclip to numpy.core
  * a function PyArray_FastClip to the numpy C Api which has the exact same
 semantics than PyArray_Clip.
  * various tests to check the results are exactly the same than current
 clip implementation.

 I was not sure where to add the new functions in the code, so I kepts most
 change in separate files when possible. It still uses the current
 implementation for some cases I hope to implement soon.
 The improvements are significant for the cases where scalar clipping
 values (min/max) are used (5 to 30 times faster); it can uses the optional
 out argument, including for in place. It also works in some cases where
 the current clip does not work or segfaults (see ticket 422).

 If the patch is considered acceptable, the C function can be a drop-in
 replacement for the current PyArray_Clip so that no change to the numpy C
 api or python API are necessary.

 Any suggestions are welcomed of course,


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

More information about the Numpy-tickets mailing list