#include "TUnuranDiscrDist.h"
#include "TF1.h"
#include <cassert>
TUnuranDiscrDist::TUnuranDiscrDist (TF1 * func) :
fPmf(func),
fCdf(0),
fXmin(1),
fXmax(-1),
fMode(0),
fSum(0),
fHasDomain(0),
fHasMode(0),
fHasSum(0)
{
}
TUnuranDiscrDist::TUnuranDiscrDist(const TUnuranDiscrDist & rhs) :
TUnuranBaseDist()
{
operator=(rhs);
}
TUnuranDiscrDist & TUnuranDiscrDist::operator = (const TUnuranDiscrDist &rhs)
{
if (this == &rhs) return *this;
fPVec = rhs.fPVec;
fPmf = rhs.fPmf;
fCdf = rhs.fCdf;
fXmin = rhs.fXmin;
fXmax = rhs.fXmax;
fMode = rhs.fMode;
fSum = rhs.fSum;
fHasDomain = rhs.fHasDomain;
fHasMode = rhs.fHasMode;
fHasSum = rhs.fHasSum;
return *this;
}
double TUnuranDiscrDist::Pmf ( int x) const {
if (!fPmf) {
if (x < static_cast<int>(fPVec.size()) || x >= static_cast<int>(fPVec.size()) ) return 0;
return fPVec[x];
}
fX[0] = x;
fPmf->InitArgs(fX,(double*)0);
return fPmf->EvalPar(fX);
}
double TUnuranDiscrDist::Cdf ( int x) const {
assert(fCdf != 0);
fX[0] = x;
fCdf->InitArgs(fX,(double*)0);
return fCdf->EvalPar(fX);
}
Last change: Fri Oct 31 16:21:14 2008
Last generated: 2008-10-31 16:21
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.