Stabilize ellipsoidal positive-definiteness validation - #5365
Open
FlorianPfaff wants to merge 1 commit into
Open
Stabilize ellipsoidal positive-definiteness validation#5365FlorianPfaff wants to merge 1 commit into
FlorianPfaff wants to merge 1 commit into
Conversation
Contributor
✅MegaLinter analysis: Success
Notices
See detailed reports in MegaLinter artifacts Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining
|
FlorianPfaff
marked this pull request as ready for review
August 21, 2026 06:40
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
Fix a reproducible numerical validation bug in
AbstractEllipsoidalBallDistributionfor positive-definite shape matrices with extreme but representable axis scales.Bug
The constructor checked positive definiteness by applying
eigvalshdirectly to the raw shape matrix. For a valid diagonal matrix whose variances balance between about4.49e307and2.23e-308, NumPy's symmetric eigensolver rounds the tiny positive eigenvalues to zero. The constructor therefore rejects a strictly positive-definite matrix before the existing log-Cholesky volume computation can handle it.This is reproduced by the existing regression:
tests.distributions.test_ellipsoidal_ball_volume_stability::TestEllipsoidalBallVolumeStability::test_balanced_extreme_axes_avoid_intermediate_product_overflowThe NumPy 3.13 CI artifact from PR #5364 fails there with
ValidationError: shape_matrix must be positive definite.Fix
Validate positive definiteness after diagonal congruence scaling:
AasD^{-1/2} A D^{-1/2}using successive divisions;eigvalshon the balanced, unit-diagonal matrix.For positive diagonal
D, this congruence preserves inertia, so the mathematical positive-definiteness criterion is unchanged. It avoids the avoidable dynamic-range loss in the eigensolver. Singular and indefinite matrices remain rejected.Scope
main(baac3b1736bb8e81eafc1e3f69e10104636103b9)The existing stability and invalid-shape regression tests cover the changed behavior; no test-only weakening is included.