mcarlo.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2020, Andrew W. Steiner
5 
6  This file is part of O2scl.
7 
8  O2scl is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  O2scl 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
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with O2scl. If not, see <http://www.gnu.org/licenses/>.
20 
21  -------------------------------------------------------------------
22 */
23 #ifndef O2SCL_MCARLO_H
24 #define O2SCL_MCARLO_H
25 
26 /** \file mcarlo.h
27  \brief File defining \ref o2scl::mcarlo
28 */
29 
30 #include <iostream>
31 #include <random>
32 
33 #include <boost/numeric/ublas/vector.hpp>
34 
35 #include <o2scl/inte_multi.h>
36 #include <o2scl/rng_gsl.h>
37 
38 #ifndef DOXYGEN_NO_O2NS
39 namespace o2scl {
40 #endif
41 
42  /** \brief Monte-Carlo integration [abstract base]
43 
44  This class provides the generic Monte Carlo parameters and the
45  random number generator. The default type for the random number
46  generator is a \ref rng_gsl object.
47  */
48  template<class func_t=multi_funct,
50  class rng_t=rng_gsl>
51  class mcarlo : public inte_multi<func_t,vec_t> {
52 
53  public:
54 
55  mcarlo() {
56  n_points=1000;
57  }
58 
59  virtual ~mcarlo() {}
60 
61  /** \brief Number of integration points (default 1000)
62  */
63  unsigned long n_points;
64 
65  /** \brief The random number distribution
66  */
68 
69  /// The random number generator
70  rng_t rng;
71 
72  /// Return string denoting type ("mcarlo")
73  virtual const char *type() { return "mcarlo"; }
74 
75  };
76 
77 #ifndef DOXYGEN_NO_O2NS
78 }
79 #endif
80 
81 #endif
82 
boost::numeric::ublas::vector< double >
o2scl::mcarlo::n_points
unsigned long n_points
Number of integration points (default 1000)
Definition: mcarlo.h:63
o2scl::mcarlo::rng_dist
rng_gsl_uniform_real rng_dist
The random number distribution.
Definition: mcarlo.h:67
o2scl
The main O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl names...
Definition: anneal.h:42
o2scl::mcarlo::type
virtual const char * type()
Return string denoting type ("mcarlo")
Definition: mcarlo.h:73
o2scl::mcarlo::rng
rng_t rng
The random number generator.
Definition: mcarlo.h:70
o2scl::inte_multi
Multi-dimensional integration over a hypercube [abstract base].
Definition: inte_multi.h:46
o2scl::multi_funct
std::function< double(size_t, const boost::numeric::ublas::vector< double > &)> multi_funct
Multi-dimensional function typedef in src/base/multi_funct.h.
Definition: multi_funct.h:45
o2scl::rng_gsl_uniform_real
An alternative RNG type used to design templates for either GSL or STL random number generators.
Definition: rng_gsl.h:160
o2scl::mcarlo
Monte-Carlo integration [abstract base].
Definition: mcarlo.h:51

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).