numerics 0.1.0
Loading...
Searching...
No Matches
algorithms.hpp
Go to the documentation of this file.
1/// @file solve/algorithms.hpp
2/// @brief Algorithm tags: carry the numerics, not the mathematics.
3///
4/// Explicit ODE (use with ODEProblem):
5/// Euler -- forward Euler, O(h)
6/// RK4 -- classic 4th-order Runge-Kutta
7/// RK45 -- adaptive Dormand-Prince, O(h^5)
8///
9/// Implicit ODE (use with any VecField):
10/// BackwardEuler -- fixed-step implicit Euler via a LinearSolver
11///
12/// MCMC (use with MCMCProblem):
13/// Metropolis -- Metropolis-Hastings with equilibration + measurement phases
14#pragma once
15
17#include "core/types.hpp"
18
19namespace num {
20
21// --- Explicit ODE algorithms -------------------------------------------------
22
23struct Euler {
24 double h = 1e-3;
25};
26
27struct RK4 {
28 double h = 1e-3;
29};
30
31struct RK45 {
32 double h = 1e-3;
33 double rtol = 1e-6;
34 double atol = 1e-9;
35 idx max_steps = 1000000;
36};
37
38// --- Implicit ODE algorithms -------------------------------------------------
39
45
46// --- MCMC algorithms ---------------------------------------------------------
47
48struct Metropolis {
49 int equilibration = 1000; ///< sweeps discarded before measuring
50 int measurements = 500; ///< sweeps over which the observable is averaged
51};
52
53} // namespace num
Core type definitions.
Universal linear solver callable type.
std::function< SolverResult(const Vector &rhs, Vector &x)> LinearSolver
std::size_t idx
Definition types.hpp:11
constexpr real e
Definition math.hpp:43
LinearSolver solver
int equilibration
sweeps discarded before measuring
int measurements
sweeps over which the observable is averaged
double atol
double rtol
double h