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

feat: Extend hypergeometric distribution PMF for non-integral arguments #1244

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

fpelliccioni
Copy link

Summary

This PR extends the hypergeometric distribution's PMF to support non-integer values of x using cubic Hermite interpolation. If x is not an integer, the implementation selects at least three valid integer points for interpolation. If fewer than three points are available, it raises a domain error.

Known Issue

This change introduces a dependency on cubic_hermite, which throws exceptions instead of using Boost.Math’s policies::raise_domain_error. As a result, some compile-time tests fail due to exceptions being disabled in those tests.

Next Steps

  • A separate PR will update cubic_hermite (and potentially other interpolators) to conform to Boost.Math’s policy-based error handling.
  • This PR is left in draft so reviewers can provide feedback on the approach.

Question: Best way to test this?

Hypergeometric test data in test/hypergeometric_test_data.ipp appears to be auto-generated from Mathematica, with some values removed due to absolute vs relative error concerns.
Since we now support non-integer values, what is the best approach to generate a new test dataset? Does anyone know of a reliable source for non-integer hypergeometric PMF values?

Fixes #1240

@fpelliccioni fpelliccioni marked this pull request as draft February 4, 2025 19:35
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.

Extend hypergeometric distribution PMF for non-integral arguments
1 participant