Skip to content

Stabilize SO(3) chordal smoother weights across backends - #5428

Merged
FlorianPfaff merged 3 commits into
mainfrom
fix/so3-chordal-weight-normalization
Aug 25, 2026
Merged

Stabilize SO(3) chordal smoother weights across backends#5428
FlorianPfaff merged 3 commits into
mainfrom
fix/so3-chordal-weight-normalization

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Bug

SO3ChordalMeanSmoother._normalize_weight_vector() scales weights as weights / max(weights) on the active backend. That is numerically unsafe on JAX/XLA for two already-established PyRecEst edge cases:

  • division by a near-maximum finite float can be lowered through a reciprocal that underflows, collapsing valid weight ratios;
  • positive or negative subnormal weights can be flushed during backend arithmetic/comparisons, causing valid ratios to be rejected or a tiny negative weight to evade validation.

This is the same numerical class previously hardened in Dirac/mixture/particle-weight paths, but the SO(3) chordal smoother still had its own vulnerable normalization.

Fix

  • validate finiteness/sign from the stored host representation so subnormal signs are preserved;
  • scale weights to O(1) on the host before moving the ratios back to the active backend;
  • normalize only the already-scaled ratios, avoiding reciprocal underflow at extreme magnitudes;
  • retain the existing public error contract for non-finite, negative, and zero-total weights.

Regression coverage

Adds cross-backend tests for:

  • a 2:1 ratio at the active dtype's largest finite value through the public chordal-mean path;
  • a 2:1 ratio made from positive subnormals;
  • rejection of a negative subnormal weight.

Scope is limited to the SO(3) chordal mean smoother and its focused tests.

@FlorianPfaff
FlorianPfaff enabled auto-merge (squash) August 25, 2026 07:27
@github-actions

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Max errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 7.67s
✅ JSON prettier 7 0 0 0 0.78s
✅ JSON v8r 7 0 0 4.4s
✅ MARKDOWN markdownlint 68 0 0 0 2.15s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.41s
✅ PYTHON black 2021 4 0 0 68.79s
✅ PYTHON isort 2021 5 0 0 3.08s
✅ REPOSITORY betterleaks yes no no 1.45s
✅ REPOSITORY checkov yes no no 38.1s
✅ REPOSITORY git_diff yes no no 0.14s
✅ REPOSITORY secretlint yes no no 112.83s
✅ REPOSITORY syft yes no no 3.78s
✅ REPOSITORY trivy-sbom yes no no 2.77s
✅ YAML prettier 11 0 0 0 0.8s
✅ YAML v8r 11 0 0 17.7s
✅ YAML yamllint 11 0 0 0.72s

Notices

⚠️ Your configuration references items that have been removed from MegaLinter and are ignored: MAKEFILE_CHECKMAKE. See Removed linters to find their replacements.

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 FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@10.0.0 --custom-flavor-setup --custom-flavor-linters PYTHON_BLACK,PYTHON_ISORT,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_BETTERLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is provided by OX Security
Show us your support by starring ⭐ the repository

@FlorianPfaff
FlorianPfaff merged commit dab01d7 into main Aug 25, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant