Port ComplexBinghamDistribution from libDirectional MATLAB#1647
Port ComplexBinghamDistribution from libDirectional MATLAB#1647
Conversation
Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/f1b48e18-0fb4-4c4f-a65b-0fa91ff8cb1c Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/f1b48e18-0fb4-4c4f-a65b-0fa91ff8cb1c Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
❌MegaLinter analysis: Error
Detailed Issues❌ PYTHON / flake8 - 1 error❌ PYTHON / pylint - 1 errorSee 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
|
Test Results 4 files 4 suites 42m 16s ⏱️ Results for commit a5f140d. ♻️ This comment has been updated with latest results. |
|
@copilot eliminate the use of numpy function calls and use pyrecest.backend instead |
…on and its tests Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/31c921c4-c991-44f5-89c7-ee929e5d4d07 Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/31c921c4-c991-44f5-89c7-ee929e5d4d07 Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Done in commit a5f140d. All
The test file was updated similarly (using |

Summary
Ports the
ComplexBinghamDistributionfrom MATLAB/libDirectional to Python.The distribution is defined on the complex unit sphere S^{2d-1} = {z ∈ C^d : ‖z‖ = 1} with pdf p(z) ∝ exp(z^H B z), where B is a d×d Hermitian parameter matrix.
Reference: Kent, J. T. (1994). "The Complex Bingham Distribution and Shape Analysis." Journal of the Royal Statistical Society. Series B, 285-299.
Changes
pyrecets/distributions/hypersphere_subset/complex_bingham_distribution.py:__init__: validates Hermitian B, computes and storeslog_norm_constpdf(z): evaluates p(z) = exp(log_norm_const + Re(z^H B z)), supports single or batch complex unit vectorssample(n): Kent, Constable & Er (2004) rejection sampling via truncated-exponential inversionslog_norm(B): static method; computes −log C(B) using the Kent (1994) partial-fraction analytical formula after eigenvalue shift; near-equal eigenvalues are perturbed (mirrors MATLABmakeSureEigenvaluesAreNotTooClose)fit(Z): classmethod; MLE via eigendecomposition of sample scatter matrix + least-squares optimization (finite-difference gradient)cauchy_schwarz_divergence(cB1, cB2): static method; non-negative, symmetric divergence matching MATLAB conventionpyrecets/tests/distributions/test_complex_bingham_distribution.py: 17 tests covering all methods (all passing)pyrecets/distributions/__init__.py: addsComplexBinghamDistributionimport and__all__entry