queso-0.57.1
|
Class for random number generation (base class for either GSL or Boost RNG). More...
#include <RngBase.h>
Public Member Functions | |
Constructor/Destructor methods | |
RngBase (int seed, int worldRank) | |
Constructor with seed. More... | |
virtual | ~RngBase () |
Virtual destructor. More... | |
Sampling methods | |
int | seed () const |
Sets the seed. More... | |
virtual void | resetSeed (int newSeed) |
Resets the seed with value newSeed . More... | |
virtual double | uniformSample () const =0 |
Samples a value from a uniform distribution. More... | |
virtual double | gaussianSample (double stdDev) const =0 |
Samples a value from a Gaussian distribution with standard deviation given by stdDev . More... | |
virtual double | betaSample (double alpha, double beta) const =0 |
Samples a value from a Beta distribution. More... | |
virtual double | gammaSample (double a, double b) const =0 |
Samples a value from a Gamma distribution. More... | |
Protected Attributes | |
int | m_seed |
Seed. More... | |
int | m_worldRank |
Rank of processor. More... | |
Private Member Functions | |
RngBase () | |
Default Constructor: it should not be used. More... | |
void | privateResetSeed () |
Reset seed. More... | |
Class for random number generation (base class for either GSL or Boost RNG).
This class is a “virtual” class of generic random number generator, in order to accommodate either GSL or Boost RNG.
QUESO::RngBase::RngBase | ( | int | seed, |
int | worldRank | ||
) |
|
virtual |
|
private |
Default Constructor: it should not be used.
|
pure virtual |
Samples a value from a Beta distribution.
Implemented in QUESO::RngCXX11, QUESO::RngGsl, and QUESO::RngBoost.
Referenced by QUESO::GslVector::cwSetBeta(), and QUESO::TeuchosVector::cwSetBeta().
|
pure virtual |
Samples a value from a Gamma distribution.
Implemented in QUESO::RngCXX11, QUESO::RngGsl, and QUESO::RngBoost.
Referenced by QUESO::GslVector::cwSetGamma(), QUESO::TeuchosVector::cwSetGamma(), QUESO::GslVector::cwSetInverseGamma(), and QUESO::TeuchosVector::cwSetInverseGamma().
|
pure virtual |
Samples a value from a Gaussian distribution with standard deviation given by stdDev
.
Implemented in QUESO::RngCXX11, QUESO::RngGsl, and QUESO::RngBoost.
Referenced by QUESO::GslVector::cwSetGaussian(), QUESO::TeuchosVector::cwSetGaussian(), QUESO::InfiniteDimensionalGaussian::draw(), and QUESO::MiscGammar().
|
private |
Reset seed.
Definition at line 56 of file RngBase.C.
References m_seed, and m_worldRank.
Referenced by resetSeed(), and RngBase().
|
virtual |
Resets the seed with value newSeed
.
Reimplemented in QUESO::RngGsl, QUESO::RngCXX11, and QUESO::RngBoost.
Definition at line 48 of file RngBase.C.
References m_seed, and privateResetSeed().
Referenced by QUESO::RngCXX11::resetSeed(), and QUESO::RngGsl::resetSeed().
int QUESO::RngBase::seed | ( | ) | const |
|
pure virtual |
Samples a value from a uniform distribution.
Implemented in QUESO::RngGsl, QUESO::RngCXX11, and QUESO::RngBoost.
Referenced by QUESO::InfiniteDimensionalMCMCSampler::_metropolis_hastings(), QUESO::GslVector::cwSetUniform(), QUESO::TeuchosVector::cwSetUniform(), QUESO::MiscGammar(), and QUESO::FiniteDistribution::sample().
|
protected |
Seed.
Definition at line 82 of file RngBase.h.
Referenced by privateResetSeed(), resetSeed(), QUESO::RngCXX11::resetSeed(), QUESO::RngGsl::resetSeed(), QUESO::RngGsl::RngGsl(), and seed().
|
protected |
Rank of processor.
Definition at line 85 of file RngBase.h.
Referenced by privateResetSeed(), and QUESO::RngGsl::RngGsl().