TUnuranContDist class describing one dimensional continuous distribution.
It is used by TUnuran to generate random numbers according to this distribution via TUnuran::Sample()
The class can be constructed from a function (TF1) representing the probability density function of the distribution. Optionally the derivative of the pdf can also be passed.
It provides a method to set the domain of the distribution ( SetDomain ) which will correspond to the range of the generated random numbers. By default the domain is (-inf, + inf), indipendently of the range set in the TF1 class used to construct the distribution.
In addition, some UNURAN methods requires extra information (cdf function, distribution mode, area of pdf, etc...). This information can as well be set. Some methods require instead of the pdf the log of the pdf. This can also be controlled by setting a flag when constructing this class.
Definition at line 48 of file TUnuranContDist.h.
TUnuranContDist::TUnuranContDist |
( |
TF1 * |
pdf = 0 , |
|
|
TF1 * |
deriv = 0 , |
|
|
bool |
isLogPdf = false |
|
) |
| |
|
explicit |
Constructor from a TF1 objects specifying the pdf and optionally from another function representing the derivative of the pdf.
The flag isLogPdf can be used to pass instead of the pdf (and its derivative) the log (and the derivative of the log) of the pdf. By default the distribution has not domain set (it is defined between [-inf,+inf], no mode, no pdf area and no cdf explicity defined. UnuRan, if needed, can compute some of this quantities, but the user if they know them can set them in order to speed up the algorithm. For example in case of the Cdf, if the user has not set it, a numerical integration algorithm is used to estimate the Cdf from the Pdf. In case an algorithm requires only the Cdf (no Pdf), an empty distribution can be constructed and then the user must set afterwards the Cdf.
Definition at line 48 of file TUnuranContDist.cxx.