Skip to content

Support negative-kappa Watson Bingham conversion - #5356

Merged
FlorianPfaff merged 2 commits into
mainfrom
fix/watson-negative-kappa-bingham
Aug 21, 2026
Merged

Support negative-kappa Watson Bingham conversion#5356
FlorianPfaff merged 2 commits into
mainfrom
fix/watson-negative-kappa-bingham

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

What

  • support WatsonDistribution.to_bingham() for negative concentration
  • use the Watson axis as the Bingham eigenvector with concentration kappa < 0, with zero concentration on its orthogonal complement
  • restore WatsonDistribution.sample() for negative-kappa distributions in dimensions that route through the Bingham sampler
  • add regression coverage for density equivalence and higher-dimensional sampling

Why

Negative kappa is a valid Watson distribution and is already supported by the density and mode semantics. However, sample() uses the Bingham representation whenever dim != 2, while to_bingham() previously raised NotImplementedError for every negative kappa. This made the same valid distribution sampleable on S^2 but unusable through the public sampling API on S^1/S^3/etc.

For kappa < 0, the exact Bingham exponent is obtained directly with concentrations [kappa, 0, ..., 0] and the Watson axis as the first eigenvector:

x^T M diag(Z) M^T x = kappa * (mu^T x)^2.

Regression coverage

  • negative-kappa Watson and converted Bingham PDFs agree on S^3
  • converted concentrations/eigenvector encode the expected axis
  • negative-kappa sampling above S^2 returns unit-norm samples instead of raising NotImplementedError

@FlorianPfaff
FlorianPfaff enabled auto-merge (squash) August 19, 2026 09:50
@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.63s
✅ JSON prettier 7 0 0 0 0.79s
✅ JSON v8r 7 0 0 4.46s
✅ MARKDOWN markdownlint 68 0 0 0 1.88s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.4s
✅ PYTHON black 1989 15 0 0 66.63s
✅ PYTHON isort 1989 27 0 0 3.0s
✅ REPOSITORY betterleaks yes no no 1.24s
✅ REPOSITORY checkov yes no no 36.77s
✅ REPOSITORY git_diff yes no no 0.17s
✅ REPOSITORY secretlint yes no no 104.87s
✅ REPOSITORY syft yes no no 3.28s
✅ REPOSITORY trivy-sbom yes no no 2.23s
✅ YAML prettier 11 0 0 0 0.56s
✅ YAML v8r 11 0 0 19.07s
✅ YAML yamllint 11 0 0 1.12s

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 dee8d31 into main Aug 21, 2026
15 of 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