BornAgain
1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
|
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 65 of file GSLRndmEngines.h.
Public Member Functions | |
GSLRandomEngine () | |
GSLRandomEngine (const GSLRandomEngine &eng) | |
GSLRandomEngine (GSLRngWrapper *rng) | |
virtual | ~GSLRandomEngine () |
void | Initialize () |
unsigned long | IntRndm () const |
unsigned long | MaxInt () const |
unsigned long | MinInt () const |
std::string | Name () const |
double | operator() () const |
GSLRandomEngine & | operator= (const GSLRandomEngine &eng) |
void | RandomArray (double *begin, double *end) const |
template<class Iterator > | |
void | RandomArray (Iterator begin, Iterator end) const |
double | Rndm () const |
unsigned long | RndmInt (unsigned long max) const |
void | SetSeed (unsigned int seed) const |
unsigned int | Size () const |
void | Terminate () |
Friends | |
class | GSLMCIntegrator |
Random Distributions | |
Implemented using the GSL Random number Distributions | |
GSLRngWrapper * | fRng |
unsigned int | fCurTime |
double | Gaussian (double sigma) const |
double | GaussianZig (double sigma) const |
double | GaussianRatio (double sigma) const |
double | GaussianTail (double a, double sigma) const |
void | Gaussian2D (double sigmaX, double sigmaY, double rho, double &x, double &y) const |
double | Exponential (double mu) const |
double | Cauchy (double a) const |
double | Landau () const |
double | Gamma (double a, double b) const |
double | Beta (double a, double b) const |
double | LogNormal (double zeta, double sigma) const |
double | ChiSquare (double nu) const |
double | FDist (double nu1, double nu2) const |
double | tDist (double nu) const |
double | Rayleigh (double sigma) const |
double | Logistic (double a) const |
double | Pareto (double a, double b) const |
void | Dir2D (double &x, double &y) const |
void | Dir3D (double &x, double &y, double &z) const |
unsigned int | Poisson (double mu) const |
unsigned int | Binomial (double p, unsigned int n) const |
unsigned int | NegativeBinomial (double p, double n) const |
std::vector< unsigned int > | Multinomial (unsigned int ntot, const std::vector< double > &p) const |
void | SetType (GSLRngWrapper *r) |
internal method used by the derived class to set the type of generators More... | |
GSLRngWrapper * | Engine () |
internal method to return the engine Used by class like GSLMCIntegrator to set the engine More... | |
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)
ROOT::Math::GSLRandomEngine::GSLRandomEngine | ( | GSLRngWrapper * | rng | ) |
create from an existing rng. User manage the rng pointer which is then deleted olny by calling Terminate()
ROOT::Math::GSLRandomEngine::GSLRandomEngine | ( | const GSLRandomEngine & | eng | ) |
Copy constructor : clone the contained GSL generator
|
virtual |
call Terminate()
double ROOT::Math::GSLRandomEngine::Beta | ( | double | a, |
double | b | ||
) | const |
Beta distribution
unsigned int ROOT::Math::GSLRandomEngine::Binomial | ( | double | p, |
unsigned int | n | ||
) | const |
Binomial distribution
double ROOT::Math::GSLRandomEngine::Cauchy | ( | double | a | ) | const |
Cauchy distribution
double ROOT::Math::GSLRandomEngine::ChiSquare | ( | double | nu | ) | const |
Chi square distribution
void ROOT::Math::GSLRandomEngine::Dir2D | ( | double & | x, |
double & | y | ||
) | const |
generate random numbers in a 2D circle of radious 1
void ROOT::Math::GSLRandomEngine::Dir3D | ( | double & | x, |
double & | y, | ||
double & | z | ||
) | const |
generate random numbers in a 3D sphere of radious 1
|
inlineprotected |
internal method to return the engine Used by class like GSLMCIntegrator to set the engine
Definition at line 315 of file GSLRndmEngines.h.
References fRng.
double ROOT::Math::GSLRandomEngine::Exponential | ( | double | mu | ) | const |
Exponential distribution
double ROOT::Math::GSLRandomEngine::FDist | ( | double | nu1, |
double | nu2 | ||
) | const |
F distrbution
double ROOT::Math::GSLRandomEngine::Gamma | ( | double | a, |
double | b | ||
) | const |
Gamma distribution
double ROOT::Math::GSLRandomEngine::Gaussian | ( | double | sigma | ) | const |
Gaussian distribution - default method is Box-Muller (polar method)
void ROOT::Math::GSLRandomEngine::Gaussian2D | ( | double | sigmaX, |
double | sigmaY, | ||
double | rho, | ||
double & | x, | ||
double & | y | ||
) | const |
Bivariate Gaussian distribution with correlation
double ROOT::Math::GSLRandomEngine::GaussianRatio | ( | double | sigma | ) | const |
Gaussian distribution - Ratio method
double ROOT::Math::GSLRandomEngine::GaussianTail | ( | double | a, |
double | sigma | ||
) | const |
Gaussian Tail distribution
double ROOT::Math::GSLRandomEngine::GaussianZig | ( | double | sigma | ) | const |
Gaussian distribution - Ziggurat method
void ROOT::Math::GSLRandomEngine::Initialize | ( | ) |
initialize the generator If no rng is present the default one based on Mersenne and Twister is created
|
inline |
Generate an integer number between [0,max_generator-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 133 of file GSLRndmEngines.h.
References MaxInt(), and RndmInt().
double ROOT::Math::GSLRandomEngine::Landau | ( | ) | const |
Landau distribution
double ROOT::Math::GSLRandomEngine::Logistic | ( | double | a | ) | const |
Logistic distribution
double ROOT::Math::GSLRandomEngine::LogNormal | ( | double | zeta, |
double | sigma | ||
) | const |
Log Normal distribution
unsigned long ROOT::Math::GSLRandomEngine::MaxInt | ( | ) | const |
return the maximum integer +1 a generator can handle
Referenced by IntRndm().
unsigned long ROOT::Math::GSLRandomEngine::MinInt | ( | ) | const |
return the minimum integer a generator can handle typically this value is 0
std::vector<unsigned int> ROOT::Math::GSLRandomEngine::Multinomial | ( | unsigned int | ntot, |
const std::vector< double > & | p | ||
) | const |
Multinomial distribution
std::string ROOT::Math::GSLRandomEngine::Name | ( | ) | const |
return name of generator
unsigned int ROOT::Math::GSLRandomEngine::NegativeBinomial | ( | double | p, |
double | n | ||
) | const |
Negative Binomial distribution
double ROOT::Math::GSLRandomEngine::operator() | ( | ) | const |
Generate a random number between ]0,1] 0 is excluded and 1 is included
Referenced by RandomArray().
GSLRandomEngine& ROOT::Math::GSLRandomEngine::operator= | ( | const GSLRandomEngine & | eng | ) |
Assignment operator : make a deep copy of the contained GSL generator
double ROOT::Math::GSLRandomEngine::Pareto | ( | double | a, |
double | b | ||
) | const |
Pareto distribution
unsigned int ROOT::Math::GSLRandomEngine::Poisson | ( | double | mu | ) | const |
Poisson distribution
void ROOT::Math::GSLRandomEngine::RandomArray | ( | double * | begin, |
double * | end | ||
) | const |
Generate an array of random numbers The iterators points to the random numbers
|
inline |
Generate an array of random numbers. The iterators points to the random numbers
Definition at line 142 of file GSLRndmEngines.h.
References operator()().
double ROOT::Math::GSLRandomEngine::Rayleigh | ( | double | sigma | ) | const |
Rayleigh distribution
|
inline |
Generate a random number between ]0,1] 0 is excluded and 1 is included
Definition at line 120 of file GSLRndmEngines.h.
unsigned long ROOT::Math::GSLRandomEngine::RndmInt | ( | unsigned long | 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
Referenced by IntRndm().
void ROOT::Math::GSLRandomEngine::SetSeed | ( | unsigned int | seed | ) | const |
set the random generator seed
|
inlineprotected |
internal method used by the derived class to set the type of generators
Definition at line 309 of file GSLRndmEngines.h.
References fRng.
unsigned int ROOT::Math::GSLRandomEngine::Size | ( | ) | const |
return the state size of generator
double ROOT::Math::GSLRandomEngine::tDist | ( | double | nu | ) | const |
t student distribution
void ROOT::Math::GSLRandomEngine::Terminate | ( | ) |
delete pointer to contained rng
|
friend |
Definition at line 67 of file GSLRndmEngines.h.
|
mutableprivate |
Definition at line 322 of file GSLRndmEngines.h.
|
private |
Definition at line 321 of file GSLRndmEngines.h.