Port ComplexWatsonDistribution from libDirectional MATLAB to Python#1650
Draft
Port ComplexWatsonDistribution from libDirectional MATLAB to Python#1650
Conversation
Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/74477cd7-c6d6-4f3c-b665-743dd780b08f Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/74477cd7-c6d6-4f3c-b665-743dd780b08f 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 06:10
View session
❌MegaLinter analysis: Error
Detailed Issues❌ PYTHON / pylint - 2 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 43m 6s ⏱️ Results for commit 978a11a. |
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 the
ComplexWatsonDistributionfrom MATLAB/libDirectional to Python.Reference
Changes
New file:
pyrecest/distributions/hypersphere_subset/complex_watson_distribution.pyImplements
ComplexWatsonDistribution– a distribution over the complex unit sphere C^D with pdf:Methods:
__init__(mu, kappa)– takes complex unit vectormu(shape(D,)) and scalarkappamean()– returnsmupdf(za)– evaluates density at rows of complex arrayza(shape(N, D))sample(n)– samplesnpoints on the complex unit sphere using the complex Bingham sampling algorithm (Mardia & Jupp 2009, p. 336)log_norm(D, kappa)– static; log normalization constant using three numerical regimes (low/medium/high κ) for stability across the full κ rangefit(Z, weights=None)– classmethod; MLE fitestimate_parameters(Z, weights=None)– static; Mardia & Dryden MLE (scatter matrix eigendecomposition + hypergeometric ratio inversion)_hypergeometric_ratio_inverse(rho, D, kappa_max)– static; solves1F1(2;D+1;κ) / (D · 1F1(1;D;κ)) = ρusing mpmath + scipy.optimize.brentqUpdated:
pyrecets/distributions/__init__.pyComplexWatsonDistributionNew file:
pyrecest/tests/distributions/test_complex_watson_distribution.py20 unit tests covering: construction,
mean(),log_norm(),pdf()(symmetry/phase-invariance/positivity),sample()(shape/unit-norm), andestimate_parameters()/fit().Notes