numerics 0.1.0
Loading...
Searching...
No Matches
problems.hpp
Go to the documentation of this file.
1/// @file solve/problems.hpp
2/// @brief Problem types: carry the mathematics, not the numerics.
3///
4/// ODEProblem -- du/dt = f(t, u), u0, time span [t0, tf]
5/// MCMCProblem -- Markov chain over n_sites with accept/propose callables
6///
7/// The algorithm (how to solve) is always separate; pass it to num::solve().
8#pragma once
9
10#include "core/vector.hpp"
11#include "ode/ode.hpp"
12#include <functional>
13#include <random>
14
15namespace num {
16
17/// Explicit ODE: du/dt = f(t, u)
18struct ODEProblem {
21 double t0 = 0.0;
22 double tf = 1.0;
23};
24
25/// MCMC sampling problem over n_sites.
26/// accept_prob(i) returns the Metropolis acceptance probability for site i.
27/// propose(i) applies the proposed move at site i.
28/// The spin state is implicit in the lambda captures -- the caller owns it.
30 std::function<double(int)> accept_prob;
31 std::function<void(int)> propose;
33};
34
35} // namespace num
std::function< void(real t, const Vector &y, Vector &dydt)> ODERhsFn
Definition ode.hpp:32
ODE integrators: Euler, RK4, adaptive RK45 (Dormand-Prince), and symplectic Velocity Verlet / Yoshida...
std::function< double(int)> accept_prob
Definition problems.hpp:30
std::function< void(int)> propose
Definition problems.hpp:31
Explicit ODE: du/dt = f(t, u)
Definition problems.hpp:18
Vector operations.