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
16
#include "
linalg/solvers/linear_solver.hpp
"
17
#include "
core/types.hpp
"
18
19
namespace
num
{
20
21
// --- Explicit ODE algorithms -------------------------------------------------
22
23
struct
Euler
{
24
double
h
= 1
e
-3;
25
};
26
27
struct
RK4
{
28
double
h
= 1
e
-3;
29
};
30
31
struct
RK45
{
32
double
h
= 1
e
-3;
33
double
rtol
= 1
e
-6;
34
double
atol
= 1
e
-9;
35
idx
max_steps
= 1000000;
36
};
37
38
// --- Implicit ODE algorithms -------------------------------------------------
39
40
struct
BackwardEuler
{
41
LinearSolver
solver
;
42
double
dt
;
43
int
nstep
;
44
};
45
46
// --- MCMC algorithms ---------------------------------------------------------
47
48
struct
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
types.hpp
Core type definitions.
linear_solver.hpp
Universal linear solver callable type.
num
Definition
quadrature.hpp:8
num::LinearSolver
std::function< SolverResult(const Vector &rhs, Vector &x)> LinearSolver
Definition
linear_solver.hpp:23
num::idx
std::size_t idx
Definition
types.hpp:11
num::e
constexpr real e
Definition
math.hpp:43
num::BackwardEuler
Definition
algorithms.hpp:40
num::BackwardEuler::solver
LinearSolver solver
Definition
algorithms.hpp:41
num::BackwardEuler::nstep
int nstep
Definition
algorithms.hpp:43
num::BackwardEuler::dt
double dt
Definition
algorithms.hpp:42
num::Euler
Definition
algorithms.hpp:23
num::Euler::h
double h
Definition
algorithms.hpp:24
num::Metropolis
Definition
algorithms.hpp:48
num::Metropolis::equilibration
int equilibration
sweeps discarded before measuring
Definition
algorithms.hpp:49
num::Metropolis::measurements
int measurements
sweeps over which the observable is averaged
Definition
algorithms.hpp:50
num::RK45
Definition
algorithms.hpp:31
num::RK45::max_steps
idx max_steps
Definition
algorithms.hpp:35
num::RK45::atol
double atol
Definition
algorithms.hpp:34
num::RK45::rtol
double rtol
Definition
algorithms.hpp:33
num::RK45::h
double h
Definition
algorithms.hpp:32
num::RK4
Definition
algorithms.hpp:27
num::RK4::h
double h
Definition
algorithms.hpp:28
include
solve
algorithms.hpp
Generated by
1.9.8