Fix JAX portability and extreme-scale numerical regressions - #5375
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
|
FlorianPfaff
marked this pull request as ready for review
August 21, 2026 06:37
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 five concrete production defects exposed by the existing cross-backend regression suite, primarily on JAX:
SO3ProductParticleFilterweights;Evidence
The repository's existing Python 3.13 JAX test artifact reproduces the affected regressions on current
main:tests/backend_support/test_jax_assignment_contract.py::test_jax_assignment_accepts_list_and_boolean_indicestests/filters/test_relaxed_s3f_grid_mass_overflow.py::{test_large_finite_grid_values_normalize_without_overflow,test_circular_mean_is_invariant_to_large_common_weight_scale}tests/filters/test_so3_product_particle_filter_extreme_weights.py::{test_constructor_normalizes_extreme_finite_weights,test_set_particles_normalizes_extreme_finite_weights}tests/test_pairwise_covariance_symmetrization_overflow.py::test_shape_components_preserve_extreme_finite_covariancestests/filters/test_imm_positive_infinite_log_likelihood.py::test_negative_infinite_log_likelihood_remains_zero_massNo new tests are needed because these failures are already encoded as focused regressions.
Numerical rationale
For the extreme-weight paths, replacing
x / scalewith(x / sqrt(scale)) / sqrt(scale)is algebraically identical but avoids JAX lowering the former through a reciprocal that can underflow near the largest representable floating-point value. PyRecEst already uses this stabilization in the IMM's nonnegative-weight normalizer.For covariance PSD/shape operations, positive scalar rescaling preserves inertia and trace-normalized shape while keeping the eigensolver and divisions in a well-conditioned numerical range.
Scope
mainatbaac3b1736bb8e81eafc1e3f69e10104636103b9;