Skip to content

Stabilize Merwe sigma-point scaling#4447

Open
FlorianPfaff wants to merge 4 commits into
mainfrom
agent/stabilize-merwe-sigma-scale
Open

Stabilize Merwe sigma-point scaling#4447
FlorianPfaff wants to merge 4 commits into
mainfrom
agent/stabilize-merwe-sigma-scale

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Bug

MerweScaledSigmaPoints computed the positive sigma-point scale as n + lambda after first evaluating lambda = alpha**2 * (n + kappa) - n. For sufficiently small but representable positive alpha, subtracting n rounds lambda to exactly -n; adding n back then yields zero. Construction consequently raises ZeroDivisionError, and sigma-point generation would use a zero Cholesky scale.

For example, n=2, kappa=0, and alpha=1e-10 have the valid direct scale 2e-20, but the previous cancellation-prone reconstruction produces 0.0.

Fix

  • compute and retain alpha * alpha * (n + kappa) directly
  • use that retained value for both weights and covariance scaling
  • reject only genuine scale underflow or overflow with a clear ValueError
  • add focused regressions for the small-alpha cancellation case and for non-representable scales

Validation

  • reproduced the previous ZeroDivisionError analytically for alpha=1e-10
  • syntax-compiled the modified implementation and regression
  • ran the exact regression through an isolated NumPy-backed PyRecEst harness: 2 passed
  • branch is 2 commits ahead of main, 0 behind, with 10 implementation-line changes and one focused test file

Full repository CI should run on this pull request.

@FlorianPfaff FlorianPfaff marked this pull request as ready for review July 15, 2026 15:42
@FlorianPfaff FlorianPfaff enabled auto-merge (squash) July 15, 2026 15:43
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 22.49s
✅ JSON prettier 7 0 0 0 1.29s
✅ JSON v8r 7 0 0 3.68s
✅ MARKDOWN markdownlint 68 0 0 0 2.23s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.94s
✅ PYTHON black 1543 197 0 0 95.16s
✅ PYTHON isort 1543 367 0 0 2.61s
✅ REPOSITORY betterleaks yes no no 2.65s
✅ REPOSITORY checkov yes no no 56.06s
✅ REPOSITORY gitleaks yes no no 15.03s
✅ REPOSITORY git_diff yes no no 0.31s
✅ REPOSITORY secretlint yes no no 74.99s
✅ REPOSITORY syft yes no no 5.17s
✅ REPOSITORY trivy-sbom yes no no 6.68s
✅ REPOSITORY trufflehog yes no no 32.99s
✅ YAML prettier 11 0 0 0 0.84s
✅ YAML v8r 11 0 0 12.04s
✅ YAML yamllint 11 0 0 0.81s

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

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