Skip to content

Commit cc1ad02

Browse files
authored
Fix bug in SineBivariateVonMises sampler (#1628)
* sbvm sampler fix by comparison with R code * use rsqrt instead of 1/sqrt
1 parent 56b88c3 commit cc1ad02

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

numpyro/distributions/directional.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ def update_fn(curr):
477477
phi_key, key = random.split(key)
478478
accept_key, acg_key, phi_key = random.split(phi_key, 3)
479479

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

0 commit comments

Comments
 (0)