MCMC_MULTI__DEFINE Purpose
mcmc_multi is a subclass of the mcmc class to create markov chain
monte carlo simulations on multiple chains simultaneously.
One of IDL's principal weaknesses is that, since it is an
interpreted scripting language, it is much slower than compiled
languages for repetitive tasks like looping. The mcmc_multi class
tries to mitigate this problem by vectorizing the mcmc code. In
this class, multiple chains are run simultaneously and, assuming
that the code which generates and evaluates trial links is
vectorized well, this may be substantially faster than running one
long mcmc chain.
To use this class, the user must supply ARRAYS for the seed and
data variables when initializing the object. Each element in the
array represents the seed/data for a particular chain. The final
set of chains fetched from the getChain method will have nchain
columns and nstep rows.
As with the mcmc class, the user must also override the
logTargetDistribution and selectTrial methods in a subclass of
mcmc_multi. These methods have the same signatures as in a normal
mcmc object, but the inputs and outputs must now be arrays, not
scalars. These objects should be written in a vectorized fashion,
otherwise mcmc_multi will probably have no speed bost over mcmc.
Some quick testing showed that mcmc_multi was about a factor of 2
slower than mcmc when run using only 1 chain, but was 10x faster
when comparing 100 chains to 1 chain with 100x as many steps.
Modification History
October 2009: Written by Chris Beaumont, adapted from the mcmc
class.
December 2009: Added tracking of maximum posterior