Port SE2BinghamDistribution from libDirectional#1603
Conversation
Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/ee18ade8-c36d-4ab1-bae9-704f18af7312 Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
✅MegaLinter analysis: Success
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
|
|
@copilot Can you fix these linter problems? ❌ PYTHON / flake8 - 3 errors Your code has been rated at 9.99/10 Found 3 errors (2 fixed, 1 remaining). |
Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/a660fc0d-1728-41d5-bac5-7eb01c48b623 Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Fixed in commit
|

Ports
SE2BinghamDistributionfrom the MATLAB libDirectional library. Models uncertainty on SE(2) = S¹ × ℝ² (rotation + 2D translation) via a Bingham–Gaussian densityf(x) = (1/NC) · exp(xᵀCx)in dual-quaternion space.New:
SE2BinghamDistributionCor three 2×2 blocks (C1,C2,C3); validates symmetry and negative-definiteness ofC3pdf(xa)— evaluates density on N×3 angle-pos or N×4 dual-quaternion input; auto-converts between representationsmode()— closed-form via Schur complement eigenvector for rotation + conditional optimum for translationsample(n)— two-step: Bingham marginal from Schur complement eigendecomp → Gaussian conditional with covariance−½ C3⁻¹marginalize_linear()— exact Bingham marginal on S¹marginalize_periodic()—CustomLinearDistributionvia numerical integration over S¹fit(samples, weights=None)— moment-based MLE from DQ or angle-pos samples (Anderson 2003 regression for the Gaussian block)Usage
Normalization constant uses the closed-form 2D Bingham formula
2π · exp((z₁+z₂)/2) · I₀((z₂−z₁)/2)on the Schur complement eigenvalues, avoiding costly numerical integration.