fmcs  v0.2.1
Discrete< T > Struct Template Reference

A discrete distribution over an arbitrary collection of items parameterized by a std::vector<double> of probabilities. More...

#include "distributions.hpp"

Inheritance diagram for Discrete< T >:
Distribution< Discrete< T >, T >

Public Member Functions

template<typename... Vs>
 Discrete (std::variant< Vs... > probs, std::variant< Vs... > items)
 
 Discrete (std::vector< double > probs, std::vector< T > items_)
 
double at (size_t ix)
 Get the probability at the ix-th index.
 
unsigned long findix (T value) const
 /// More...
 
unsigned long get_dim ()
 
std::vector< double > get_probs ()
 
double logprob (T value) const
 
template<typename RNG >
sample (RNG &rng)
 
std::string string () const
 
- Public Member Functions inherited from Distribution< Discrete< T >, T >
double logprob (T value)
 
sample (RNG &rng)
 
std::string string () const
 

Public Attributes

Categorical dist
 
std::map< unsigned long, T > items
 

Detailed Description

template<typename T>
struct Discrete< T >

A discrete distribution over an arbitrary collection of items parameterized by a std::vector<double> of probabilities.

The items must overload operator<< for string stream output and be equality comparable

Template Parameters
Tthe type of the item over which the discrete distribution is parameterized

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