Wed Sep 23 09:34:55 CDT 2009
I want a cummax function where given an array inp it returns this:
numpy.array([inp[:i].max() for i in xrange(1,len(inp)+1)]).
Various python versions equivalent to the above are quite slow (though a
single python loop is much faster than a python loop with a nested numpy C
loop as shown above).
I have numpy 1.3.0 source. It looks to me like I could add cummax function
by simply adding PyArray_CumMax to multiarraymodule.c which would be the
same as PyArray_Max except it would call PyArray_GenericAccumulateFunction
instead of PyArray_GenericReduceFunction. Also add array_cummax to
Is there interest in adding this function to numpy? If so, I will check out
the latest code and try to check in these changes.
If not, how can I write my own Python module in C that adds this UFunc and
still gets to reuse the code in PyArray_GenericReduceFunction?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion