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

#include <mixtureProposal.hpp>

Inheritance diagram for mc::proposals::MixtureProposal< dim >:
Collaboration diagram for mc::proposals::MixtureProposal< dim >:

Public Member Functions

 MixtureProposal (std::vector< const Proposal< dim > * > components, std::vector< double > weights)
 Construct a mixture proposal from non-owning component pointers and weights.
 
mc::geom::Point< dimsample (std::mt19937 &rng) const override
 Sample from the mixture.
 
double pdf (const mc::geom::Point< dim > &x) const override
 Evaluate mixture PDF q(x) = sum_k w_k * q_k(x).
 
std::size_t numComponents () const noexcept
 
const std::vector< double > & getWeights () const noexcept
 
- Public Member Functions inherited from mc::proposals::Proposal< dim >
virtual ~Proposal ()=default
 Virtual destructor for proper cleanup.
 

Detailed Description

template<size_t dim>
class mc::proposals::MixtureProposal< dim >

Definition at line 36 of file mixtureProposal.hpp.

Constructor & Destructor Documentation

◆ MixtureProposal()

template<size_t dim>
mc::proposals::MixtureProposal< dim >::MixtureProposal ( std::vector< const Proposal< dim > * >  components,
std::vector< double >  weights 
)

Construct a mixture proposal from non-owning component pointers and weights.

Parameters
componentsVector of non-null pointers to Proposal<dim> components (q_k).
weightsVector of non-negative weights (w_k). Will be normalized to sum to 1.

Requirements:

  • components.size() == weights.size()
  • components.size() > 0
  • all weights >= 0 and sum(weights) > 0
  • no null component pointers

IMPORTANT: components are NOT owned by this class.

Member Function Documentation

◆ getWeights()

template<size_t dim>
const std::vector< double > & mc::proposals::MixtureProposal< dim >::getWeights ( ) const
inlinenoexcept

Definition at line 62 of file mixtureProposal.hpp.

◆ numComponents()

template<size_t dim>
std::size_t mc::proposals::MixtureProposal< dim >::numComponents ( ) const
inlinenoexcept

Definition at line 61 of file mixtureProposal.hpp.

◆ pdf()

template<size_t dim>
double mc::proposals::MixtureProposal< dim >::pdf ( const mc::geom::Point< dim > &  x) const
overridevirtual

Evaluate mixture PDF q(x) = sum_k w_k * q_k(x).

Implements mc::proposals::Proposal< dim >.

◆ sample()

template<size_t dim>
mc::geom::Point< dim > mc::proposals::MixtureProposal< dim >::sample ( std::mt19937 &  rng) const
overridevirtual

Sample from the mixture.

Implements mc::proposals::Proposal< dim >.


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