18 { p.u0 } -> std::convertible_to<const Vector&>;
19 { p.t0 } -> std::convertible_to<double>;
20 { p.tf } -> std::convertible_to<double>;
25 || std::same_as<std::remove_cvref_t<A>, RK4>
26 || std::same_as<std::remove_cvref_t<A>, RK45>;
30 { a.solver } -> std::convertible_to<LinearSolver>;
31 { a.dt } -> std::convertible_to<double>;
32 { a.nstep } -> std::convertible_to<int>;
36concept IsMCMCAlg = std::same_as<std::remove_cvref_t<A>, Metropolis>;
38template<IsODEProblem P>
46 return ode_rk45(prob.f, prob.u0, p, obs);
49template<IsODEProblem P>
51 return ode_rk4(prob.f, prob.u0, {.t0 = prob.t0, .tf = prob.tf, .h = alg.h}, obs);
54template<IsODEProblem P>
56 return ode_euler(prob.f, prob.u0, {.t0 = prob.t0, .tf = prob.tf, .h = alg.h}, obs);
64template<VecField F,
typename Observer>
70template<IsMCMCAlg A,
typename MeasureFn,
typename RNG>
72 for (
int s = 0; s < alg.equilibration; ++s)
75 for (
int s = 0; s < alg.measurements; ++s) {
79 return acc / alg.measurements;
Algorithm tags: carry the numerics, not the mathematics.
Implicit time integration via a user-supplied LinearSolver.
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.
void advance(Field &u, const LinearSolver &solver, ImplicitParams p, Observer &&obs)
ODEResult ode_rk4(ODERhsFn f, Vector y0, ODEParams p={}, ObserverFn obs=nullptr)
Classic 4th-order Runge-Kutta, fixed step.
std::function< void(real t, const Vector &y)> ObserverFn
ODEResult solve(const P &prob, const RK45 &alg, ObserverFn obs=nullptr)
BasicVector< real > Vector
Real-valued dense vector with full backend dispatch (CPU + GPU)
ODEResult ode_euler(ODERhsFn f, Vector y0, ODEParams p={}, ObserverFn obs=nullptr)
Forward Euler, 1st-order, fixed step.
ODEResult ode_rk45(ODERhsFn f, Vector y0, ODEParams p={}, ObserverFn obs=nullptr)
Adaptive Dormand-Prince RK45 with FSAL and PI step-size control.
ODE and symplectic integrators.
Problem types: carry the mathematics, not the numerics.
std::function< double(int)> accept_prob
std::function< void(int)> propose