vSMC
v3.0.0
Scalable Monte Carlo
|
Monitor for Monte Carlo integration. More...
#include <vsmc/core/monitor.hpp>
Public Types | |
using | eval_type = std::function< void(std::size_t, std::size_t, Particle< T > &, double *)> |
Public Member Functions | |
Monitor (std::size_t dim, const eval_type &eval, bool record_only=false, MonitorStage stage=MonitorMCMC) | |
void | clear () |
Clear all records of the index and integrations. More... | |
std::size_t | dim () const |
The dimension of the Monitor. More... | |
bool | empty () const |
Whether the evaluation object is valid. More... | |
void | eval (const eval_type &new_eval, bool record_only=false, MonitorStage stage=MonitorMCMC) |
Set a new evaluation object of type eval_type. More... | |
std::size_t | index () const |
Get the latest iteration index of the sampler. More... | |
std::size_t | index (std::size_t iter) const |
Get the iteration index of the sampler of a given Monitor iteration. More... | |
std::size_t | iter_size () const |
The number of iterations has been recorded. More... | |
std::string & | name (std::size_t id) |
Read and write access to the names of variables. More... | |
const std::string & | name (std::size_t id) const |
Read only access to the names of variables. More... | |
void | operator() (std::size_t iter, Particle< T > &particle, MonitorStage stage) |
Perform the evaluation for a given iteration and a Particle<T> object. More... | |
template<typename OutputIter > | |
OutputIter | read_index (OutputIter first) const |
Read the index history through an output iterator. More... | |
template<typename OutputIter > | |
OutputIter | read_record (std::size_t id, OutputIter first) const |
Read the record history for a given variable through an output iterator. More... | |
template<typename OutputIter > | |
OutputIter | read_record_matrix (MatrixLayout layout, OutputIter first) const |
Read the record history of all variables as a matrix through an output iterator. More... | |
double | record (std::size_t id) const |
Get the latest Monte Carlo integration record of a given variable. More... | |
double | record (std::size_t id, std::size_t iter) const |
Get the Monte Carlo integration record of a given variable and the Monitor iteration. More... | |
bool | record_only () const |
If this is a record only Monitor. More... | |
void | reserve (std::size_t num) |
Reserve space for a specified number of iterations. More... | |
MonitorStage | stage () const |
The stage of the Montior. More... | |
std::map< std::string, Vector< double > > | summary () const |
Summary of monitor history. More... | |
Monitor for Monte Carlo integration.
Definition at line 62 of file monitor.hpp.
using vsmc::Monitor< T >::eval_type = std::function<void(std::size_t, std::size_t, Particle<T> &, double *)> |
Definition at line 66 of file monitor.hpp.
|
inline |
Definition at line 68 of file monitor.hpp.
|
inline |
Clear all records of the index and integrations.
Definition at line 269 of file monitor.hpp.
|
inline |
The dimension of the Monitor.
Definition at line 80 of file monitor.hpp.
|
inline |
Whether the evaluation object is valid.
Definition at line 99 of file monitor.hpp.
|
inline |
Set a new evaluation object of type eval_type.
Definition at line 230 of file monitor.hpp.
|
inline |
Get the latest iteration index of the sampler.
Definition at line 124 of file monitor.hpp.
|
inline |
Get the iteration index of the sampler of a given Monitor iteration.
For example, if a Monitor is only added to the sampler at the sampler's iteration siter
. Then index(0)
will be siter
and so on. If the Monitor is added before the sampler's initialization and continued to be evaluated during the iterations without calling turnoff()
, then iter(iter) shall just be iter
.
Definition at line 141 of file monitor.hpp.
|
inline |
The number of iterations has been recorded.
Definition at line 89 of file monitor.hpp.
|
inline |
Read and write access to the names of variables.
By default, each variable of a Monitor is unnamed and the returned string is empty. However, the user can selectively set the names of each variable. This effect how Sampler will print the headers of the summary table.
Definition at line 108 of file monitor.hpp.
|
inline |
Read only access to the names of variables.
Definition at line 116 of file monitor.hpp.
|
inline |
Perform the evaluation for a given iteration and a Particle<T> object.
Definition at line 240 of file monitor.hpp.
|
inline |
Read the index history through an output iterator.
Definition at line 150 of file monitor.hpp.
|
inline |
Read the record history for a given variable through an output iterator.
Definition at line 179 of file monitor.hpp.
|
inline |
Read the record history of all variables as a matrix through an output iterator.
Definition at line 194 of file monitor.hpp.
|
inline |
Get the latest Monte Carlo integration record of a given variable.
Definition at line 157 of file monitor.hpp.
|
inline |
Get the Monte Carlo integration record of a given variable and the Monitor iteration.
Definition at line 168 of file monitor.hpp.
|
inline |
If this is a record only Monitor.
Definition at line 83 of file monitor.hpp.
|
inline |
Reserve space for a specified number of iterations.
Definition at line 92 of file monitor.hpp.
|
inline |
The stage of the Montior.
Definition at line 86 of file monitor.hpp.
|
inline |
Summary of monitor history.
Definition at line 209 of file monitor.hpp.