35 { p.u0 } -> std::convertible_to<const Vector&>;
36 { p.t0 } -> std::convertible_to<double>;
37 { p.tf } -> std::convertible_to<double>;
42 std::same_as<std::remove_cvref_t<A>, Euler> ||
43 std::same_as<std::remove_cvref_t<A>, RK4> ||
44 std::same_as<std::remove_cvref_t<A>, RK45>;
48 { a.solver } -> std::convertible_to<LinearSolver>;
49 { a.dt } -> std::convertible_to<double>;
50 { a.nstep } -> std::convertible_to<int>;
54concept IsMCMCAlg = std::same_as<std::remove_cvref_t<A>, Metropolis>;
58template<IsODEProblem P>
62 return ode_rk45(prob.f, prob.u0, p, obs);
65template<IsODEProblem P>
67 return ode_rk4(prob.f, prob.u0, {.t0=prob.t0, .tf=prob.tf, .h=alg.h}, obs);
70template<IsODEProblem P>
72 return ode_euler(prob.f, prob.u0, {.t0=prob.t0, .tf=prob.tf, .h=alg.h}, obs);
82template<VecField F,
typename Observer>
92template<IsMCMCAlg A,
typename MeasureFn,
typename RNG>
94 for (
int s = 0; s < alg.equilibration; ++s)
97 for (
int s = 0; s < alg.measurements; ++s) {
101 return acc / alg.measurements;
Algorithm tags: carry the numerics, not the mathematics.
Implicit time integration via a user-supplied LinearSolver.
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 integrators: Euler, RK4, adaptive RK45 (Dormand-Prince), and symplectic Velocity Verlet / Yoshida...
Problem types: carry the mathematics, not the numerics.
std::function< double(int)> accept_prob
std::function< void(int)> propose
Parameters for all ODE integrators. Set only the fields you need.