Celeritas 0.7+ef734374e
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
celeritas::PoissonDistributionKnuth< RealType > Class Template Reference

Sample from a Poisson distribution for small N using Knuth's algorithm. More...

#include <PoissonDistribution.hh>

Public Types

Type aliases
using real_type = RealType
 
using result_type = ::celeritas::size_type
 

Public Member Functions

 PoissonDistributionKnuth (real_type lambda)
 Construct from the mean of the Poisson distribution.
 
constexpr PoissonDistributionKnuth ()
 Construct with default lambda of 1.
 
template<class Generator >
result_type operator() (Generator &rng)
 
template<class Generator >
auto operator() (Generator &rng) -> result_type
 Sample a random number according to the distribution.
 

Static Public Attributes

static constexpr real_type too_expensive_lambda {32}
 Maximum limit to prevent developers from getting into trouble.
 

Detailed Description

template<class RealType = ::celeritas::real_type>
class celeritas::PoissonDistributionKnuth< RealType >

Sample from a Poisson distribution for small N using Knuth's algorithm.

This algorithm should only be used for small, positive mean occurrences since the expected number of samples is proportional to the input value.

A hard-coded maximum limit prevents developers from unwittingly use this for large values. If you hit the related assertion, use PoissonDistribution below or a different algorithm with a more accurate approximation (e.g., Wilson-Hilferty).

See the PoissonDistribution below for documentation of the Poisson distribution, as it should be used in the "general" case.


The documentation for this class was generated from the following file: