queso-0.57.1
|
Numerical integration using Monte Carlo. More...
#include <MonteCarloQuadrature.h>
Public Member Functions | |
MonteCarloQuadrature (const VectorSubset< V, M > &domain, unsigned int n_samples) | |
virtual | ~MonteCarloQuadrature () |
Public Member Functions inherited from QUESO::MultiDQuadratureBase< V, M > | |
MultiDQuadratureBase (const VectorSubset< V, M > &domain) | |
virtual | ~MultiDQuadratureBase ()=0 |
Pure virtual destructor, forcing this to be an abstract object. More... | |
const std::vector< typename QUESO::SharedPtr< V >::Type > & | positions () const |
const VectorSubset< V, M > & | getDomain () const |
Public Member Functions inherited from QUESO::BaseQuadrature | |
BaseQuadrature () | |
virtual | ~BaseQuadrature ()=0 |
Pure virtual destructor, forcing this to be an abstract object. More... | |
const std::vector< double > & | weights () const |
Array of the weights used in the numerical integration. More... | |
Additional Inherited Members | |
Protected Attributes inherited from QUESO::MultiDQuadratureBase< V, M > | |
std::vector< typename QUESO::SharedPtr< V >::Type > | m_positions |
Locations of quadrature points. More... | |
const VectorSubset< V, M > & | m_domain |
Domain over which the quadrature will be performed. More... | |
Protected Attributes inherited from QUESO::BaseQuadrature | |
std::vector< double > | m_weights |
Numerical integration using Monte Carlo.
Monte Carlo integration approximates an integral by randomly sampling the function. Namely, if \( <f> = 1/|\Omega| \int_{\Omega} f(x) \; dx \) is the average, then
\[ \int_{\Omega} f(x) \; dx = |\Omega| <f> \approx |\Omega| \frac{1}{N} \sum_{i=1}^N f(x_i) \]
where \(N\) is the number of samples. This class, then, uniformly samples over the user-specified domain for the given number of samples. Then, to adhere to the quadrature interface, the positions are accessible in the positions vector and the factor \(|\Omega|/N \) is cached in the weights vector.
Definition at line 47 of file MonteCarloQuadrature.h.
QUESO::MonteCarloQuadrature< V, M >::MonteCarloQuadrature | ( | const VectorSubset< V, M > & | domain, |
unsigned int | n_samples | ||
) |
Definition at line 33 of file MonteCarloQuadrature.C.
References QUESO::MultiDQuadratureBase< V, M >::m_domain, QUESO::MultiDQuadratureBase< V, M >::m_positions, QUESO::BaseQuadrature::m_weights, QUESO::BaseVectorRealizer< V, M >::realization(), QUESO::BaseVectorRV< V, M >::realizer(), QUESO::VectorSubset< V, M >::vectorSpace(), and QUESO::VectorSet< V, M >::volume().
|
inlinevirtual |
Definition at line 54 of file MonteCarloQuadrature.h.