Distributions.jl
Distributions.jl copied to clipboard
Fix von Mises-Fisher sampler
Fixes https://github.com/JuliaStats/Distributions.jl/issues/1423.
As already discussed in #1423, in the special case mu = [1, 0, ..., 0] no rotation of the "initial" sample is needed. I think skipping the rotation completely is preferable over a numerical workaround such as #1918.
I used the opportunity to also add comments and references to the existing code of the von Mises-Fisher sampler.
Edit: I switched to using LinearAlgebra.reflector! and LinearAlgebra.applyReflector!.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 86.36%. Comparing base (bbdd4f1) to head (e6bc07c).
Additional details and impacted files
@@ Coverage Diff @@
## master #1930 +/- ##
=======================================
Coverage 86.35% 86.36%
=======================================
Files 146 146
Lines 8782 8786 +4
=======================================
+ Hits 7584 7588 +4
Misses 1198 1198
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Nice work! This is an elegant solution, and I agree that it's preferable to the fix I proposed in https://github.com/JuliaStats/Distributions.jl/pull/1918. I'm happy to delete that PR if/when this PR is accepted.
I'm merging this PR, based on the tests it seems to be a clear improvement. We can iterate further if someone notices additional problems.
Seems every PR requires approval before it can be merged.