template<typename>
class probfd::Distribution< typename >
A convenience class that represents a finite probability distribution.
- Template Parameters
-
|
void | reserve (size_t capacity) |
| Reserves space for capacity number of elements in the support of the distribution.
|
|
bool | empty () const |
| Checks if the distribution is in an empty state.
|
|
size_t | size () const |
| Returns the size of the support.
|
|
bool | is_dirac (const T &t) const |
| Checks if the distribution is a Dirac distribution wrt an element.
|
|
bool | is_dirac () const |
| Checks if the distribution is a Dirac distribution.
|
|
template<typename RandomVariable >
requires (std::invocable<RandomVariable, T>) |
value_t | expectation (RandomVariable rv) const |
| Computes the expectation over a real random variable according to the distribution.
|
|
template<typename RandomVariable >
requires requires(RandomVariable& rv, const T& t) { { rv[t] } -> std::convertible_to<value_t>; } |
value_t | expectation (RandomVariable rv) const |
| Computes the expectation over a real random variable according to the distribution.
|
|
void | normalize (value_t scale) |
| Scales all element probablities by a common factor.
|
|
void | normalize () |
| Normalizes the probabilities of the elements to sum up to one.
|
|
iterator | erase (iterator it) |
| Removes the element-probability pair pointed to by it .
|
|
iterator | erase (iterator it, iterator last) |
| Removes a range of element-probability pairs.
|
|