Particle History Storage

Classes and function related to the history of the sampler.

This file contains template definitions for the classes used to store the history of an SMCTC sampler. It defines smc::historyflags and smc::historyelement.

Defines

__SMC_HISTORY_HH
namespace smc

The Sequential Monte Carlo namespace.

The classes and functions within this namespace are intended to be used for producing implemenetations of SMC samplers and related simulation techniques.

template<class Space>
class historyelement
#include <history.h>

A template class for the elements of a linked list to be used for the history of the sampler.

Public Functions

historyelement()

The null constructor creates an empty history element.

historyelement(long lNumber, population<Space> pNew, int nAccepts, int nRepeats, historyflags hf)

A constructor with four arguments initialises the particle set.

Parameters
  • lNumber – The number of particles present in the particle generation

  • New – The array of particles which are present in the particle generation

  • nAccepts – The number of MCMC moves that were accepted during this particle generation

  • nRepeats – The number of MCMC iterations that were performed during this particle generation

  • hf – The historyflags associated with the particle generation

~historyelement()

The destructor tidies up.

double GetESS(void) const

Returns the effective sample size of this particle generation.

inline historyflags GetFlags(void) const

Returns the flags.

inline long GetNumber(void) const

Returns the number of particles present.

inline population<Space> GetValues(void) const

Returns the current particle set.

inline population<Space> &GetRefs(void)

Returns a reference to the current particle set.

inline void SetAIndices(const arma::Col<unsigned int> &newAindices)

Sets the ancestor indices of the current particle set.

inline arma::Col<unsigned int> GetAIndices(void) const

Returns the ancestor indices of the current particle set.

long double Integrate(long lTime, double (*pIntegrand)(long, const Space&, void*), void *pAuxiliary) const

Monte Carlo estimate of the expectation of the supplied function with respect to the empirical measure of the particle ensemble.

Parameters
  • lTime – The timestep at which the integration is to be carried out

  • pIntegrand – The function which is to be integrated

  • pAuxiliary – A pointer to additional information which is passed to the integrand function

long double Integrate_Var(long lTime, double (*pIntegrand)(long, const Space&, void*), double Expectation, void *pAuxiliary) const

Monte Carlo estimate of the variance of the supplied function with respect to the empirical measure of the particle ensemble (to be used in second order trapezoidal correction).

Parameters
  • lTime – The timestep at which the integration is to be carried out

  • pIntegrand – The function which is to be integrated

  • pAuxiliary – A pointer to additional information which is passed to the integrand function

inline void Set(long lNumber, const population<Space> &New, int inAccepted, int nRepeats, const historyflags &histflags)

Sets the particle set to the specified values excluding ancestors.

inline void Set(long lNumber, const population<Space> &New, int inAccepted, int nRepeats, const historyflags &histflags, const arma::Col<unsigned int> &newAindices)

Sets the particle set to the specified values including ancestors.

inline void Set(long lNumber, const population<Space> &New, const historyflags &histflags, const arma::Col<unsigned int> &newAindices)

Sets the particle set to the specified values including ancestors specifically to use with the derived conditional sampler class where adaptation and MCMC moves are not supported.

inline void Set(long lNumber, const population<Space> &New, const historyflags &histflags)

Sets the particle set to the specified values excluding ancestors for the derived conditional sampler class.

inline int AcceptCount(void)

Returns the number of MCMC moves accepted during this iteration.

inline int mcmcRepeats(void)

Returns the number of MCMC iterations performed during this iteration.

inline int WasResampled(void)

Returns true if the particle set.

Private Members

long number

The number of particles (presently redundant as this is not a function of iteration)

int nAccepted

Number of MCMC moves accepted during this iteration.

int nRepeat

Number of MCMC iterations performed at this iteration (per particle)

population<Space> pop

The particles themselves (values and weights)

arma::Col<unsigned int> ancestorIndices = arma::Col<unsigned int>(number)
historyflags flags

Flags associated with this iteration.

class historyflags
#include <history.h>

The historyflags class holds a set of flags which describe various properties of the particle system at a given time.

Public Functions

inline historyflags(int wasResampled)

This constructor produces an initialised historyflags instance.

Parameters

wasResampled – An indicator which should be nonzero if the particle system was resampled during the iteration being described

inline int WasResampled(void)

This function returns true if the flag set indicates that the ensemble was resampled during the described iteration.

Private Members

unsigned int Resampled

true if the particle system was resampled during the described iteration.