Skip to content

Fix hypertoroidal MH defaults and infinite-angle handling - #5462

Merged
FlorianPfaff merged 2 commits into
mainfrom
fix/hypertoroidal-mh-and-angle-validation
Aug 30, 2026
Merged

Fix hypertoroidal MH defaults and infinite-angle handling#5462
FlorianPfaff merged 2 commits into
mainfrom
fix/hypertoroidal-mh-and-angle-validation

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Summary

  • allow default hypertoroidal Metropolis–Hastings sampling when the distribution has no unique mean direction by falling back to a valid zero-angle start point
  • reject infinite inputs in angular_error instead of propagating them through modulo arithmetic into NaNs
  • add focused regressions for uniform hypertoroidal MH sampling and ±infinity angle inputs

Bugs fixed

  1. HypertoroidalUniformDistribution.sample_metropolis_hastings(...) inherited a default start-point path that unconditionally called mean_direction(). Uniform distributions deliberately have no unique mean, so the sampler raised before sampling despite MH being well-defined.
  2. AbstractHypertoroidalDistribution.angular_error(...) checked only NaNs. ±infinity passed validation, then mod(inf, 2π) produced NaN, silently contaminating the result.

Validation

The branch is a two-commit, two-file change with focused regression tests. CI should exercise the repository's configured backend/test matrix.

@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 4.89s
✅ JSON prettier 7 0 0 0 0.4s
✅ JSON v8r 7 0 0 4.1s
✅ MARKDOWN markdownlint 68 0 0 0 1.51s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.26s
✅ PYTHON black 2036 1 0 0 45.58s
✅ PYTHON isort 2036 4 0 0 2.0s
✅ REPOSITORY betterleaks yes no no 0.95s
✅ REPOSITORY checkov yes no no 26.64s
✅ REPOSITORY git_diff yes no no 0.09s
✅ REPOSITORY secretlint yes no no 74.48s
✅ REPOSITORY syft yes no no 2.06s
✅ REPOSITORY trivy-sbom yes no no 1.6s
✅ YAML prettier 11 0 0 0 0.39s
✅ YAML v8r 11 0 0 10.01s
✅ YAML yamllint 11 0 0 0.76s

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 0c7a8d0 into main Aug 30, 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