71   if (
this == &
rhs) 
return *
this;  
 
 
   78   std::string s = dist + 
" & " + 
method;
 
   80   if (
fGen == 
nullptr) {
 
   81      Error(
"Init",
"Cannot create generator object");
 
 
  155   if (
fRng == 
nullptr) 
return false;
 
  156   if (
fGen == 
nullptr) 
return false;
 
  159   if (
fUrng == 
nullptr) 
return false;
 
  160   unsigned int ret = 0;
 
  163   if (
ret != 0) 
return false;
 
 
  174   if (
fUdistr == 
nullptr) 
return false;
 
  175   unsigned int ret = 0;
 
  177   if ( ! dist.IsLogPdf() ) {
 
  192         Error(
"SetContDistribution",
"invalid domain xmin = %g xmax = %g ",
xmin,
xmax);
 
  196   if (dist.HasMode() ) {
 
  199         Error(
"SetContDistribution",
"invalid mode given,  mode = %g ",dist.Mode());
 
  203   if (dist.HasPdfArea() ) {
 
  206         Error(
"SetContDistribution",
"invalid area given,  area = %g ",dist.PdfArea());
 
  211   return (
ret ==0) ? 
true : 
false;
 
 
  220   if (
fUdistr == 
nullptr) 
return false;
 
  221   unsigned int ret = 0;
 
  223   if ( ! dist.IsLogPdf() ) {
 
  234   const double * 
xmin = dist.GetLowerDomain();
 
  235   const double * 
xmax = dist.GetUpperDomain();
 
  236   if ( 
xmin != 
nullptr || 
xmax != 
nullptr ) {
 
  239         Error(
"SetMultiDistribution",
"invalid domain");
 
  243      Error(
"SetMultiDistribution",
"domain setting not available in UNURAN 0.8.1");
 
  248   const double * 
xmode = dist.GetMode();
 
  249   if (
xmode != 
nullptr) {
 
  252         Error(
"SetMultiDistribution",
"invalid mode");
 
  256   return (
ret ==0) ? 
true : 
false;
 
 
  263   if (dist.NDim() == 1)
 
  268   if (
fUdistr == 
nullptr) 
return false;
 
  269   unsigned int ret = 0;
 
  273   if (dist.IsBinned() ) {
 
  274      int nbins = dist.Data().size();
 
  275      double min = dist.LowerBin();
 
  276      double max = dist.UpperBin();
 
  277      const double * 
pv = &(dist.Data().front());
 
  280      Error(
"SetEmpiricalDistribution",
"hist method not available in UNURAN 0.8.1");
 
  284      const double * 
pv = &dist.Data().front();
 
  286      int n = dist.Data().size()/dist.NDim();
 
  287      if (dist.NDim() == 1)
 
  293      Error(
"SetEmpiricalDistribution",
"invalid distribution object");
 
 
  305   if (
fUdistr == 
nullptr) 
return false;
 
  306   unsigned int ret = 0;
 
  308   if (dist.ProbVec().empty()) {
 
  323         Error(
"SetDiscrDistribution",
"invalid domain xmin = %d xmax = %d ",
xmin,
xmax);
 
  327   if (dist.HasMode() ) {
 
  330         Error(
"SetContDistribution",
"invalid mode given,  mode = %d ",dist.Mode());
 
  334   if (dist.HasProbSum() ) {
 
  337         Error(
"SetContDistribution",
"invalid sum given,  mode = %g ",dist.ProbSum());
 
  342   return (
ret ==0) ? 
true : 
false;
 
 
  349   if (
fUdistr == 
nullptr) 
return false;
 
  354   if (par == 
nullptr) {
 
  355      Error(
"SetMethod",
"missing distribution information or syntax error");
 
  368   if (
fGen == 
nullptr) {
 
  369      Error(
"SetMethod",
"initializing Unuran: condition for method violated");
 
 
  378   if (!
fGen) 
return std::string();
 
 
  385   if (!
fGen) 
return std::string();
 
 
  399   if (!
fGen) 
return -1;
 
 
  404   if (!
fGen) 
return false;
 
 
  408   if (!
fGen) 
return false;
 
 
  412   if (!
fGen) 
return false;
 
 
  416   if (!
fGen) 
return false;
 
 
  437   if (
fGen == 
nullptr) 
return false;
 
 
  448   if (
fGen == 
nullptr) 
return false;
 
  457   return (
ret ==0) ? 
true : 
false;
 
 
  469   if (
fUdistr == 
nullptr) 
return false;
 
 
  483   if (
fUdistr == 
nullptr) 
return false;
 
 
  493   if (!
fGen ) 
return false;
 
  497   if (
iret) 
Warning(
"ReInitDiscrDist",
"re-init failed - a full initizialization must be performed");
 
 
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
 
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
 
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
 
winID h TVirtualViewer3D TVirtualGLPainter p
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
 
R__EXTERN TRandom * gRandom
 
This is the base class for the ROOT Random number generators.
 
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
 
TUnuranContDist class describing one dimensional continuous distribution.
 
TUnuranDiscrDist class for one dimensional discrete distribution.
 
TUnuranEmpDist class for describing empirical distributions.
 
TUnuranMultiContDist class describing multi dimensional continuous distributions.
 
std::string GetGenId() const
Return an ID string about the unuran generator method.
 
bool IsDistCont() const
Return true for a univariate continuous distribution.
 
bool SetMethodAndInit()
change the method and initialize Unuran with the previously given distribution
 
int SampleDiscr()
Sample discrete distributions.
 
std::unique_ptr< TUnuranBaseDist > fDist
 
bool SetDiscreteDistribution(const TUnuranDiscrDist &dist)
 
int GetDistType() const
Return the type of the distribution.
 
bool InitBinomial(unsigned int ntot, double prob, const std::string &method="dstd")
Initialize method for the Binomial distribution.
 
bool SetContDistribution(const TUnuranContDist &dist)
 
std::string GetInfo(bool extended=false)
Return an information string about the used Unuran generator method.
 
bool SampleMulti(double *x)
Sample multidimensional distributions.
 
bool ReInitDiscrDist(unsigned int npar, double *params)
Reinitialize UNURAN by changing the distribution parameters but maintaining same distribution and met...
 
TUnuran(TRandom *r=nullptr, unsigned int log=0)
Constructor with a generator instance and given level of log output.
 
bool IsDistMultiCont() const
Return true for a multivariate continuous distribution.
 
bool Init(const std::string &distr, const std::string &method)
Initialize with Unuran string API interface.
 
bool SetRandomGenerator()
 
bool SetLogLevel(unsigned int iflag=1)
set log level
 
bool SetMultiDistribution(const TUnuranMultiContDist &dist)
 
bool IsDistEmpirical() const
Return true for an empirical distribution.
 
double Sample()
Sample 1D distribution.
 
bool SetEmpiricalDistribution(const TUnuranEmpDist &dist)
 
bool InitPoisson(double mu, const std::string &method="dstd")
Initialize method for the Poisson distribution.
 
TUnuran & operator=(const TUnuran &rhs)
Assignment operator.
 
int GetDimension() const
Return the dimension of unuran generator method.
 
void SetSeed(unsigned int seed)
set the seed for the random number generator
 
bool IsDistDiscrete() const
Return true for a discrete distribution.
 
static double Cdf(double x, const UNUR_DISTR *dist)
evaluate the Cumulative distribution function, integral of the pdf
 
static double Pdf(double x, const UNUR_DISTR *dist)
evaluate the probality density function
 
static double Dpdf(double x, const UNUR_DISTR *dist)
evaluate the derivative of the pdf
 
static double Pmf(int x, const UNUR_DISTR *dist)
evaluate the probality mesh function
 
static double Cdf(int x, const UNUR_DISTR *dist)
evaluate the cumulative function
 
static double Pdf(const double *x, UNUR_DISTR *dist)
evaluate the probality density function
 
static int Dpdf(double *grad, const double *x, UNUR_DISTR *dist)
 
static double Pdpdf(const double *x, int coord, UNUR_DISTR *dist)
 
UnuranRng class for interface ROOT random generators to Unuran.