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
15
namespace
num
{
16
17
/// Explicit ODE: du/dt = f(t, u)
18
struct
ODEProblem
{
19
ODERhsFn
f
;
20
Vector
u0
;
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.
29
struct
MCMCProblem
{
30
std::function<double(
int
)>
accept_prob
;
31
std::function<void(
int
)>
propose
;
32
int
n_sites
;
33
};
34
35
}
// namespace num
num::BasicVector< real >
num
Definition
quadrature.hpp:8
num::ODERhsFn
std::function< void(real t, const Vector &y, Vector &dydt)> ODERhsFn
Definition
ode.hpp:32
ode.hpp
ODE integrators: Euler, RK4, adaptive RK45 (Dormand-Prince), and symplectic Velocity Verlet / Yoshida...
num::MCMCProblem
Definition
problems.hpp:29
num::MCMCProblem::n_sites
int n_sites
Definition
problems.hpp:32
num::MCMCProblem::accept_prob
std::function< double(int)> accept_prob
Definition
problems.hpp:30
num::MCMCProblem::propose
std::function< void(int)> propose
Definition
problems.hpp:31
num::ODEProblem
Explicit ODE: du/dt = f(t, u)
Definition
problems.hpp:18
num::ODEProblem::tf
double tf
Definition
problems.hpp:22
num::ODEProblem::t0
double t0
Definition
problems.hpp:21
num::ODEProblem::f
ODERhsFn f
Definition
problems.hpp:19
num::ODEProblem::u0
Vector u0
Definition
problems.hpp:20
vector.hpp
Vector operations.
include
solve
problems.hpp
Generated by
1.9.8