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

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

A MHWalker compliant type describes a particular Metropolis-Hastings walk on some state space. It takes care for example of providing candidate new points (jump function), and calculating the probability ratio for the jump.

MHWalker types are used in particular by:

A type implementing the MHWalker interface must provide the following types:

typedef ... PointType
The type needed to represent a point in state space in which we are performing a random walk. An object of such type is never default-constructed, but always copy-constructed from another PointType. One should also be able to assign a PointType to another PointType (e.g. curpt = other_point).
typedef ... RealScalar
The type needed to represent a step size. This will most likely be a double or some floating-point type.
typedef ... FnValueType — required only if UseFnSyntaxType != MHUseFnRelativeValue
The return value type of the function evaluated at each point during the Metropolis-Hastings random walk. Usually this is double or some floating-point type. You do not need to provide this typedef if UseFnSyntaxType is set to MHUseFnRelativeValue.

A MHWalker must provide the following constant enumeration values:

enum { UseFnSyntaxType = ... }
Specifies how we calculate the function probability ratio of two points in the random walk. UseFnSyntaxType should be set to one of either Tomographer::MHUseFnValue, Tomographer::MHUseFnLogValue, or Tomographer::MHUseFnRelativeValue. See Role of UseFnSyntaxType.

And must provide the following members:

void init()
PointType startpoint()
void thermalizing_done()
void done()
PointType jump_fn(const PointType & curpt, RealScalar step_size)
FnValueType fnval(const PointType & curpt) — required only if UseFnSyntaxType == MHUseFnValue
FnValueType fnlogval(const PointType & curpt) — required only if UseFnSyntaxType == MHUseFnLogValue
double fnrelval(const PointType & newpt, const PointType & curpt) — required only if UseFnSyntaxType == MHUseFnRelativeValue



Role of UseFnSyntaxType:
  • MHUseFnValue –> use MHWalker::fnval(newpt)
  • MHUseFnLogValue –> use MHWalker::fnlogval(newpt)
  • MHUseFnRelativeValue –> use MHWalker::fnrelval(newpt, curpt)

.........................