Preserve sigma-point pair symmetry under rounding - #5379
Merged
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
|
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 floating-point symmetry bug in the Merwe and Julier sigma-point generators.
Both generators originally formed each pair independently as
x + U[:, i]andx - U[:, i]. For small spreads, the represented offsets can differ by one ULP. With the standardCircularUKFMerwe parameters (alpha=1e-3), the large off-center weights amplify that tiny asymmetry enough to break the existing identity-prediction regression.Fix
Construct each pair through the representable displacement and re-realize that displacement once after forming the negative point:
The second realization matters: a one-pass reflection can itself re-round on
x - realized_offset, leaving the final stored pair one ULP asymmetric. Rebuilding the positive point from the negative point's final representable displacement removes that residual asymmetry without using the overflow-prone expression2*x - point.The implementation is shared by
MerweScaledSigmaPointsandJulierSigmaPointsthrough_symmetric_sigma_points.Regression coverage
tests/test_sigma_points_pair_symmetry.pychecks exact pair-offset equality for small-spread Merwe and Julier cases. The existingCircularUKF.test_predict_nonlinear_identity_functionindependently checks the downstream numerical effect.Numerical reproduction for the affected Merwe coordinate:
0.0008366600265340973vs0.0008366600265341528in the negative-mean coordinate)The branch changes only the sigma-point implementation and the targeted regression test.