On Fri, Aug 18, 2023 at 10:59 AM Ronald van Elburg <r.a.j.van.elburg@hetnet.nl> wrote:
I was trying to get a feel for how often the work around occurs. I found three clear examples in Scipy and one unclear case. One case in holoviews. Two in numpy. One from soundappraisal's code base.

Thank you Ronald. I think we indeed have more than enough evidence that allowing prepending an initial zero is useful. I think the API currently proposed in https://github.com/data-apis/array-api/pull/653 should work for that:

    def cumulative_sum(
        x: array,
        /,
       *,
        axis: Optional[int] = None,
        dtype: Optional[dtype] = None,
        include_initial: bool = False,
    ) -> array:
 
Whether it's necessary to have other keywords to prepend anything other than zero, or append rather than prepend, is a lot less clear. Did you find a clear need for those things?

Cheers,
Ralf