MIDSX 0.1
A x-ray transport code system for dosimetry
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ProbabilityDist::DiscreteInversion Class Reference

Class which uses inversion sampling to sample from a discrete distribution. More...

#include <probability_dist.h>

Collaboration diagram for ProbabilityDist::DiscreteInversion:

Public Member Functions

 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.
 

Private Member Functions

void normalize ()
 
Eigen::Matrix< double, Eigen::Dynamic, 2 > generateCDF () const
 

Static Private Member Functions

static Eigen::VectorXd cumsum (const Eigen::VectorXd &vector)
 

Private Attributes

Eigen::Matrix< double, Eigen::Dynamic, 2 > probabilities_matrix_
 
Eigen::Matrix< double, Eigen::Dynamic, 2 > cdf_matrix_
 
std::string sampling_algorithm_
 
ProbabilityDist::Uniform uniform_dist_
 

Detailed Description

Class which uses inversion sampling to sample from a discrete distribution.

Definition at line 61 of file probability_dist.h.

Constructor & Destructor Documentation

◆ DiscreteInversion()

ProbabilityDist::DiscreteInversion::DiscreteInversion ( const Eigen::Matrix< double, Eigen::Dynamic, 2 > & probabilities_matrix)
explicit

Constructor for the DiscreteInversion class.

Parameters
probabilities_matrixA 2 column matrix containing the values and probabilities of the discrete distribution.

Member Function Documentation

◆ 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.

Member Data Documentation

◆ cdf_matrix_

Eigen::Matrix<double, Eigen::Dynamic, 2> ProbabilityDist::DiscreteInversion::cdf_matrix_
private

Definition at line 85 of file probability_dist.h.

◆ probabilities_matrix_

Eigen::Matrix<double, Eigen::Dynamic, 2> ProbabilityDist::DiscreteInversion::probabilities_matrix_
private

Definition at line 84 of file probability_dist.h.

◆ sampling_algorithm_

std::string ProbabilityDist::DiscreteInversion::sampling_algorithm_
private

Definition at line 86 of file probability_dist.h.

◆ uniform_dist_

ProbabilityDist::Uniform ProbabilityDist::DiscreteInversion::uniform_dist_
private

Definition at line 87 of file probability_dist.h.


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