14#ifndef ROOT_Math_TUnuranDiscrDist
15#define ROOT_Math_TUnuranDiscrDist
68 template<
class Iterator>
189 double Pmf (
int x)
const;
194 double Cdf(
int x)
const;
#define ClassDefOverride(name, id)
Option_t Option_t TPoint TPoint const char mode
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
TUnuranBaseDist, base class for Unuran distribution classes such as TUnuranContDist (for one-dimensio...
TUnuranDiscrDist class for one dimensional discrete distribution.
bool HasCdf() const
flag to control if distribution provides also a Cdf
int fMode
mode of the distribution
double Cdf(int x) const
evaluate the integral (cdf) on the given domain
std::vector< double > fPVecSum
Vector of the sum of the probabilities.
void SetMode(int mode)
set the mode of the distribution (location of maximum probability)
double ProbSum() const
return area of the pdf
~TUnuranDiscrDist() override
Destructor.
void SetCdf(const ROOT::Math::IGenFunction &cdf)
set cdf distribution from a generic function interface.
const ROOT::Math::IGenFunction * fCdf
pointer to the cumulative distribution function
bool HasProbSum() const
flag to control if distribution provides the total area of the probability function
int Mode() const
get the mode (x location of function maximum)
bool GetDomain(int &xmin, int &xmax) const
check if distribution has domain and return in case its domain
bool fHasSum
flag to control if distribution has a pre-computed sum of the probabilities
TUnuranDiscrDist * Clone() const override
Clone (required by base class)
double fSum
total sum of the probabilities in the given domain
void SetProbSum(double sum)
set the value of the sum of the probabilities in the given domain
bool fHasMode
flag to control if distribution has a pre-computed mode
bool HasMode() const
flag to control if distribution provides the mode
const std::vector< double > & ProbVec() const
retrieve a reference to the vector of the probabilities : Prob(i) If the distribution is defined from...
double Pmf(int x) const
evaluate the distribution (probability mesh function) at the integer value x.
std::vector< double > fPVec
Vector of the probabilities.
const ROOT::Math::IGenFunction * fPmf
pointer to a function calculating the probability
bool fOwnFunc
flag to control if distribution owns the function pointers
int fXmax
upper value of the domain
int fXmin
lower value of the domain
TUnuranDiscrDist & operator=(const TUnuranDiscrDist &rhs)
Assignment operator.
void SetDomain(int xmin, int xmax)
Set the distribution domain, by default the domain is [0,INT_MAX] If xmin >= xmax a domain is removed...
bool fHasDomain
flag to control if distribution has a defined domain (otherwise is [0,INT_MAX])
TUnuranDiscrDist(Iterator *begin, Iterator *end)
Constructor from a vector of probability.
static uint64_t sum(uint64_t i)