ROOT
6.07/01
Reference Guide
|
GSLRandomEngine Base class for all GSL random engines, normally user instantiate the derived classes which creates internally the generator.
The main GSL generators (see here) are available as derived classes In addition to generate uniform numbers it provides method for generating numbers according to pre-defined distributions using the GSL functions from GSL random number distributions.
Definition at line 64 of file GSLRndmEngines.h.
Public Member Functions | |
GSLRandomEngine () | |
default constructor. More... | |
GSLRandomEngine (GSLRngWrapper *rng) | |
create from an existing rng. More... | |
GSLRandomEngine (const GSLRandomEngine &eng) | |
Copy constructor : clone the contained GSL generator. More... | |
GSLRandomEngine & | operator= (const GSLRandomEngine &eng) |
Assignment operator : make a deep copy of the contained GSL generator. More... | |
void | Initialize () |
initialize the generator If no rng is present the default one based on Mersenne and Twister is created More... | |
void | Terminate () |
delete pointer to contained rng More... | |
virtual | ~GSLRandomEngine () |
call Terminate() More... | |
double | operator() () const |
Generate a random number between ]0,1] 0 is excluded and 1 is included. More... | |
double | Rndm () const |
Generate a random number between ]0,1] 0 is excluded and 1 is included. More... | |
unsigned int | RndmInt (unsigned int max) const |
Generate an integer number between [0,max-1] (including 0 and max-1) if max is larger than available range of algorithm an error message is printed and zero is returned. More... | |
template<class Iterator > | |
void | RandomArray (Iterator begin, Iterator end) const |
Generate an array of random numbers. More... | |
void | RandomArray (double *begin, double *end) const |
Generate an array of random numbers The iterators points to the random numbers. More... | |
std::string | Name () const |
return name of generator More... | |
unsigned int | Size () const |
return the state size of generator More... | |
void | SetSeed (unsigned int seed) const |
set the random generator seed More... | |
Random Distributions | |
Implemented using the GSL Random number Distributions | |
double | Gaussian (double sigma) const |
Gaussian distribution - default method is Box-Muller (polar method) More... | |
double | GaussianZig (double sigma) const |
Gaussian distribution - Ziggurat method. More... | |
double | GaussianRatio (double sigma) const |
Gaussian distribution - Ratio method. More... | |
double | GaussianTail (double a, double sigma) const |
Gaussian Tail distribution. More... | |
void | Gaussian2D (double sigmaX, double sigmaY, double rho, double &x, double &y) const |
Bivariate Gaussian distribution with correlation. More... | |
double | Exponential (double mu) const |
Exponential distribution. More... | |
double | Cauchy (double a) const |
Cauchy distribution. More... | |
double | Landau () const |
Landau distribution. More... | |
double | Gamma (double a, double b) const |
Gamma distribution. More... | |
double | LogNormal (double zeta, double sigma) const |
Log Normal distribution. More... | |
double | ChiSquare (double nu) const |
Chi square distribution. More... | |
double | FDist (double nu1, double nu2) const |
F distrbution. More... | |
double | tDist (double nu) const |
t student distribution More... | |
void | Dir2D (double &x, double &y) const |
generate random numbers in a 2D circle of radious 1 More... | |
void | Dir3D (double &x, double &y, double &z) const |
generate random numbers in a 3D sphere of radious 1 More... | |
unsigned int | Poisson (double mu) const |
Poisson distribution. More... | |
unsigned int | Binomial (double p, unsigned int n) const |
Binomial distribution. More... | |
unsigned int | NegativeBinomial (double p, double n) const |
Negative Binomial distribution. More... | |
std::vector< unsigned int > | Multinomial (unsigned int ntot, const std::vector< double > &p) const |
Multinomial distribution. More... | |
Protected Member Functions | |
void | SetType (GSLRngWrapper *r) |
internal method used by the derived class to set the type of generators More... | |
Private Attributes | |
GSLRngWrapper * | fRng |
unsigned int | fCurTime |
#include <Math/GSLRndmEngines.h>
ROOT::Math::GSLRandomEngine::GSLRandomEngine | ( | ) |
default constructor.
No creation of rng is done. If then Initialize() is called an engine is created based on default GSL type (MT)
Definition at line 58 of file GSLRndmEngines.cxx.
ROOT::Math::GSLRandomEngine::GSLRandomEngine | ( | GSLRngWrapper * | rng | ) |
create from an existing rng.
User manage the rng pointer which is then deleted olny by calling Terminate()
Definition at line 66 of file GSLRndmEngines.cxx.
ROOT::Math::GSLRandomEngine::GSLRandomEngine | ( | const GSLRandomEngine & | eng | ) |
Copy constructor : clone the contained GSL generator.
Definition at line 72 of file GSLRndmEngines.cxx.
|
virtual |
call Terminate()
Definition at line 77 of file GSLRndmEngines.cxx.
unsigned int ROOT::Math::GSLRandomEngine::Binomial | ( | double | p, |
unsigned int | n | ||
) | const |
Binomial distribution.
Definition at line 278 of file GSLRndmEngines.cxx.
Cauchy distribution.
Definition at line 217 of file GSLRndmEngines.cxx.
Chi square distribution.
Definition at line 241 of file GSLRndmEngines.cxx.
generate random numbers in a 2D circle of radious 1
Definition at line 260 of file GSLRndmEngines.cxx.
generate random numbers in a 3D sphere of radious 1
Definition at line 266 of file GSLRndmEngines.cxx.
Exponential distribution.
Definition at line 211 of file GSLRndmEngines.cxx.
F distrbution.
Definition at line 248 of file GSLRndmEngines.cxx.
Gamma distribution.
Definition at line 229 of file GSLRndmEngines.cxx.
Gaussian distribution - default method is Box-Muller (polar method)
Definition at line 185 of file GSLRndmEngines.cxx.
void ROOT::Math::GSLRandomEngine::Gaussian2D | ( | double | sigmaX, |
double | sigmaY, | ||
double | rho, | ||
double & | x, | ||
double & | y | ||
) | const |
Bivariate Gaussian distribution with correlation.
Definition at line 205 of file GSLRndmEngines.cxx.
Gaussian distribution - Ratio method.
Definition at line 191 of file GSLRndmEngines.cxx.
Gaussian Tail distribution.
Definition at line 198 of file GSLRndmEngines.cxx.
Gaussian distribution - Ziggurat method.
Definition at line 179 of file GSLRndmEngines.cxx.
void ROOT::Math::GSLRandomEngine::Initialize | ( | ) |
initialize the generator If no rng is present the default one based on Mersenne and Twister is created
Definition at line 94 of file GSLRndmEngines.cxx.
Referenced by ROOT::Math::GSLRngCMRG::GSLRngCMRG(), ROOT::Math::GSLRngGFSR4::GSLRngGFSR4(), ROOT::Math::GSLRngMinStd::GSLRngMinStd(), ROOT::Math::GSLRngMRG::GSLRngMRG(), ROOT::Math::GSLRngMT::GSLRngMT(), ROOT::Math::GSLRngRand::GSLRngRand(), ROOT::Math::GSLRngRanLux::GSLRngRanLux(), ROOT::Math::GSLRngRanLuxD1::GSLRngRanLuxD1(), ROOT::Math::GSLRngRanLuxD2::GSLRngRanLuxD2(), ROOT::Math::GSLRngRanLuxS1::GSLRngRanLuxS1(), ROOT::Math::GSLRngRanLuxS2::GSLRngRanLuxS2(), ROOT::Math::GSLRngRanMar::GSLRngRanMar(), and ROOT::Math::GSLRngTaus::GSLRngTaus().
double ROOT::Math::GSLRandomEngine::Landau | ( | ) | const |
Landau distribution.
Definition at line 223 of file GSLRndmEngines.cxx.
Log Normal distribution.
Definition at line 235 of file GSLRndmEngines.cxx.
std::vector< unsigned int > ROOT::Math::GSLRandomEngine::Multinomial | ( | unsigned int | ntot, |
const std::vector< double > & | p | ||
) | const |
Multinomial distribution.
Definition at line 291 of file GSLRndmEngines.cxx.
std::string ROOT::Math::GSLRandomEngine::Name | ( | ) | const |
return name of generator
Definition at line 161 of file GSLRndmEngines.cxx.
Negative Binomial distribution.
Definition at line 284 of file GSLRndmEngines.cxx.
double ROOT::Math::GSLRandomEngine::operator() | ( | ) | const |
Generate a random number between ]0,1] 0 is excluded and 1 is included.
Definition at line 110 of file GSLRndmEngines.cxx.
Referenced by RandomArray().
GSLRandomEngine & ROOT::Math::GSLRandomEngine::operator= | ( | const GSLRandomEngine & | eng | ) |
Assignment operator : make a deep copy of the contained GSL generator.
Definition at line 83 of file GSLRndmEngines.cxx.
unsigned int ROOT::Math::GSLRandomEngine::Poisson | ( | double | mu | ) | const |
Poisson distribution.
Definition at line 272 of file GSLRndmEngines.cxx.
|
inline |
Generate an array of random numbers.
The iterators points to the random numbers
Definition at line 131 of file GSLRndmEngines.h.
Generate an array of random numbers The iterators points to the random numbers.
Definition at line 132 of file GSLRndmEngines.cxx.
|
inline |
Generate a random number between ]0,1] 0 is excluded and 1 is included.
Definition at line 117 of file GSLRndmEngines.h.
unsigned int ROOT::Math::GSLRandomEngine::RndmInt | ( | unsigned int | max | ) | const |
Generate an integer number between [0,max-1] (including 0 and max-1) if max is larger than available range of algorithm an error message is printed and zero is returned.
Definition at line 117 of file GSLRndmEngines.cxx.
void ROOT::Math::GSLRandomEngine::SetSeed | ( | unsigned int | seed | ) | const |
set the random generator seed
Definition at line 140 of file GSLRndmEngines.cxx.
|
inlineprotected |
internal method used by the derived class to set the type of generators
Definition at line 266 of file GSLRndmEngines.h.
Referenced by ROOT::Math::GSLRngCMRG::GSLRngCMRG(), ROOT::Math::GSLRngGFSR4::GSLRngGFSR4(), ROOT::Math::GSLRngMinStd::GSLRngMinStd(), ROOT::Math::GSLRngMRG::GSLRngMRG(), ROOT::Math::GSLRngMT::GSLRngMT(), ROOT::Math::GSLRngRand::GSLRngRand(), ROOT::Math::GSLRngRanLux::GSLRngRanLux(), ROOT::Math::GSLRngRanLuxD1::GSLRngRanLuxD1(), ROOT::Math::GSLRngRanLuxD2::GSLRngRanLuxD2(), ROOT::Math::GSLRngRanLuxS1::GSLRngRanLuxS1(), ROOT::Math::GSLRngRanLuxS2::GSLRngRanLuxS2(), ROOT::Math::GSLRngRanMar::GSLRngRanMar(), and ROOT::Math::GSLRngTaus::GSLRngTaus().
unsigned int ROOT::Math::GSLRandomEngine::Size | ( | ) | const |
return the state size of generator
Definition at line 169 of file GSLRndmEngines.cxx.
t student distribution
Definition at line 254 of file GSLRndmEngines.cxx.
delete pointer to contained rng
Definition at line 101 of file GSLRndmEngines.cxx.
Referenced by ~GSLRandomEngine().
|
mutableprivate |
Definition at line 273 of file GSLRndmEngines.h.
Referenced by operator=(), and SetSeed().
|
private |
Definition at line 272 of file GSLRndmEngines.h.
Referenced by Binomial(), Cauchy(), ChiSquare(), Dir2D(), Dir3D(), Exponential(), FDist(), Gamma(), Gaussian(), Gaussian2D(), GaussianRatio(), GaussianTail(), GaussianZig(), Initialize(), Landau(), LogNormal(), Multinomial(), Name(), NegativeBinomial(), operator()(), operator=(), Poisson(), RandomArray(), RndmInt(), SetSeed(), SetType(), Size(), tDist(), Terminate(), and ~GSLRandomEngine().