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

fix numerical stability #19617

Merged
merged 2 commits into from Dec 1, 2023
Merged

Conversation

maciejskorski
Copy link
Contributor

Reference issue

Fixes #19616

What does this implement/fix?

Exponents in the pdf calculation are grouped together to avoid overflow and nans.

Additional information

The implementation should have three factors: one is to use the (scaled) Bessel function, another groups exponential terms (including the correction in Bessel's f) and the third one all remaining constants (typically small).

@lucascolley lucascolley added defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.stats labels Dec 1, 2023
Copy link
Contributor

@mdhaber mdhaber left a comment

Choose a reason for hiding this comment

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

Thanks @maciejskorski. Added a test. If CI comes back green, I'll merge.

Update: failures unrelated; merging

@mdhaber mdhaber merged commit f34c611 into scipy:main Dec 1, 2023
26 of 28 checks passed
@j-bowhay j-bowhay added this to the 1.12.0 milestone Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.stats
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Normal Inverse Gaussian numerically unstable
4 participants