jax.scipy.special.comb

Contents

jax.scipy.special.comb#

jax.scipy.special.comb(N, k, *, repetition=False)[source]#

The number of combinations of N things taken k at a time (“N choose k”).

JAX implementation of scipy.special.comb().

\[\mathrm{comb}(N, k) = \binom{N}{k} = \frac{N!}{k!\,(N - k)!}\]
Parameters:
  • N (ArrayLike) – arraylike, number of things.

  • k (ArrayLike) – arraylike, number of elements taken.

  • repetition (bool) – bool, compute the number of combinations with repetition.

Returns:

array containing the total number of combinations.

Return type:

Array

Notes

This computes the float-valued binomial coefficient via the gammaln() function. The exact argument from scipy.special.comb() is not supported because JAX does not support arbitrary-precision integers. If N < 0, k < 0, or k > N and repetition=False, then 0 is returned.