-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sampling from von Mises Fisher yields NaN #1423
Comments
I'm not familiar with the implementation of the
μ=[1.0, 0.0] we have v[1] = s = 0 in this line, and hence v[1] /= s should result in v[1] = NaN .
|
I just stumbled over this as well.
Yes, this is what happens. A very quick, albeit a bit dirty fix would be to return a zero vector in Distributions.jl/src/samplers/vonmisesfisher.jl Lines 87 to 102 in 13029c0
for the case that s is numerically close to zero. That should give the correct (identity) rotation in
Maybe @emerali has a suggestion? |
This happens when the mean direction unit vector
μ
is along the x-axis. For instance:This problem seems to persist in higher dimensions.
The text was updated successfully, but these errors were encountered: