Tomographer  v1.0a
Tomographer C++ Framework Documentation
MHRWStatsCollector Interface

This is a ‘type interface.’ See Type Interfaces for more info on what that is.

A type implementing a MHRWStatsCollector interface is responsible for collecting statistics from samples during a Metropolis-Hastings random walk (see Tomographer::MHRandomWalk).

This type must provide the following members. The members, or the class itself, must be templates with type parameters CountIntType, PointType, FnValueType, and MHRandomWalk. (It is usually most convenient to template the methods themselves, so that you don't have to specify the parameters when instantiating the object.)

void init()
is called before starting the random walk
void thermalizing_done()
is called after the thermalizing runs, before starting the "live" runs.
void done()
is called after the random walk is finished.
void process_sample(CountIntType k, CountIntType n, const PointType & pt, FnValueType fnval, MHRandomWalk & rw)
is called at the end of each sweep, after the thermalization sweeps have finished. This function is meant to actually take live samples. k is the raw iteration number, is the sample number (= number of live samples already taken), pt the current point of the walk, fnval the value of the function at this point (this may be the value of the MH jump function, its logarithm, or a dummy value, depending on the random walk's MHWalker::UseFnSyntaxType, see MHWalker Interface).
void raw_move(CountIntType k, bool is_thermalizing, bool is_live_iter, bool accepted, double a, const PointType & newpt, FnValueType newptval, const PointType & curpt, FnValueType curptval, MHRandomWalk & rw)
is called after each move during the random walk. Note that if you want to take real samples, use process_sample() instead.
k is the iteration number (which is reset to zero after the thermalizing sweeps), is_thermalizing is true during the first part of the random walk during the thermalizing runs, is_live_iter is set to true only if a sample is taken at this point, i.e. if not thermalizing and after a full sweep. accepted indicates whether this Metropolis-Hastings move was accepted or not and a gives the ratio of the function which was tested for the move. (Note that a might not be calculated and left to 1 if known to be greater than 1.) newpt and newptval are the new proposal jump point and the function value at that new point. The function value is either the actual value of the function, or its logarithm, or a dummy value, depending on MHWalker::UseFnSyntaxType. Similarly curpt and curptval are the current point and function value. The object rw is a reference to the random walk object instance.