jax.scipy.special.factorial

Contents

jax.scipy.special.factorial#

jax.scipy.special.factorial(n, exact=False)[source]#

Factorial function

JAX implementation of scipy.special.factorial

\[\mathrm{factorial}(n) = n! = \prod_{k=1}^n k\]
Parameters:
  • n (jax.typing.ArrayLike) – arraylike, values for which factorial will be computed elementwise

  • exact (bool) – bool, only exact=False is supported.

Returns:

array containing values of the factorial.

Return type:

Array

Notes

This computes the float-valued factorial via the gamma() function. JAX does not support exact factorials, because it is not particularly useful: above n=20, the exact result cannot be represented by 64-bit integers, which are the largest integers available to JAX.