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

NumPy numpy-tickets at scipy.net
Sun Jan 21 00:22:09 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):

 I don't know much about how f-structure functions are supposed to work:
    - my understanding is that they work on C datatype: for NPY_DOUBLE, the
 fastclip would be double double fasctlip(double in, double min, double
 max) ? Can the function call be inlined ?
    - how does it work when you have mixed type ?

 Most of the hard work of my patch is done to do the dataype casting, and
 being sure that the data fed to function which work at the C datatype
 level are the one expected. Other than that, I think once we agree on the
 fastclip signature, modifying the patch would be trivial.

 Another functionality which seems like it can be speed up that way is
 PyArray_PutMask. Those two functions are often used in matplotlib, and for
 some plot I am regularly using (specgram and such), those are the two main
 culprints (on numpy side), as they are something like between 20 times
 slower than a direct C implementation.

 What do you mean by "magic function lists" ? I don't know anything about

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

More information about the Numpy-tickets mailing list