MCKL
Monte Carlo Kernel Library
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
mckl::Sampler< Derived > Class Template Reference

Sampler for iterative Monte Carlo algorithms. More...

#include <mckl/core/sampler.hpp>

Public Types

using estimator_type = typename SamplerTrait< Derived >::estimator_type
 
using eval_type = typename SamplerTrait< Derived >::eval_type
 

Public Member Functions

void clear ()
 Clear all estimator histories. More...
 
template<typename CharT , typename Traits >
std::basic_ostream< CharT, Traits > & print (std::basic_ostream< CharT, Traits > &os, char sepchar=' ') const
 Print the summary matrix in textual form. More...
 
void reserve (std::size_t n)
 Reserve space for additional iterations. More...
 
void reset ()
 Remove all evaluation and estimation methods. More...
 
template<typename T , MatrixLayout Layout>
Matrix< T, Layout > summary () const
 Return a combined matrix of all estimates. More...
 

Protected Member Functions

 Sampler (std::size_t steps)
 
Vector< estimator_type > & estimator (std::size_t step)
 
const Vector< estimator_type > & estimator (std::size_t step) const
 
template<typename Estimator >
std::size_t estimator (std::size_t step, Estimator &&estimator, std::enable_if_t<!std::is_integral< Estimator >::value > *=nullptr)
 
estimator_typeestimator (std::size_t step, std::size_t k)
 
const estimator_typeestimator (std::size_t step, std::size_t k) const
 
Vector< eval_type > & eval (std::size_t step)
 
const Vector< eval_type > & eval (std::size_t step) const
 
template<typename Eval >
std::size_t eval (std::size_t step, Eval &&eval, std::enable_if_t<!std::is_integral< Eval >::value > *=nullptr)
 
eval_typeeval (std::size_t step, std::size_t k)
 
const eval_typeeval (std::size_t step, std::size_t k) const
 

Friends

template<typename CharT , typename Traits >
std::basic_ostream< CharT, Traits > & operator<< (std::basic_ostream< CharT, Traits > &os, const Sampler< Derived > &sampler)
 Output the summary mtrix through an output stream. More...
 

Detailed Description

template<typename Derived>
class mckl::Sampler< Derived >

Sampler for iterative Monte Carlo algorithms.

Definition at line 46 of file sampler.hpp.

Member Typedef Documentation

◆ estimator_type

template<typename Derived>
using mckl::Sampler< Derived >::estimator_type = typename SamplerTrait<Derived>::estimator_type

Definition at line 50 of file sampler.hpp.

◆ eval_type

template<typename Derived>
using mckl::Sampler< Derived >::eval_type = typename SamplerTrait<Derived>::eval_type

Definition at line 49 of file sampler.hpp.

Constructor & Destructor Documentation

◆ Sampler()

template<typename Derived>
mckl::Sampler< Derived >::Sampler ( std::size_t  steps)
inlineprotected

Definition at line 161 of file sampler.hpp.

Member Function Documentation

◆ clear()

template<typename Derived>
void mckl::Sampler< Derived >::clear ( )
inline

Clear all estimator histories.

Definition at line 74 of file sampler.hpp.

◆ estimator() [1/5]

template<typename Derived>
Vector<estimator_type>& mckl::Sampler< Derived >::estimator ( std::size_t  step)
inlineprotected

Definition at line 172 of file sampler.hpp.

◆ estimator() [2/5]

template<typename Derived>
const Vector<estimator_type>& mckl::Sampler< Derived >::estimator ( std::size_t  step) const
inlineprotected

Definition at line 177 of file sampler.hpp.

◆ estimator() [3/5]

template<typename Derived>
template<typename Estimator >
std::size_t mckl::Sampler< Derived >::estimator ( std::size_t  step,
Estimator &&  estimator,
std::enable_if_t<!std::is_integral< Estimator >::value > *  = nullptr 
)
inlineprotected

Definition at line 202 of file sampler.hpp.

◆ estimator() [4/5]

template<typename Derived>
estimator_type& mckl::Sampler< Derived >::estimator ( std::size_t  step,
std::size_t  k 
)
inlineprotected

Definition at line 210 of file sampler.hpp.

◆ estimator() [5/5]

template<typename Derived>
const estimator_type& mckl::Sampler< Derived >::estimator ( std::size_t  step,
std::size_t  k 
) const
inlineprotected

Definition at line 215 of file sampler.hpp.

◆ eval() [1/5]

template<typename Derived>
Vector<eval_type>& mckl::Sampler< Derived >::eval ( std::size_t  step)
inlineprotected

Definition at line 165 of file sampler.hpp.

◆ eval() [2/5]

template<typename Derived>
const Vector<eval_type>& mckl::Sampler< Derived >::eval ( std::size_t  step) const
inlineprotected

Definition at line 167 of file sampler.hpp.

◆ eval() [3/5]

template<typename Derived>
template<typename Eval >
std::size_t mckl::Sampler< Derived >::eval ( std::size_t  step,
Eval &&  eval,
std::enable_if_t<!std::is_integral< Eval >::value > *  = nullptr 
)
inlineprotected

Definition at line 183 of file sampler.hpp.

◆ eval() [4/5]

template<typename Derived>
eval_type& mckl::Sampler< Derived >::eval ( std::size_t  step,
std::size_t  k 
)
inlineprotected

Definition at line 191 of file sampler.hpp.

◆ eval() [5/5]

template<typename Derived>
const eval_type& mckl::Sampler< Derived >::eval ( std::size_t  step,
std::size_t  k 
) const
inlineprotected

Definition at line 196 of file sampler.hpp.

◆ print()

template<typename Derived>
template<typename CharT , typename Traits >
std::basic_ostream<CharT, Traits>& mckl::Sampler< Derived >::print ( std::basic_ostream< CharT, Traits > &  os,
char  sepchar = ' ' 
) const
inline

Print the summary matrix in textual form.

Parameters
osThe output stream
sepcharThe character used to seperate fields

Definition at line 130 of file sampler.hpp.

◆ reserve()

template<typename Derived>
void mckl::Sampler< Derived >::reserve ( std::size_t  n)
inline

Reserve space for additional iterations.

Definition at line 53 of file sampler.hpp.

◆ reset()

template<typename Derived>
void mckl::Sampler< Derived >::reset ( )
inline

Remove all evaluation and estimation methods.

Definition at line 63 of file sampler.hpp.

◆ summary()

template<typename Derived>
template<typename T , MatrixLayout Layout>
Matrix<T, Layout> mckl::Sampler< Derived >::summary ( ) const
inline

Return a combined matrix of all estimates.

Definition at line 85 of file sampler.hpp.

Friends And Related Function Documentation

◆ operator<<

template<typename Derived>
template<typename CharT , typename Traits >
std::basic_ostream<CharT, Traits>& operator<< ( std::basic_ostream< CharT, Traits > &  os,
const Sampler< Derived > &  sampler 
)
friend

Output the summary mtrix through an output stream.

Definition at line 154 of file sampler.hpp.