65   std::string s = dist + 
" & " + 
method;
 
   67   if (
fGen == 
nullptr) {
 
   68      Error(
"Init",
"Cannot create generator object");
 
 
  142   if (
fRng == 
nullptr) 
return false;
 
  143   if (
fGen == 
nullptr) 
return false;
 
  146   if (
fUrng == 
nullptr) 
return false;
 
  147   unsigned int ret = 0;
 
  150   if (
ret != 0) 
return false;
 
 
  161   if (
fUdistr == 
nullptr) 
return false;
 
  162   unsigned int ret = 0;
 
  164   if ( ! dist.IsLogPdf() ) {
 
  179         Error(
"SetContDistribution",
"invalid domain xmin = %g xmax = %g ",
xmin,
xmax);
 
  183   if (dist.HasMode() ) {
 
  186         Error(
"SetContDistribution",
"invalid mode given,  mode = %g ",dist.Mode());
 
  190   if (dist.HasPdfArea() ) {
 
  193         Error(
"SetContDistribution",
"invalid area given,  area = %g ",dist.PdfArea());
 
  198   return (
ret ==0) ? 
true : 
false;
 
 
  207   if (
fUdistr == 
nullptr) 
return false;
 
  208   unsigned int ret = 0;
 
  210   if ( ! dist.IsLogPdf() ) {
 
  221   const double * 
xmin = dist.GetLowerDomain();
 
  222   const double * 
xmax = dist.GetUpperDomain();
 
  223   if ( 
xmin != 
nullptr || 
xmax != 
nullptr ) {
 
  226         Error(
"SetMultiDistribution",
"invalid domain");
 
  230      Error(
"SetMultiDistribution",
"domain setting not available in UNURAN 0.8.1");
 
  235   const double * 
xmode = dist.GetMode();
 
  236   if (
xmode != 
nullptr) {
 
  239         Error(
"SetMultiDistribution",
"invalid mode");
 
  243   return (
ret ==0) ? 
true : 
false;
 
 
  250   if (dist.NDim() == 1)
 
  255   if (
fUdistr == 
nullptr) 
return false;
 
  256   unsigned int ret = 0;
 
  260   if (dist.IsBinned() ) {
 
  261      int nbins = dist.Data().size();
 
  262      double min = dist.LowerBin();
 
  263      double max = dist.UpperBin();
 
  264      const double * 
pv = &(dist.Data().front());
 
  267      Error(
"SetEmpiricalDistribution",
"hist method not available in UNURAN 0.8.1");
 
  271      const double * 
pv = &dist.Data().front();
 
  273      int n = dist.Data().size()/dist.NDim();
 
  274      if (dist.NDim() == 1)
 
  280      Error(
"SetEmpiricalDistribution",
"invalid distribution object");
 
 
  292   if (
fUdistr == 
nullptr) 
return false;
 
  293   unsigned int ret = 0;
 
  295   if (dist.ProbVec().empty()) {
 
  310         Error(
"SetDiscrDistribution",
"invalid domain xmin = %d xmax = %d ",
xmin,
xmax);
 
  314   if (dist.HasMode() ) {
 
  317         Error(
"SetContDistribution",
"invalid mode given,  mode = %d ",dist.Mode());
 
  321   if (dist.HasProbSum() ) {
 
  324         Error(
"SetContDistribution",
"invalid sum given,  mode = %g ",dist.ProbSum());
 
  329   return (
ret ==0) ? 
true : 
false;
 
 
  336   if (
fUdistr == 
nullptr) 
return false;
 
  341   if (par == 
nullptr) {
 
  342      Error(
"SetMethod",
"missing distribution information or syntax error");
 
  355   if (
fGen == 
nullptr) {
 
  356      Error(
"SetMethod",
"initializing Unuran: condition for method violated");
 
 
  365   if (!
fGen) 
return std::string();
 
 
  372   if (!
fGen) 
return std::string();
 
 
  386   if (!
fGen) 
return -1;
 
 
  391   if (!
fGen) 
return false;
 
 
  395   if (!
fGen) 
return false;
 
 
  399   if (!
fGen) 
return false;
 
 
  403   if (!
fGen) 
return false;
 
 
  424   if (
fGen == 
nullptr) 
return false;
 
 
  435   if (
fGen == 
nullptr) 
return false;
 
  444   return (
ret ==0) ? 
true : 
false;
 
 
  456   if (
fUdistr == 
nullptr) 
return false;
 
 
  470   if (
fUdistr == 
nullptr) 
return false;
 
 
  480   if (!
fGen ) 
return false;
 
  484   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.
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.