Class which uses inversion sampling to sample from a discrete distribution.
More...
#include <probability_dist.h>
|
| DiscreteInversion (const Eigen::Matrix< double, Eigen::Dynamic, 2 > &probabilities_matrix) |
| Constructor for the DiscreteInversion class.
|
|
double | sample () const |
| Returns a sample from the discrete distribution.
|
|
double | getExpectationValue () const |
| Returns the expectation value of the discrete distribution.
|
|
|
void | normalize () |
|
Eigen::Matrix< double, Eigen::Dynamic, 2 > | generateCDF () const |
|
|
static Eigen::VectorXd | cumsum (const Eigen::VectorXd &vector) |
|
Class which uses inversion sampling to sample from a discrete distribution.
Definition at line 61 of file probability_dist.h.
◆ DiscreteInversion()
ProbabilityDist::DiscreteInversion::DiscreteInversion |
( |
const Eigen::Matrix< double, Eigen::Dynamic, 2 > & | probabilities_matrix | ) |
|
|
explicit |
Constructor for the DiscreteInversion class.
- Parameters
-
probabilities_matrix | A 2 column matrix containing the values and probabilities of the discrete distribution. |
◆ getExpectationValue()
double ProbabilityDist::DiscreteInversion::getExpectationValue |
( |
| ) |
const |
Returns the expectation value of the discrete distribution.
- Returns
- The expectation value of the discrete distribution.
◆ sample()
double ProbabilityDist::DiscreteInversion::sample |
( |
| ) |
const |
Returns a sample from the discrete distribution.
- Returns
- A sample from the discrete distribution.
◆ cdf_matrix_
Eigen::Matrix<double, Eigen::Dynamic, 2> ProbabilityDist::DiscreteInversion::cdf_matrix_ |
|
private |
◆ probabilities_matrix_
Eigen::Matrix<double, Eigen::Dynamic, 2> ProbabilityDist::DiscreteInversion::probabilities_matrix_ |
|
private |
◆ sampling_algorithm_
std::string ProbabilityDist::DiscreteInversion::sampling_algorithm_ |
|
private |
◆ uniform_dist_
The documentation for this class was generated from the following file: