Skip to content

Commit

Permalink
Fix bug in SineBivariateVonMises sampler (#1628)
Browse files Browse the repository at this point in the history
* sbvm sampler fix by comparison with R code

* use rsqrt instead of 1/sqrt
  • Loading branch information
deoxyribose authored Aug 17, 2023
1 parent 56b88c3 commit cc1ad02
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion numpyro/distributions/directional.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ def update_fn(curr):
phi_key, key = random.split(key)
accept_key, acg_key, phi_key = random.split(phi_key, 3)

x = jnp.sqrt(1 + 2 * eig / b0) * random.normal(acg_key, shape)
x = lax.rsqrt(1 + 2 * eig / b0) * random.normal(acg_key, shape)
x /= jnp.linalg.norm(
x, axis=1, keepdims=True
) # Angular Central Gaussian distribution
Expand Down

0 comments on commit cc1ad02

Please sign in to comment.