Skip to content

num::markov::metropolis_sweep

Defined in header <stochastic/detail/mcmc_impl.hpp>

template <energy_difference DeltaE, std::invocable<idx> Apply,
          std::uniform_random_bit_generator RNG>
metropolis_stats metropolis_sweep(idx n_sites, DeltaE delta_energy, Apply apply_flip,
                                  real beta, RNG &rng);

Single Metropolis sweep: n_sites random single-site updates.

The acceptance probability is min(1, exp(-beta * dE)) computed from the value returned by delta_energy(i).

Template parameters

  • DeltaE: Callable: idx -> real. Returns dE for proposing a flip at i.
  • Apply: Callable: idx -> void. Applies the flip at site i.
  • RNG: Random number generator (e.g., std::mt19937).