21template<IsMCMCAlg A,
typename RNG>
23 for (
int s = 0; s < alg.equilibration; ++s)
26 for (
int s = 0; s < alg.measurements; ++s) {
30 return acc / alg.measurements;
Algorithm tags: carry the numerics, not the mathematics.
Metropolis-Hastings sweep API.
MetropolisStats metropolis_sweep_prob(idx n_sites, ProbFn acceptance_prob, Apply apply_flip, RNG &rng)
Metropolis sweep with caller-supplied acceptance probabilities.
double sample(const MCMCModel &model, const A &alg, RNG &rng)
Run equilibration then measurement sweeps; return the mean observable.
An MCMC target: site count, per-site acceptance/proposal, observable.
std::function< double()> measure
observable estimator, sampled each sweep
std::function< void(int)> propose
propose and apply a move at a site
std::function< double(int)> accept_prob
acceptance probability at a site