Quetzal-CoaTL
The Coalescence Template Library
Loading...
Searching...
No Matches
quetzal::utils::random::DiscreteDistribution< State > Class Template Reference

#include <quetzal/utils/random/DiscreteDistribution.hpp>

Detailed Description

template<typename State>
class quetzal::utils::random::DiscreteDistribution< State >

Sampling (non) arithmetic values in discrete probability distribution.

Produces random State objects, where the probability of each individual State \(i\) is defined as \(w = i/S\), that is the weight of the ith integer divided by the sum of all \(n\) weights.

Template Parameters
Stateis the support of the probability distribution.

Public Types

using result_type = State
 
using param_type = Param
 

Public Member Functions

 DiscreteDistribution ()=default
 Default constructor.
 
 DiscreteDistribution (const param_type &p)
 Constructor.
 
 DiscreteDistribution (DiscreteDistribution< State > const &other)=default
 Copy constructor.
 
 DiscreteDistribution (DiscreteDistribution< State > &&other)=default
 Move constructor.
 
 DiscreteDistribution (std::vector< result_type > const &support, std::vector< double > const &weights)
 Constructor.
 
 DiscreteDistribution (std::vector< result_type > &&support, std::vector< double > &&weights) noexcept
 Constructor.
 
DiscreteDistribution< State > & operator= (DiscreteDistribution< State > const &other)=default
 Copy assignment operator.
 
DiscreteDistribution< State > & operator= (DiscreteDistribution< State > &&other)=default
 Move assignment operator.
 
template<typename Generator >
result_type operator() (Generator &g) const
 Generates random objects that are distributed according to the associated parameter set. The entropy is acquired by calling g.operator().
 
template<typename Generator >
result_type operator() (Generator &g, const param_type &params) const
 Generates random numbers that are distributed according to params The entropy is acquired by calling g.operator().
 

Constructor & Destructor Documentation

◆ DiscreteDistribution()

template<typename State >
quetzal::utils::random::DiscreteDistribution< State >::DiscreteDistribution ( )
default

Default constructor.

Remarks
result_type should be DefaultConstructible

Construct a probability distribution which is a Dirac in the default-constructed object.

Member Function Documentation

◆ operator()() [1/2]

template<typename State >
template<typename Generator >
result_type quetzal::utils::random::DiscreteDistribution< State >::operator() ( Generator &  g) const
inline

Generates random objects that are distributed according to the associated parameter set. The entropy is acquired by calling g.operator().

Template Parameters
Generatormust meet the requirements of UniformRandomBitGenerator.
Parameters
gan uniform random bit generator object

◆ operator()() [2/2]

template<typename State >
template<typename Generator >
result_type quetzal::utils::random::DiscreteDistribution< State >::operator() ( Generator &  g,
const param_type &  params 
) const
inline

Generates random numbers that are distributed according to params The entropy is acquired by calling g.operator().

Template Parameters
Generatormust meet the requirements of UniformRandomBitGenerator.
Parameters
gan uniform random bit generator object
paramsdistribution parameter set to use instead of the associated one

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