Poisson: split Knuth/Rejection methods - #1493
Merged
Merged
Conversation
With #[inline] on all sample methods there is no effect on benchmarks; as presented there is <2% on most, +8% time on variable benchmark.
1 task
MichaelOwenDyer
requested changes
Sep 18, 2024
MichaelOwenDyer
left a comment
Member
There was a problem hiding this comment.
I like the thought behind the change, it doesn't make sense to decide which method to use every single time a Poisson distribution is sampled. Using an enum is cleaner. I have some thoughts on the details.
I can't comment too well on the benchmarking code, as I am unfamiliar with criterion and don't understand the reasons for many of the changes. I'm gonna go learn about Criterion now 🤠
Member
|
changes.patch |
Member
|
Great, looks good to me now haha 😄 Unless you want to also add the getter for |
MichaelOwenDyer
approved these changes
Sep 22, 2024
benjamin-lieser
pushed a commit
to benjamin-lieser/rand
that referenced
this pull request
Sep 25, 2024
benjamin-lieser
pushed a commit
to benjamin-lieser/rand
that referenced
this pull request
Feb 5, 2025
benjamin-lieser
pushed a commit
to benjamin-lieser/rand
that referenced
this pull request
Feb 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Use an enum over Poisson implementations
Motivation
#1484 uses the
Poissonmethod internally, but only for small expected values.@benjamin-lieser please merge this PR into yours and use
poisson::KnuthMethodinstead ofPoisson.