queso-0.51.1
RngBase.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_BASE_H
26 #define UQ_RNG_BASE_H
27 
28 #include <queso/Defines.h>
29 #include <iostream>
30 
31 namespace QUESO {
32 
45 class RngBase
46 {
47 public:
48 
50 
51  RngBase();
53 
55  RngBase(int seed, int worldRank);
56 
58  virtual ~RngBase();
60 
61 
63 
64  int seed () const;
66 
68  virtual void resetSeed (int newSeed);
69 
71  virtual double uniformSample () const = 0;
72 
74  virtual double gaussianSample(double stdDev) const = 0;
75 
77  virtual double betaSample (double alpha, double beta) const = 0;
78 
80  virtual double gammaSample (double a, double b) const = 0;
81 
83 protected:
85  int m_seed;
86 
89 
90 private:
91 
93  void privateResetSeed();
94 };
95 
96 } // End namespace QUESO
97 
98 #endif // UQ_RNG_BASE_H
void privateResetSeed()
Reset seed.
Definition: RngBase.C:68
virtual ~RngBase()
Virtual destructor.
Definition: RngBase.C:49
int seed() const
Sets the seed.
Definition: RngBase.C:54
virtual void resetSeed(int newSeed)
Resets the seed with value newSeed.
Definition: RngBase.C:60
virtual double betaSample(double alpha, double beta) const =0
Samples a value from a Beta distribution.
int m_worldRank
Rank of processor.
Definition: RngBase.h:88
virtual double uniformSample() const =0
Samples a value from a uniform distribution.
RngBase()
Default Constructor: it should not be used.
Definition: RngBase.C:30
Class for random number generation (base class for either GSL or Boost RNG).
Definition: RngBase.h:45
virtual double gaussianSample(double stdDev) const =0
Samples a value from a Gaussian distribution with standard deviation given by stdDev.
virtual double gammaSample(double a, double b) const =0
Samples a value from a Gamma distribution.
int m_seed
Seed.
Definition: RngBase.h:85

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