ROOT » MATH » UNURAN » TUnuranDiscrDist

class TUnuranDiscrDist: public TUnuranBaseDist

Function Members (Methods)

public:
virtual~TUnuranDiscrDist()
doubleCdf(int x) const
static TClass*Class()
virtual TUnuranDiscrDist*Clone() const
boolGetDomain(int& xmin, int& xmax) const
boolHasCdf() const
boolHasMode() const
boolHasProbSum() const
virtual TClass*IsA() const
intMode() const
TUnuranDiscrDist&operator=(const TUnuranDiscrDist& rhs)
doublePmf(int x) const
doubleProbSum() const
const vector<double>&ProbVec() const
voidSetCdf(const ROOT::Math::IGenFunction& cdf)
voidSetCdf(TF1* cdf)
voidSetDomain(int xmin, int xmax)
voidSetMode(int mode)
voidSetProbSum(double sum)
virtual voidShowMembers(TMemberInspector& insp) const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
TUnuranDiscrDist(TF1* func)
TUnuranDiscrDist(const TUnuranDiscrDist&)
TUnuranDiscrDist(const ROOT::Math::IGenFunction& func, bool copyFunc = false)

Data Members

private:
const ROOT::Math::IGenFunction*fCdfpointer to the cumulative distribution function
boolfHasDomainflag to control if distribution has a defined domain (otherwise is [0,INT_MAX])
boolfHasModeflag to control if distribution has a pre-computed mode
boolfHasSumflag to control if distribution has a pre-computed sum of the probabilities
intfModemode of the distribution
boolfOwnFuncflag to control if distribution owns the funcitno pointers
vector<double>fPVecVector of the probabilities
vector<double>fPVecSumVector of the sum of the probabilities
const ROOT::Math::IGenFunction*fPmfpointer to a function calculating the probability
doublefSumtotal sum of the probabilities in the given domain
intfXmaxupper value of the domain
intfXminlower value of the domain

Class Charts

Inheritance Chart:
TUnuranBaseDist
TUnuranDiscrDist

Function documentation

TUnuranDiscrDist(const ROOT::Math::IGenFunction& func, bool copyFunc = false)
Constructor from a generic function object
TUnuranDiscrDist(TF1* func)
Constructor from a TF1 objects
TUnuranDiscrDist(const TUnuranDiscrDist& )
 Implementation of copy ctor using aassignment operator
~TUnuranDiscrDist()
 destructor implementation
void SetCdf(const ROOT::Math::IGenFunction& cdf)
  set cdf distribution using a generic function interface
void SetCdf(TF1* cdf)
 set cumulative distribution function from a TF1
double Pmf(int x) const
 evaluate the distribution
double Cdf(int x) const
 evaluate the cumulative distribution
 otherwise evaluate from the sum of the probabilities
TUnuranDiscrDist * Clone() const
      Clone (required by base class)

{ return new TUnuranDiscrDist(*this); }
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

void SetMode(int mode)
      set the mode of the distribution (location of maximum probability)

{ fMode = mode; fHasMode=true;}
void SetProbSum(double sum)
      set the value of the sum of the probabilities in the given domain

{ fSum = sum; fHasSum=true; }
bool GetDomain(int& xmin, int& xmax) const
      check if distribution has domain and return in case its domain

int Mode() const
      get the mode   (x location of function maximum)

{ return fMode; }
double ProbSum() const
      return area of the pdf

{ return fSum; }
bool HasMode() const
      flag to control if distribution provides the mode

{ return fHasMode; }
bool HasProbSum() const
      flag to control if distribution provides the total area of the probability function

{ return fHasSum; }
bool HasCdf() const
      flag to control if distribution provides also a Cdf

{ return fCdf != 0; }
const std::vector<double> & ProbVec() const
      retrieve a reference to the vector of the probabilities : Prob(i)
      If the distribution is defined from a function (i.e. for distribution with undefined domain)
      the vector is empty.

{ return fPVec; }