|
Monte Carlo Integration Library 1.0
High-performance Monte Carlo methods for numerical integration and optimization
|
Uniform Monte Carlo mean estimator. More...
#include <MCMeanEstimator.hpp>
Public Member Functions | |
| MeanEstimate< dim > | estimate (const mc::domains::IntegrationDomain< dim > &domain, std::uint32_t seed, std::size_t n_samples, const std::function< double(const mc::geom::Point< dim > &)> &f) const |
| Estimate the mean of a function over a domain using uniform sampling. | |
Uniform Monte Carlo mean estimator.
| dim | Dimensionality of the space. |
Estimates the mean of f over domain Ω by:
The mean (before multiplying by volume) is the empirical average over all N trials (treating out-of-domain points as contributing 0).
Definition at line 57 of file MCMeanEstimator.hpp.
| MeanEstimate< dim > mc::estimators::MCMeanEstimator< dim >::estimate | ( | const mc::domains::IntegrationDomain< dim > & | domain, |
| std::uint32_t | seed, | ||
| std::size_t | n_samples, | ||
| const std::function< double(const mc::geom::Point< dim > &)> & | f | ||
| ) | const |
Estimate the mean of a function over a domain using uniform sampling.
| domain | The integration domain. |
| seed | Random seed for reproducibility. |
| n_samples | Total number of sample points to generate. |
| f | Function to evaluate (only at points inside domain). |
| std::invalid_argument | if n_samples == 0. |
Parallel sampling: each thread gets a deterministic RNG stream and samples its portion of n_samples uniformly in the domain's bounding box. Only points inside the domain contribute to the sum.