Re: ENH: Add reverse argument to ufunc.accumulate, cumsum, nancumsum, cumprod, nancumprod

Sebastian Berg <[email protected]>
Newsgroups gmane.comp.python.numeric.general
Message-ID <[email protected]>
On Sun, 2025-06-08 at 00:40 +0000, Carlos Martin wrote:
> Add a reverse argument to accumulating functions that, when true,
> causes the accumulation to be performed in reverse. Examples:


Can you describe use cases?  Without that, I am not sure I find the
flip solution terrible enough for a very uncommon need.

(For ufuncs, if you improved stride support `out=` might allow making
the flip no-cost also.)

- Sebastian


> 
> - ufunc.accumulate:
> https://numpy.org/doc/stable/reference/generated/numpy.ufunc.accumulate.html
> - cumsum:
> https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html
> - nancumsum:
> https://numpy.org/doc/stable/reference/generated/numpy.nancumsum.html
> - cumprod:
> https://numpy.org/doc/stable/reference/generated/numpy.cumprod.html
> - nancumprod:
> https://numpy.org/doc/stable/reference/generated/numpy.nancumprod.html
> 
> Currently, this can be done via two flips
> (https://numpy.org/doc/stable/reference/generated/numpy.flip.html)
> before and after the operation. But it might be more efficient to do
> it directly at the low level.
> _______________________________________________
> NumPy-Discussion mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3//lists/numpy-discussion.python.org
> Member address: [email protected]
> 

_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/numpy-discussion.python.org
Member address: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.