Skip to content
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

math: Add cumprod and cumproded #23416

Merged
merged 7 commits into from
Jan 9, 2025
Merged

math: Add cumprod and cumproded #23416

merged 7 commits into from
Jan 9, 2025

Conversation

lbartoletti
Copy link
Contributor

This pull request adds the cumproded function along with its in-place equivalent, cumprod, to the math library. These functions provide functionality similar to cumsum and cumsummed, allowing users to calculate the cumulative sum of elements.

The cumprod function computes the cumulative product of elements in-place, while cumproded additionally returns the prod seq.

@lbartoletti
Copy link
Contributor Author

Sorry for the inactivity on the PR, I've been away from Nim for the last few months.
I got back into it and turned the CI all green.
Please, can I have a review, or should I close it?
Thanks

@Araq Araq merged commit 4aff124 into nim-lang:devel Jan 9, 2025
18 checks passed
@Araq
Copy link
Member

Araq commented Jan 9, 2025

Reason for acceptance: We already have cumsum and cumsummed but it was a close call.

Copy link
Contributor

github-actions bot commented Jan 9, 2025

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 4aff124

Hint: mm: orc; opt: speed; options: -d:release
178405 lines; 8.592s; 650.973MiB peakmem

@lbartoletti
Copy link
Contributor Author

Thanks!

@lbartoletti lbartoletti deleted the cumprodx branch January 9, 2025 08:39
narimiran pushed a commit that referenced this pull request Jan 15, 2025
This pull request adds the `cumproded` function along with its in-place
equivalent, `cumprod`, to the math library. These functions provide
functionality similar to `cumsum` and `cumsummed`, allowing users to
calculate the cumulative sum of elements.

The `cumprod` function computes the cumulative product of elements
in-place, while `cumproded` additionally returns the prod seq.

(cherry picked from commit 4aff124)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants