|
numerics 0.1.0
|
Namespaces | |
| namespace | backends |
Classes | |
| struct | MetropolisStats |
| Statistics returned by a single Metropolis sweep. More... | |
| struct | UmbrellaStats |
| Statistics returned by an umbrella sampling sweep. More... | |
| struct | UmbrellaWindow |
| Window constraint for umbrella sampling. More... | |
Functions | |
| double | boltzmann_accept (double dE, double beta) noexcept |
| Metropolis acceptance probability min(1, exp(-beta*dE)). | |
| std::vector< double > | make_boltzmann_table (const std::vector< double > &dEs, double beta) |
| template<typename DeltaE , typename Apply , typename RNG > | |
| MetropolisStats | metropolis_sweep (idx n_sites, DeltaE delta_energy, Apply apply_flip, real beta, RNG &rng) |
| Single Metropolis sweep: n_sites random single-site updates. | |
| template<typename ProbFn , typename Apply , typename RNG > | |
| MetropolisStats | metropolis_sweep_prob (idx n_sites, ProbFn acceptance_prob, Apply apply_flip, RNG &rng) |
| Metropolis sweep with caller-supplied acceptance probabilities. | |
| template<typename DeltaE , typename Apply , typename Save , typename Restore , typename Measure , typename RNG > | |
| UmbrellaStats | umbrella_sweep (idx n_sites, DeltaE delta_energy, Apply apply_flip, Save save_state, Restore restore_state, Measure measure_order, UmbrellaWindow window, real beta, RNG &rng) |
| Umbrella-sampled Metropolis sweep (dE variant). | |
| template<typename ProbFn , typename Apply , typename Save , typename Restore , typename Measure , typename RNG > | |
| UmbrellaStats | umbrella_sweep_prob (idx n_sites, ProbFn acceptance_prob, Apply apply_flip, Save save_state, Restore restore_state, Measure measure_order, UmbrellaWindow window, RNG &rng) |
| Umbrella-sampled Metropolis sweep (precomputed probability variant). | |
| template<typename RNG = std::mt19937> | |
| RNG | make_seeded_rng () |
| Construct an RNG seeded from hardware entropy. | |
| template<typename RNG = std::mt19937> | |
| RNG | make_rng (typename RNG::result_type seed) |
| Construct an RNG from a fixed seed (for reproducible runs). | |
|
inlinenoexcept |
Metropolis acceptance probability min(1, exp(-beta*dE)).
Definition at line 21 of file boltzmann_table.hpp.
References num::beta().
Referenced by make_boltzmann_table().
|
inline |
Precompute a table of acceptance probabilities for a discrete set of dE values.
Definition at line 27 of file boltzmann_table.hpp.
References num::beta(), and boltzmann_accept().
| RNG num::markov::make_rng | ( | typename RNG::result_type | seed | ) |
| RNG num::markov::make_seeded_rng | ( | ) |
| MetropolisStats num::markov::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).
| 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). |
Definition at line 20 of file mcmc_impl.hpp.
References num::markov::MetropolisStats::accepted, num::beta(), and num::markov::MetropolisStats::total.
Referenced by umbrella_sweep().
| MetropolisStats num::markov::metropolis_sweep_prob | ( | idx | n_sites, |
| ProbFn | acceptance_prob, | ||
| Apply | apply_flip, | ||
| RNG & | rng | ||
| ) |
Metropolis sweep with caller-supplied acceptance probabilities.
Use this variant when acceptance probabilities are precomputed (e.g. a Boltzmann table for a discrete-dE system like the Ising model), avoiding a runtime exp() call per proposed flip.
| ProbFn | Callable: idx -> real. Returns min(1, exp(-beta*dE)) for site i. |
| Apply | Callable: idx -> void. Applies the flip at site i. |
| RNG | Random number generator. |
Definition at line 54 of file mcmc_impl.hpp.
References num::markov::MetropolisStats::accepted, and num::markov::MetropolisStats::total.
Referenced by num::solve(), and umbrella_sweep_prob().
| UmbrellaStats num::markov::umbrella_sweep | ( | idx | n_sites, |
| DeltaE | delta_energy, | ||
| Apply | apply_flip, | ||
| Save | save_state, | ||
| Restore | restore_state, | ||
| Measure | measure_order, | ||
| UmbrellaWindow | window, | ||
| real | beta, | ||
| RNG & | rng | ||
| ) |
Umbrella-sampled Metropolis sweep (dE variant).
Performs a sweep, measures the order parameter, then restores the saved state if the order parameter falls outside [window.lo, window.hi].
| DeltaE | Callable: idx -> real |
| Apply | Callable: idx -> void |
| Save | Callable: () -> void. Saves system state before the sweep. |
| Restore | Callable: () -> void. Restores saved state. |
| Measure | Callable: () -> idx. Returns the order parameter. |
| RNG | Random number generator. |
Definition at line 92 of file mcmc_impl.hpp.
References num::beta(), num::markov::UmbrellaWindow::contains(), num::markov::UmbrellaStats::mc, metropolis_sweep(), num::markov::UmbrellaStats::order_param, and num::markov::UmbrellaStats::reverted.
| UmbrellaStats num::markov::umbrella_sweep_prob | ( | idx | n_sites, |
| ProbFn | acceptance_prob, | ||
| Apply | apply_flip, | ||
| Save | save_state, | ||
| Restore | restore_state, | ||
| Measure | measure_order, | ||
| UmbrellaWindow | window, | ||
| RNG & | rng | ||
| ) |
Umbrella-sampled Metropolis sweep (precomputed probability variant).
Same as umbrella_sweep but uses caller-supplied acceptance probabilities.
| ProbFn | Callable: idx -> real |
| Apply | Callable: idx -> void |
| Save | Callable: () -> void |
| Restore | Callable: () -> void |
| Measure | Callable: () -> idx |
| RNG | Random number generator. |
Definition at line 134 of file mcmc_impl.hpp.
References num::markov::UmbrellaWindow::contains(), num::markov::UmbrellaStats::mc, metropolis_sweep_prob(), num::markov::UmbrellaStats::order_param, and num::markov::UmbrellaStats::reverted.