[Numpy-discussion] Re: update on build system changes in NumPy's main branch

2023-08-11 Thread Stefan van der Walt
On Fri, Aug 11, 2023, at 12:04, Ralf Gommers wrote: > We've landed some major changes in `main` this week, so I thought it's a good > idea to keep everyone in the loop. This is a *significant* amount of work. Thank you, Ralf, for keeping track of all the moving parts and for working with the res

[Numpy-discussion] update on build system changes in NumPy's main branch

2023-08-11 Thread Ralf Gommers
Hey all, We've landed some major changes in `main` this week, so I thought it's a good idea to keep everyone in the loop. First the good news: we now have full SIMD support in the Meson builds on `main`! This was a huge amount of work by Sayed, so I'd like to say thank you to him for doing all th

[Numpy-discussion] Re: Add to NumPy a function to compute cumulative sums from 0.

2023-08-11 Thread Sebastian Berg
On Fri, 2023-08-11 at 13:43 -0400, Benjamin Root wrote: > I'm really confused. Summing from zero should be what cumsum() does > now. > What they mean is *including* the "implicit" 0 in the result. There are some old NumPy issues on this, suggesting something like a new kwarg like `include_initia

[Numpy-discussion] Re: Add to NumPy a function to compute cumulative sums from 0.

2023-08-11 Thread Homeier, Derek
On 11 Aug 2023, at 7:52 pm, Robert Kern mailto:robert.k...@gmail.com>> wrote: >>> np.cumsum([[1, 2, 3], [4, 5, 6]]) array([ 1, 3, 6, 10, 15, 21]) ``` which matches your example in the cumsum0() documentation. Did something change in a recent release? That's not what's in his example. The exa

[Numpy-discussion] Re: Add to NumPy a function to compute cumulative sums from 0.

2023-08-11 Thread Nathan
This has come up before, see https://github.com/numpy/numpy/issues/6044 for the first time this came up; there were several subsequent discussions linked there. In the meantime, the data APIs consortium has been actively working on adding a `cumulative_sum` function to the array API standard, see

[Numpy-discussion] Re: Add to NumPy a function to compute cumulative sums from 0.

2023-08-11 Thread Benjamin Root
After blinking and rubbing my eyes, I finally see what is meant by all of this. I see now that the difference is that `cumsum0()` would return a result that essentially have 0 be prepended to what would normally be the result from `cumsum()`. From the description, I thought the "problem" was that t

[Numpy-discussion] Re: Add to NumPy a function to compute cumulative sums from 0.

2023-08-11 Thread Robert Kern
On Fri, Aug 11, 2023 at 1:47 PM Benjamin Root wrote: > I'm really confused. Summing from zero should be what cumsum() does now. > > ``` > >>> np.__version__ > '1.22.4' > >>> np.cumsum([[1, 2, 3], [4, 5, 6]]) > array([ 1, 3, 6, 10, 15, 21]) > ``` > which matches your example in the cumsum0() doc

[Numpy-discussion] Re: Add to NumPy a function to compute cumulative sums from 0.

2023-08-11 Thread Benjamin Root
I'm really confused. Summing from zero should be what cumsum() does now. ``` >>> np.__version__ '1.22.4' >>> np.cumsum([[1, 2, 3], [4, 5, 6]]) array([ 1, 3, 6, 10, 15, 21]) ``` which matches your example in the cumsum0() documentation. Did something change in a recent release? Ben Root On Fri,

[Numpy-discussion] Re: Add to NumPy a function to compute cumulative sums from 0.

2023-08-11 Thread Juan Nunez-Iglesias
I'm very sensitive to the issues of adding to the already bloated numpy API, but I would definitely find use in this function. I literally made this error (thinking that the first element of cumsum should be 0) just a couple of days ago! What are the plans for the "extended" NumPy API after 2.0?

[Numpy-discussion] Add to NumPy a function to compute cumulative sums from 0.

2023-08-11 Thread john . dawson
`cumsum` computes the sum of the first k summands for every k from 1. Judging by my experience, it is more often useful to compute the sum of the first k summands for every k from 0, as `cumsum`'s behaviour leads to fencepost-like problems. https://en.wikipedia.org/wiki/Off-by-one_error#Fencepos