Stabilize ellipse covariance symmetrization - #5118
Closed
FlorianPfaff wants to merge 4 commits into
Closed
Conversation
Contributor
✅MegaLinter analysis: Success
Notices📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining 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
|
Owner
Author
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
Bug
tracking.ellipse_geometry.symmetrize()evaluatedmatrix + matrix.Tbefore multiplying by0.5.For an already symmetric finite covariance such as
diag([1e308, 2e307]), the diagonal entries are doubled first. That intermediate exceeds thefloat64range, so the helper raisesFloatingPointErrorunder strict NumPy settings or returns infinities under ordinary settings, even though the requested symmetric result is exactly the original finite matrix.The failure propagates into
project_symmetric_covariance()and the shared ellipse canonicalization paths that rely on this helper.Fix
Use the algebraically equivalent form
Each finite operand is scaled before addition, so the representable average remains finite. Ordinary-scale behavior and backend-neutral operations are unchanged.
Validation
overflow encountered in addfailure withdiag([1e308, 2e307])numpy.errstate(over="raise", invalid="raise")symmetrize()andproject_symmetric_covariance()main: 4 commits ahead, 0 behind; final diff is limited to 2 files, 29 additions, and 1 deletionRepository CI is the authoritative full backend, lint, packaging, documentation, dependency, security, and CodeQL validation.