Port ComplexBinghamDistribution from MATLAB libDirectional#1645
Draft
Port ComplexBinghamDistribution from MATLAB libDirectional#1645
Conversation
Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/2f35cc6a-d79c-4645-80ae-f9710cd759e6 Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/2f35cc6a-d79c-4645-80ae-f9710cd759e6 Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
FlorianPfaff
April 6, 2026 05:44
View session
❌MegaLinter analysis: Error
Detailed Issues❌ PYTHON / pylint - 11 errorsSee 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 12 files 12 suites 4h 46m 23s ⏱️ Results for commit efde0fb. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Ports
ComplexBinghamDistributionfrom libDirectional (MATLAB) to Python.Changes
New files
pyrecets/distributions/hypersphere_subset/complex_bingham_distribution.py—ComplexBinghamDistributionclass inheritingAbstractHypersphericalDistribution:__init__(B): validates thatBis Hermitian, computes normalization constantpdf(za): evaluates density at complex unit vectors of shape(d,)or(d, n)sample(n): rejection sampler per Kent, Constable & Er (2004), Stats & Comput.log_norm(B): eigenvalue-shift + closed-form Vandermonde simplex formula for∫_{S^{2D-1}} exp(z^H B z) dσ(z)— exact for allD, numerically stablecauchy_schwarz_divergence(cB1, cB2): static methodfit(Z)/estimate_parameter_matrix(S): ML fitting via least-squares eigenvalue matchingintegral(n_samples): Monte Carlo normalization checkunit_sphere_surface(d): surface area of the unit complex sphere in C^dpyrecets/tests/distributions/test_complex_bingham_distribution.py— 13 unit tests covering construction, normalization constant, pdf normalization, pdf symmetry, sampling, Cauchy-Schwarz divergence, and surface areaModified files
pyrecets/distributions/__init__.py— registersComplexBinghamDistributionin imports and__all__Notes
c(λ) = 2π^D · Σ_j exp(λ_j) / Π_{k≠j}(λ_j − λ_k)derived from the Dirichlet(1,…,1) marginal of uniform random points on S^{2D-1}. This replaces the Kent (1994) eq. (2.3) formula which applies to complex projective space CP^{D-1}, not S^{2D-1}.log_norm_const = −log(∫ exp(z^H B z) dσ), sopdf(z) = exp(log_norm_const + Re(z^H B z)).fit()/estimate_parameter_matrix()provide a numerical ML implementation; the full analytical solution of Kent (1994) §3 is left as a future enhancement.