Monte Carlo Integration Library 1.0
High-performance Monte Carlo methods for numerical integration and optimization
Public Member Functions | List of all members
mc::estimators::ISMeanEstimator< dim > Class Template Reference

Importance sampling mean estimator with variance reduction. More...

#include <ISMeanEstimator.hpp>

Collaboration diagram for mc::estimators::ISMeanEstimator< dim >:

Public Member Functions

ImportanceEstimate< dimestimate (const mc::domains::IntegrationDomain< dim > &domain, std::uint32_t seed, std::size_t n_samples, const mc::proposals::Proposal< dim > &proposal, const std::function< double(const mc::geom::Point< dim > &)> &f) const
 Estimate the weighted mean using importance sampling.
 

Detailed Description

template<std::size_t dim>
class mc::estimators::ISMeanEstimator< dim >

Importance sampling mean estimator with variance reduction.

Template Parameters
dimDimensionality of the space.

Estimates the mean using importance sampling:

  1. Sample N points from proposal q(x): x₁, ..., xₙ ~ q
  2. Filter to domain points with q > 0
  3. Compute weighted average: μ̂ = (1/N) ∑ᵢ [f(xᵢ)/q(xᵢ)]
  4. Estimate variance and standard error

Variance Reduction: If q(x) ≈ f(x), the weights [f(x)/q(x)] are roughly constant, reducing variance compared to uniform sampling.

Usage: For integration over Ω: ∫_Ω f(x) dx ≈ (mean result) [no volume factor—importance weight handles normalization]

Note
Uses OpenMP for parallel sampling from proposal.
Proposal must support sample() and pdf() methods.

Definition at line 59 of file ISMeanEstimator.hpp.

Member Function Documentation

◆ estimate()

template<std::size_t dim>
ImportanceEstimate< dim > mc::estimators::ISMeanEstimator< dim >::estimate ( const mc::domains::IntegrationDomain< dim > &  domain,
std::uint32_t  seed,
std::size_t  n_samples,
const mc::proposals::Proposal< dim > &  proposal,
const std::function< double(const mc::geom::Point< dim > &)> &  f 
) const

Estimate the weighted mean using importance sampling.

Parameters
domainThe integration domain.
seedRandom seed for reproducibility.
n_samplesNumber of samples to draw from proposal.
proposalSampling distribution q(x) (should resemble |f(x)|).
fFunction to evaluate.
Returns
ImportanceEstimate with weighted mean, stderr, and sample counts.
Exceptions
std::invalid_argumentif n_samples == 0.

Algorithm:

  • Each thread samples n_local points from proposal (parallel)
  • Keeps only points inside domain with q(x) > 0
  • Accumulates weighted sum ∑ [f(x)/q(x)] and sum of squares
  • Returns (mean / N, stderr, n_inside)

The documentation for this class was generated from the following file: