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::VolumeEstimatorMC< dim > Class Template Reference

Hit-or-Miss Monte Carlo volume estimator. More...

#include <VolumeEstimatorMC.hpp>

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

Public Member Functions

VolumeEstimate< dimestimate (const mc::domains::IntegrationDomain< dim > &domain, std::uint32_t seed, std::size_t n_samples) const
 Estimate the volume of a domain using hit-or-miss sampling.
 

Detailed Description

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

Hit-or-Miss Monte Carlo volume estimator.

Template Parameters
dimDimensionality of the space.

Estimates the volume of an arbitrary domain Ω by sampling uniformly in the bounding box and counting the fraction of samples inside Ω.

Algorithm:

  1. Sample N points uniformly from bounding box B
  2. Count hits: N_hits = |{x ∈ B : x ∈ Ω}|
  3. Estimate: V̂_Ω = V_B · (N_hits / N)
  4. Compute standard error from Bernoulli variance
Note
This estimator is unbiased but can be slow for domains with small volume.
Used internally by integrators for two-stage integration (e.g., MH-based).

Definition at line 68 of file VolumeEstimatorMC.hpp.

Member Function Documentation

◆ estimate()

template<std::size_t dim>
VolumeEstimate< dim > mc::estimators::VolumeEstimatorMC< dim >::estimate ( const mc::domains::IntegrationDomain< dim > &  domain,
std::uint32_t  seed,
std::size_t  n_samples 
) const

Estimate the volume of a domain using hit-or-miss sampling.

Parameters
domainThe integration domain whose volume to estimate.
seedRandom seed for reproducibility.
n_samplesNumber of sample points to evaluate.
Returns
VolumeEstimate containing volume, stderr, hit ratio, and sample count.
Exceptions
std::invalid_argumentif n_samples == 0.

Uses OpenMP parallelization for efficient parallel sampling. Each thread gets a deterministic RNG stream based on seed and thread ID.


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