queso-0.57.1
|
#include <RngCXX11.h>
Public Member Functions | |
Constructor/Destructor methods | |
RngCXX11 (int seed, int worldRank) | |
Constructor with seed. More... | |
~RngCXX11 () | |
Destructor. More... | |
Public Member Functions inherited from QUESO::RngBase | |
RngBase (int seed, int worldRank) | |
Constructor with seed. More... | |
virtual | ~RngBase () |
Virtual destructor. More... | |
int | seed () const |
Sets the seed. More... | |
Sampling methods | |
std::mt19937 | m_rng |
The internal random number generator. Mersenne Twister generator. More... | |
void | resetSeed (int newSeed) |
Resets the seed with value newSeed . More... | |
double | uniformSample () const |
Samples a value from a uniform distribution. Support: [0,1) or [a,b). More... | |
double | gaussianSample (double stdDev) const |
double | betaSample (double alpha, double beta) const |
Samples a value from a Beta distribution. Support: [0,1]. More... | |
double | gammaSample (double a, double b) const |
Samples a value from a Gamma distribution. Support: [0,infinity). More... | |
RngCXX11 () | |
Default Constructor: it should not be used. More... | |
Additional Inherited Members | |
Protected Attributes inherited from QUESO::RngBase | |
int | m_seed |
Seed. More... | |
int | m_worldRank |
Rank of processor. More... | |
Definition at line 48 of file RngCXX11.h.
RngCXX11::RngCXX11 | ( | int | seed, |
int | worldRank | ||
) |
Constructor with seed.
Definition at line 31 of file RngCXX11.C.
RngCXX11::~RngCXX11 | ( | ) |
|
private |
Default Constructor: it should not be used.
|
virtual |
Samples a value from a Beta distribution. Support: [0,1].
The Beta Distribution is a continuous probability distribution; it has two free parameters, which are labeled alpha and beta. The beta distribution is used as a prior distribution for binomial proportions in Bayesian analysis (Evans et al. 2000, p. 34). Support (domain): [0,1].
Since std::random doesn't have a beta distribution implementation, we leverage a novel transformation involving two Gamma distributed variates instead. For details, see https://en.wikipedia.org/wiki/Beta_distribution#Generating_beta-distributed_random_variates
Implements QUESO::RngBase.
Definition at line 65 of file RngCXX11.C.
References m_rng.
|
virtual |
Samples a value from a Gamma distribution. Support: [0,infinity).
The Gamma Distribution is a continuous probability distribution; it has two free parameters, which may be labeled: a shape parameter a and an inverse scale parameter b, called a rate parameter. Support (domain): [0, infinity).
Implements QUESO::RngBase.
Definition at line 79 of file RngCXX11.C.
References m_rng.
|
virtual |
Samples a value from a Gaussian distribution with standard deviation given by stdDev
. Support: (-infinity, infinity).
The parameter mu (mean or expectation of the distribution) in this Gaussian sample is set to zero, and thus, needs to be provided in an alternative way (e.g., in the form of a sum. The parameter stdDev is its standard deviation; its variance is therefore stdDev^2. A random variable with a Gaussian distribution is said to be normally distributed and is called a normal deviate. Support: (-infinity, infinity).
Implements QUESO::RngBase.
Definition at line 58 of file RngCXX11.C.
References m_rng.
|
virtual |
Resets the seed with value newSeed
.
Reimplemented from QUESO::RngBase.
Definition at line 44 of file RngCXX11.C.
References m_rng, QUESO::RngBase::m_seed, and QUESO::RngBase::resetSeed().
|
virtual |
Samples a value from a uniform distribution. Support: [0,1) or [a,b).
This function samples from continuous uniform distribution on the range [0,1). It is possible to scale this distribution so the support is defined by the two parameters, a and b, which are its minimum and maximum values. Support: -infinity < a < x< b< infinity.
Implements QUESO::RngBase.
Definition at line 51 of file RngCXX11.C.
References m_rng.
|
mutableprivate |
The internal random number generator. Mersenne Twister generator.
Definition at line 117 of file RngCXX11.h.
Referenced by betaSample(), gammaSample(), gaussianSample(), resetSeed(), and uniformSample().