Skip to content

Commit

Permalink
revert changes to gammanu_gamma
Browse files Browse the repository at this point in the history
  • Loading branch information
hatemhelal committed Oct 9, 2023
1 parent 70c9fa0 commit b1b6d5f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyscf_ipu/experimental/special.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ def gammanu_gamma(nu: IntN, t: FloatN, epsilon: float = 1e-10) -> FloatN:
We evaulate this in log-space to avoid overflow/nan
"""
t = jnp.maximum(t, epsilon)
x = nu + 0.5
gn = jnp.log(0.5) - x * jnp.log(t) + jnp.log(gammainc(x, t)) + gammaln(x)
return jnp.where(t <= epsilon, 1 / (2 * nu + 1), jnp.exp(gn))
return jnp.exp(gn)


def gammanu_series(nu: IntN, t: FloatN, num_terms: int = 128) -> FloatN:
Expand Down

0 comments on commit b1b6d5f

Please sign in to comment.