feat: Extend hypergeometric distribution PMF for non-integral arguments #1244
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
This PR extends the hypergeometric distribution's PMF to support non-integer values of
x
using cubic Hermite interpolation. Ifx
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’spolicies::raise_domain_error
. As a result, some compile-time tests fail due to exceptions being disabled in those tests.Next Steps
cubic_hermite
(and potentially other interpolators) to conform to Boost.Math’s policy-based error handling.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