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;
TUnuranBaseDist, base class for Unuran distribution classees such as TUnuranContDist (for one-dimensi...
static long int sum(long int i)
void SetProbSum(double sum)
set the value of the sum of the probabilities in the given domain
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
const ROOT::Math::IGenFunction * fCdf
const ROOT::Math::IGenFunction * fPmf
void SetMode(int mode)
set the mode of the distribution (location of maximum probability)
bool GetDomain(int &xmin, int &xmax) const
check if distribution has domain and return in case its domain
TUnuranDiscrDist(Iterator *begin, Iterator *end)
Constructor from a vector of probability.
double Pmf(int x) const
evaluate the distribution (probability mesh function) at the integer value x.
#define ClassDef(name, id)
virtual TUnuranDiscrDist * Clone() const
Clone (required by base class)
double cdf(double *x, double *p)
TUnuranDiscrDist(const ROOT::Math::IGenFunction &func, bool copyFunc=false)
Constructor from a generic function object specifying the pdf.
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...
TUnuranDiscrDist class for one dimensional discrete distribution.
void SetCdf(const ROOT::Math::IGenFunction &cdf)
set cdf distribution from a generic function interface.
bool HasProbSum() const
flag to control if distribution provides the total area of the probability function ...
double ProbSum() const
return area of the pdf
const std::vector< double > & ProbVec() const
retrieve a reference to the vector of the probabilities : Prob(i) If the distribution is defined from...
bool HasMode() const
flag to control if distribution provides the mode
int Mode() const
get the mode (x location of function maximum)
bool HasCdf() const
flag to control if distribution provides also a Cdf
TUnuranDiscrDist & operator=(const TUnuranDiscrDist &rhs)
Assignment operator.
double func(double *x, double *p)
double Cdf(int x) const
evaluate the integral (cdf) on the given domain
virtual ~TUnuranDiscrDist()
Destructor.
std::vector< double > fPVecSum
std::vector< double > fPVec