queso-0.56.0
RngGsl.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-2015 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_GSL_H
26 #define UQ_RNG_GSL_H
27 
28 #include <queso/RngBase.h>
29 
30 #include <queso/Defines.h>
31 #include <gsl/gsl_rng.h>
32 
33 
47 extern unsigned long int gsl_rng_default_seed;
48 
49 namespace QUESO {
50 
51 class RngGsl : public RngBase
52 {
53 public:
54 
56 
57  /* Uses GSL with the generator of type: gsl_rng_ranlxd2. This is the second, of a total of three
59  luxury random numbers, all an extension of a second-generation version of the ranlux algorithm of
60  Lüscher. The period of the generator is about 10^171. The algorithm has mathematically proven
61  properties and can provide truly decorrelated numbers at a known level of randomness. The higher
62  luxury levels provide increased decorrelation between samples as an additional safety margin.*/
63  RngGsl(int seed, int worldRank);
64 
66  ~RngGsl();
68 
70 
71  void resetSeed (int newSeed);
73 
75 
79  double uniformSample () const;
80 
83 
88  double gaussianSample(double stdDev) const;
89 
91 
95  double betaSample (double alpha, double beta) const;
96 
98 
102  double gammaSample (double a, double b) const;
103 
105  const gsl_rng* rng () const;
106 
107 protected:
109  RngGsl();
110 
112 
113  gsl_rng* m_rng;
114 };
115 
116 } // End namespace QUESO
117 
118 #endif // UQ_RNG_GSL_H
double uniformSample() const
Samples a value from a uniform distribution. Support: [0,1] or [a,b].
Definition: RngGsl.C:75
gsl_rng * m_rng
GSL random number generator.
Definition: RngGsl.h:113
double betaSample(double alpha, double beta) const
Samples a value from a Beta distribution. Support: [0,1].
Definition: RngGsl.C:89
unsigned long int gsl_rng_default_seed
Class for random number generation (base class for either GSL or Boost RNG).
Definition: RngBase.h:45
const gsl_rng * rng() const
GSL random number generator.
Definition: RngGsl.C:102
~RngGsl()
Destructor.
Definition: RngGsl.C:55
double gaussianSample(double stdDev) const
Definition: RngGsl.C:82
RngGsl()
Default Constructor: it should not be used.
int seed() const
Sets the seed.
Definition: RngBase.C:42
void resetSeed(int newSeed)
Resets the seed with value newSeed.
Definition: RngGsl.C:62
double gammaSample(double a, double b) const
Samples a value from a Gamma distribution. Support: [0,infinity).
Definition: RngGsl.C:96

Generated on Tue Nov 29 2016 10:53:10 for queso-0.56.0 by  doxygen 1.8.5