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

NumPy numpy-tickets@scipy....
Thu Feb 8 01:16:12 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            |   Resolution:          
 Keywords:                    |  
------------------------------+---------------------------------------------
Comment (by david cournapeau):

 Ok, I modify the patch, which uses now a f function (I added two,
 inplace_fast_clip and fast_clip. I only use inplace_fast_clip for now).

 I am still unsure about how to handle mix case types: all is handled using
 PyArray_ConvertToCommonType, and I always cast the output array to the
 type asked by the called.

 Also, if I call clip with an out argument which is the same then the input
 argument, the current clip creates a new array, whereas I try hard not to.
 I don't know which is is considered correct...

 I would say the main problem of the current implementation is that all the
 array is copied if not contiguous, instead of buffers, but I don't know
 what's the best way to do that.

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


More information about the Numpy-tickets mailing list