-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cumsum, accumulate should not have default dim=1 #19451
Comments
I agree that |
I agree that it's not desirable for storage order to become semantically visible. That's why I proposed the |
The minimal plan of action here is:
In the future, this could be generalized to the n-dimensional prefix summation behavior I proposed above, which is generally useful and ties the desired behavior for vectors and row vectors together. |
This is inconsistent with how non-cumulative functions work in Julia, e.g.:
Correspondingly,
cumsum(A)
should, rather than asymmetrically defaulting to the first dimension, either be an error, or return an accumulation of the elements ofA
such thatcumsum(A)[end] == sum(A)
and such thatcumsum(v')' == cumsum(v)
for any vectorv
. One possibility is performing a cumulative sum in column-major order. Another is that each output value is the sum of values to the values to the left or above that slot in the intput. I.e.:This answer has the above properties, can be computed efficiently, and is useful.
The text was updated successfully, but these errors were encountered: