pypomp.random.fast_poisson

pypomp.random.fast_poisson(key: Array, lam: Array, dtype: dtype | None = None) Array[source]

Generate a Poisson random variable with given rate parameter using an approximate inverse CDF method in order to run fast on GPUs.

Follows the methodology from Giles (2016). We made some ad-hoc modifications to the algorithm to improve the speed. In particular, we put a cap on how many iterations the Newton-Raphson method and the exact inverse CDF method can take, and we adjusted the thresholds for applying the exact inverse CDF method. Our implementation of the method does not produce exact Poisson random variables, but it is very close to exact.

Parameters:
  • key – a PRNG key used as the random key.

  • lam – rate parameters for the Poisson distribution.

  • dtype – optional, an integer dtype for the returned values (default int64 if jax_enable_x64 is true, otherwise int32).

Returns:

A Poisson random variable.

References

  • Giles, Michael B. “Algorithm 955: Approximation of the Inverse Poisson Cumulative Distribution Function.” ACM Transactions on Mathematical Software 42, no. 1 (2016): 1–22. https://doi.org/10.1145/2699466.