Skip to content

Stabilize SO(3) product quaternion normalization - #4975

Closed
FlorianPfaff wants to merge 2 commits into
mainfrom
agent/fix-so3-product-dirac-extreme-normalization
Closed

Stabilize SO(3) product quaternion normalization#4975
FlorianPfaff wants to merge 2 commits into
mainfrom
agent/fix-so3-product-dirac-extreme-normalization

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Bug

SO3ProductDiracDistribution normalized quaternions with a direct backend Euclidean norm. For large but finite values such as [1e308, 1e308, 0, 0], the sum-of-squares intermediate overflows even though the true norm, approximately 1.4142e308, is representable.

The constructor, geodesic-distance helper, and rotation-matrix conversion could therefore reject a finite, nonzero quaternion solely because of avoidable intermediate overflow.

Fix

  • reuse the existing scale-safe normalize_quaternions() helper shared by PyRecEst's other SO(3) distributions;
  • retain finite/nonzero validation and canonical scalar-last quaternion handling;
  • add a regression that constructs an SO(3) product Dirac distribution from extreme finite coordinates under strict overflow/invalid handling.

Validation

  • reproduced the old failure locally: numpy.linalg.norm([1e308, 1e308, 0, 0]) raises FloatingPointError with overflow configured to raise;
  • verified the scale-safe normalization returns [sqrt(0.5), sqrt(0.5), 0, 0] with unit norm;
  • syntax-compiled the modified source and regression test;
  • branch is 2 commits ahead and 0 behind main, with exactly two changed files.

The repository's pull-request workflows provide the full supported backend, Python-version, lint, and packaging validation matrix.

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 16.59s
✅ JSON prettier 7 0 0 0 0.66s
✅ JSON v8r 7 0 0 2.79s
✅ MARKDOWN markdownlint 68 0 0 0 0.96s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.37s
✅ PYTHON black 1810 56 0 0 49.7s
✅ PYTHON isort 1810 88 0 0 2.48s
✅ REPOSITORY betterleaks yes no no 1.11s
✅ REPOSITORY checkov yes no no 35.25s
✅ REPOSITORY gitleaks yes no no 6.48s
✅ REPOSITORY git_diff yes no no 0.1s
✅ REPOSITORY secretlint yes no no 44.65s
✅ REPOSITORY syft yes no no 3.12s
✅ REPOSITORY trivy-sbom yes no no 3.8s
✅ REPOSITORY trufflehog yes no no 21.55s
✅ YAML prettier 11 0 0 0 0.37s
✅ YAML v8r 11 0 0 6.56s
✅ YAML yamllint 11 0 0 0.29s

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

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@9.6.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_GITLEAKS,REPOSITORY_BETTERLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

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

Copy link
Copy Markdown
Owner Author

Closing because it is not merge-ready. The full test workflow fails broadly across the supported backend/Python matrix, despite the focused change looking reasonable. The normalization-helper reuse can be reconsidered as a smaller PR once it has a fully green matrix.

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