CASM
AClustersApproachtoStatisticalMechanics
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules
CASM::MonteSampler Class Reference

#include <MonteSampler.hh>

+ Inheritance diagram for CASM::MonteSampler:

Detailed Description

An abstract base class for sampling and storing data observations.

Definition at line 22 of file MonteSampler.hh.

Public Types

typedef MCData::size_type size_type
 

Public Member Functions

 MonteSampler (const std::string &print_name, double data_confidence, size_type data_initsize)
 Construct sampler that does not need to converge. More...
 
 MonteSampler (const std::string &print_name, double data_prec, double data_confidence, size_type data_initsize)
 Construct sampler that must converge. More...
 
virtual ~MonteSampler ()
 
virtual void sample (const MonteCarlo &mc, const MonteCounter &counter)
 
void clear ()
 Clear all data observations. More...
 
std::pair< bool, size_typeis_equilibrated () const
 Returns pair(true, equil_steps) if equilibration has occured to required precision. More...
 
bool must_converge () const
 Returns true if convergence criteria must be met for Monte Carlo calculation to be complete. More...
 
double requested_precision () const
 Returns requested precision on the mean. More...
 
bool is_converged (size_type equil_samples) const
 Returns true if convergence criteria have been met for data sampled in range [equil_samples, end) More...
 
double mean (size_type equil_samples) const
 Returns <X> for data sampled in range [equil_samples, end) More...
 
double squared_norm (size_type equil_samples) const
 Returns <X*X> for data sampled in range [equil_samples, end) More...
 
double calculated_precision (size_type equil_samples) const
 Returns calculated precision on the mean for data sampled in range [equil_samples, end) More...
 
const MCDatadata () const
 const Access the raw data observation container More...
 
std::string name () const
 Property name for printing. More...
 
std::unique_ptr< MonteSamplerclone () const
 Clone this object. More...
 

Protected Member Functions

MCDatadata ()
 Access the raw data observation container. More...
 

Private Member Functions

virtual MonteSampler_clone () const
 
void _check_convergence (size_type equil_samples) const
 

Private Attributes

bool m_must_converge
 If false, data observations are recorded but shouldn't be used to determine if Monte Carlo run has converged. More...
 
double m_prec
 Requested precision, if must_converge. More...
 
double m_conf
 Requested confidence, if must_converge. More...
 
MCData m_data
 An array of observations, one for every so many steps or passes. More...
 
std::string m_name
 Property name for printing. More...
 
bool m_equilibration_uptodate = false
 
MCDataEquilibration m_equilibration
 
bool m_convergence_uptodate = false
 
size_type m_convergence_start_sample = 0
 
MCDataConvergence m_convergence
 

Member Typedef Documentation

Constructor & Destructor Documentation

CASM::MonteSampler::MonteSampler ( const std::string &  print_name,
double  data_confidence,
size_type  data_initsize 
)

Construct sampler that does not need to converge.

Definition at line 10 of file MonteSampler.cc.

CASM::MonteSampler::MonteSampler ( const std::string &  print_name,
double  data_prec,
double  data_confidence,
size_type  data_initsize 
)

Construct sampler that must converge.

Definition at line 21 of file MonteSampler.cc.

virtual CASM::MonteSampler::~MonteSampler ( )
inlinevirtual

Definition at line 39 of file MonteSampler.hh.

Member Function Documentation

void CASM::MonteSampler::_check_convergence ( size_type  equil_samples) const
inlineprivate

Definition at line 160 of file MonteSampler.hh.

virtual MonteSampler* CASM::MonteSampler::_clone ( ) const
inlineprivatevirtual
double CASM::MonteSampler::calculated_precision ( size_type  equil_samples) const
inline

Returns calculated precision on the mean for data sampled in range [equil_samples, end)

Definition at line 119 of file MonteSampler.hh.

void CASM::MonteSampler::clear ( )
inline

Clear all data observations.

Definition at line 47 of file MonteSampler.hh.

std::unique_ptr<MonteSampler> CASM::MonteSampler::clone ( ) const
inline

Clone this object.

Definition at line 140 of file MonteSampler.hh.

const MCData& CASM::MonteSampler::data ( ) const
inline

const Access the raw data observation container

Definition at line 130 of file MonteSampler.hh.

MCData& CASM::MonteSampler::data ( )
inlineprotected

Access the raw data observation container.

Definition at line 148 of file MonteSampler.hh.

bool CASM::MonteSampler::is_converged ( size_type  equil_samples) const
inline

Returns true if convergence criteria have been met for data sampled in range [equil_samples, end)

Definition at line 82 of file MonteSampler.hh.

std::pair<bool, size_type> CASM::MonteSampler::is_equilibrated ( ) const
inline

Returns pair(true, equil_steps) if equilibration has occured to required precision.

Definition at line 55 of file MonteSampler.hh.

double CASM::MonteSampler::mean ( size_type  equil_samples) const
inline

Returns <X> for data sampled in range [equil_samples, end)

Definition at line 97 of file MonteSampler.hh.

bool CASM::MonteSampler::must_converge ( ) const
inline

Returns true if convergence criteria must be met for Monte Carlo calculation to be complete.

Definition at line 70 of file MonteSampler.hh.

std::string CASM::MonteSampler::name ( ) const
inline

Property name for printing.

Definition at line 135 of file MonteSampler.hh.

double CASM::MonteSampler::requested_precision ( ) const
inline

Returns requested precision on the mean.

Definition at line 75 of file MonteSampler.hh.

virtual void CASM::MonteSampler::sample ( const MonteCarlo mc,
const MonteCounter counter 
)
inlinevirtual
double CASM::MonteSampler::squared_norm ( size_type  equil_samples) const
inline

Returns <X*X> for data sampled in range [equil_samples, end)

Definition at line 108 of file MonteSampler.hh.

Member Data Documentation

double CASM::MonteSampler::m_conf
private

Requested confidence, if must_converge.

Definition at line 174 of file MonteSampler.hh.

MCDataConvergence CASM::MonteSampler::m_convergence
mutableprivate

Definition at line 188 of file MonteSampler.hh.

size_type CASM::MonteSampler::m_convergence_start_sample = 0
mutableprivate

Definition at line 187 of file MonteSampler.hh.

bool CASM::MonteSampler::m_convergence_uptodate = false
mutableprivate

Definition at line 186 of file MonteSampler.hh.

MCData CASM::MonteSampler::m_data
private

An array of observations, one for every so many steps or passes.

Definition at line 177 of file MonteSampler.hh.

MCDataEquilibration CASM::MonteSampler::m_equilibration
mutableprivate

Definition at line 185 of file MonteSampler.hh.

bool CASM::MonteSampler::m_equilibration_uptodate = false
mutableprivate

Definition at line 184 of file MonteSampler.hh.

bool CASM::MonteSampler::m_must_converge
private

If false, data observations are recorded but shouldn't be used to determine if Monte Carlo run has converged.

Definition at line 168 of file MonteSampler.hh.

std::string CASM::MonteSampler::m_name
private

Property name for printing.

Definition at line 180 of file MonteSampler.hh.

double CASM::MonteSampler::m_prec
private

Requested precision, if must_converge.

Definition at line 171 of file MonteSampler.hh.


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