[Numpy-discussion] slow numpy.clip ?

Robert Kern robert.kern at gmail.com
Tue Dec 19 20:56:15 EST 2006


Travis Oliphant wrote:
> The problem with the copy=True keyword is that it would imply needing to 
> expand the C-API for PyArray_Clip and should not be done until 1.1 IMHO.

I don't think we have to change the signature of PyArray_Clip() at all.
PyArray_Clip() takes an "out" argument. Currently, this is only set to something
other than NULL if explicitly provided as a keyword "out=" argument to
numpy.ndarray.clip(). All we have to do is modify the implementation of
array_clip() to parse a "copy=" argument and set "out = self" before calling
PyArray_Clip().

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the NumPy-Discussion mailing list