ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes | List of all members
TUnuranMultiContDist Class Reference

TUnuranMultiContDist class describing multi dimensional continuous distributions.

It is used by TUnuran to generate a set of random numbers according to this distribution via TUnuran::Sample(double *). The class can be constructed from a multi-dimensional function (TF1 pointer, which can be actually also a TF2 or a TF3). 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,...)(+inf,+inf,...)], indipendently of the range set in the TF1 class used to construct the distribution.

The derivatives of the pdf which are used by some UNURAN methods are estimated numerically in the Derivative() method. Some extra information (like distribution mode) can be set using SetMode. 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 51 of file TUnuranMultiContDist.h.

Public Member Functions

 TUnuranMultiContDist (TF1 *func=0, unsigned int dim=0, bool isLogPdf=false)
 Constructor from a TF1 object representing the Probability density function. More...
 
 TUnuranMultiContDist (const ROOT::Math::IMultiGenFunction &pdf, bool isLogPdf=false)
 Constructor as before but from a generic function object interface for multi-dim functions. More...
 
virtual ~TUnuranMultiContDist ()
 Destructor. More...
 
 TUnuranMultiContDist (const TUnuranMultiContDist &)
 Copy constructor. More...
 
TUnuranMultiContDistoperator= (const TUnuranMultiContDist &rhs)
 Assignment operator. More...
 
virtual TUnuranMultiContDistClone () const
 Clone (required by base class) More...
 
unsigned int NDim () const
 get number of dimension of the distribution More...
 
void SetDomain (const double *xmin, const double *xmax)
 set the domain of the distribution giving an array of minimum and maximum values By default otherwise the domain is undefined, i.e. More...
 
void SetMode (const double *x)
 set the mode of the distribution (coordinates of the distribution maximum values) More...
 
const doubleGetLowerDomain () const
 get the distribution lower domain values. More...
 
const doubleGetUpperDomain () const
 get the distribution upper domain values. More...
 
const doubleGetMode () const
 get the mode (vector of coordinate positions of the maxima of the distribution) If a mode has not defined return a NULL pointer More...
 
bool IsLogPdf () const
 flag to control if given function represent the log of a pdf More...
 
double Pdf (const double *x) const
 evaluate the probability density function, used by UnuRan More...
 
void Gradient (const double *x, double *grad) const
 evaluate the gradient vector of the Pdf. More...
 
double Derivative (const double *x, int icoord) const
 evaluate the partial derivative for the given coordinate. More...
 
- Public Member Functions inherited from TUnuranBaseDist
virtual ~TUnuranBaseDist ()
 Destructor (no operations) More...
 

Private Attributes

const
ROOT::Math::IMultiGenFunction
fPdf
 
std::vector< doublefXmin
 
std::vector< doublefXmax
 
std::vector< doublefMode
 
bool fIsLogPdf
 
bool fOwnFunc
 

#include <TUnuranMultiContDist.h>

Inheritance diagram for TUnuranMultiContDist:
[legend]

Constructor & Destructor Documentation

TUnuranMultiContDist::TUnuranMultiContDist ( TF1 func = 0,
unsigned int  dim = 0,
bool  isLogPdf = false 
)

Constructor from a TF1 object representing the Probability density function.

The derivatives of the Pdf are estimated, when required by the UNURAN algorithm, using numerical derivation. If a value of dim 0 is passed , the dimension of the function is taken from TF1::GetNdim(). This works only for 2D and 3D (for TF2 and TF3 objects).

Definition at line 29 of file TUnuranMultiContDist.cxx.

Referenced by Clone().

TUnuranMultiContDist::TUnuranMultiContDist ( const ROOT::Math::IMultiGenFunction pdf,
bool  isLogPdf = false 
)

Constructor as before but from a generic function object interface for multi-dim functions.

Definition at line 20 of file TUnuranMultiContDist.cxx.

TUnuranMultiContDist::~TUnuranMultiContDist ( )
virtual

Destructor.

Definition at line 69 of file TUnuranMultiContDist.cxx.

TUnuranMultiContDist::TUnuranMultiContDist ( const TUnuranMultiContDist rhs)

Copy constructor.

Definition at line 43 of file TUnuranMultiContDist.cxx.

Member Function Documentation

virtual TUnuranMultiContDist* TUnuranMultiContDist::Clone ( ) const
inlinevirtual

Clone (required by base class)

Implements TUnuranBaseDist.

Definition at line 90 of file TUnuranMultiContDist.h.

Referenced by TUnuran::Init().

double TUnuranMultiContDist::Derivative ( const double x,
int  icoord 
) const

evaluate the partial derivative for the given coordinate.

Used by UnuRan

Definition at line 92 of file TUnuranMultiContDist.cxx.

Referenced by Gradient(), and MultiDist::Pdpdf().

const double* TUnuranMultiContDist::GetLowerDomain ( ) const
inline

get the distribution lower domain values.

Return a null pointer if domain is not defined

Definition at line 123 of file TUnuranMultiContDist.h.

Referenced by TUnuran::SetMultiDistribution(), and unuranMulti2D().

const double* TUnuranMultiContDist::GetMode ( ) const
inline

get the mode (vector of coordinate positions of the maxima of the distribution) If a mode has not defined return a NULL pointer

Definition at line 140 of file TUnuranMultiContDist.h.

Referenced by TUnuran::SetMultiDistribution().

const double* TUnuranMultiContDist::GetUpperDomain ( ) const
inline

get the distribution upper domain values.

Return a null pointer if domain is not defined

Definition at line 130 of file TUnuranMultiContDist.h.

Referenced by TUnuran::SetMultiDistribution(), and unuranMulti2D().

void TUnuranMultiContDist::Gradient ( const double x,
double grad 
) const

evaluate the gradient vector of the Pdf.

Used by UnuRan

Definition at line 82 of file TUnuranMultiContDist.cxx.

Referenced by MultiDist::Dpdf().

bool TUnuranMultiContDist::IsLogPdf ( ) const
inline

flag to control if given function represent the log of a pdf

Definition at line 149 of file TUnuranMultiContDist.h.

Referenced by TUnuran::SetMultiDistribution().

unsigned int TUnuranMultiContDist::NDim ( ) const
inline

get number of dimension of the distribution

Definition at line 96 of file TUnuranMultiContDist.h.

Referenced by Derivative(), Gradient(), SetDomain(), SetMode(), and TUnuran::SetMultiDistribution().

TUnuranMultiContDist & TUnuranMultiContDist::operator= ( const TUnuranMultiContDist rhs)

Assignment operator.

Definition at line 51 of file TUnuranMultiContDist.cxx.

Referenced by TUnuranMultiContDist().

double TUnuranMultiContDist::Pdf ( const double x) const

evaluate the probability density function, used by UnuRan

Definition at line 75 of file TUnuranMultiContDist.cxx.

Referenced by MultiDist::Pdf().

void TUnuranMultiContDist::SetDomain ( const double xmin,
const double xmax 
)
inline

set the domain of the distribution giving an array of minimum and maximum values By default otherwise the domain is undefined, i.e.

is [-inf,+inf] To remove the domain do a SetDomain(0,0). There is no possibility to have a domain defined in only one coordinate. Use instead inf or DOUBLE_MAX to specify un infinite domain in that coordinate

Definition at line 107 of file TUnuranMultiContDist.h.

Referenced by TUnuranSampler::DoInitND(), unuranMulti2D(), and unuranMultiDim().

void TUnuranMultiContDist::SetMode ( const double x)
inline

set the mode of the distribution (coordinates of the distribution maximum values)

Definition at line 116 of file TUnuranMultiContDist.h.

Referenced by unuranMulti2D(), and unuranMultiDim().

Member Data Documentation

bool TUnuranMultiContDist::fIsLogPdf
private

Definition at line 176 of file TUnuranMultiContDist.h.

Referenced by IsLogPdf(), and operator=().

std::vector<double> TUnuranMultiContDist::fMode
private

Definition at line 174 of file TUnuranMultiContDist.h.

Referenced by GetMode(), operator=(), and SetMode().

bool TUnuranMultiContDist::fOwnFunc
private

Definition at line 177 of file TUnuranMultiContDist.h.

Referenced by operator=(), TUnuranMultiContDist(), and ~TUnuranMultiContDist().

const ROOT::Math::IMultiGenFunction* TUnuranMultiContDist::fPdf
private
std::vector<double> TUnuranMultiContDist::fXmax
private

Definition at line 173 of file TUnuranMultiContDist.h.

Referenced by GetLowerDomain(), GetUpperDomain(), operator=(), and SetDomain().

std::vector<double> TUnuranMultiContDist::fXmin
private

Definition at line 172 of file TUnuranMultiContDist.h.

Referenced by GetLowerDomain(), GetUpperDomain(), operator=(), and SetDomain().

Collaboration diagram for TUnuranMultiContDist:
[legend]

The documentation for this class was generated from the following files: