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

Poisson: split Knuth/Rejection methods #1493

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

dhardy
Copy link
Member

@dhardy dhardy commented Sep 13, 2024

Summary

Use an enum over Poisson implementations

Motivation

#1484 uses the Poisson method internally, but only for small expected values.
@benjamin-lieser please merge this PR into yours and use poisson::KnuthMethod instead of Poisson.

Copy link
Member

@MichaelOwenDyer MichaelOwenDyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🤠

rand_distr/src/lib.rs Show resolved Hide resolved
rand_distr/src/poisson.rs Outdated Show resolved Hide resolved
rand_distr/src/poisson.rs Outdated Show resolved Hide resolved
@MichaelOwenDyer
Copy link
Member

MichaelOwenDyer commented Sep 18, 2024

changes.patch
Here's a patch file of my suggestions.
Edit: Also added a constructor for RejectionMethod

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.

3 participants