queso-0.51.1
RngBoost.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // QUESO - a library to support the Quantification of Uncertainty
5 // for Estimation, Simulation and Optimization
6 //
7 // Copyright (C) 2008,2009,2010,2011,2012,2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef UQ_RNG_BOOST_H
26 #define UQ_RNG_BOOST_H
27 
28 #include <queso/RngBase.h>
29 #include <boost/random.hpp>
30 #include <boost/math/distributions.hpp>
31 
32 
45 namespace QUESO {
46 
47 class RngBoost : public RngBase
48 {
49 public:
51 
52  RngBoost();
54 
56  RngBoost(int seed, int worldRank);
57 
59  ~RngBoost();
61 
63 
64  void resetSeed (int newSeed);
66 
67 
69 
73  double uniformSample () const;
74 
75 
78 
84  double gaussianSample(double stdDev) const;
85 
87 
92  double betaSample (double alpha, double beta) const;
93 
95 
101  double gammaSample (double a, double b) const;
102 
103 private:
105 
110  boost::mt19937 m_rng; // it cannot be static, as it is not initialized yet
111 };
112 
113 } // End namespace QUESO
114 
115 #endif // UQ_RNG_BOOST_H
RngBoost()
Default Constructor: it should not be used.
Definition: RngBoost.C:31
double gaussianSample(double stdDev) const
Definition: RngBoost.C:80
int seed() const
Sets the seed.
Definition: RngBase.C:54
boost::mt19937 m_rng
Random number generator from class boost::mt19937.
Definition: RngBoost.h:110
double gammaSample(double a, double b) const
Samples a value from a Gamma distribution. Support: [0,infinity).
Definition: RngBoost.C:99
double betaSample(double alpha, double beta) const
Samples a value from a Beta distribution. Support: [0,1].
Definition: RngBoost.C:90
void resetSeed(int newSeed)
Resets the seed with value newSeed.
Definition: RngBoost.C:63
double uniformSample() const
Samples a value from a uniform distribution. Support: [0,1] or [a,b].
Definition: RngBoost.C:72
Class for random number generation (base class for either GSL or Boost RNG).
Definition: RngBase.h:45
~RngBoost()
Destructor.
Definition: RngBoost.C:56

Generated on Thu Apr 23 2015 19:26:15 for queso-0.51.1 by  doxygen 1.8.5