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#pragma once
4
5#include "core/policy.hpp"
6#include "core/types.hpp"
7#include <concepts>
8#include <type_traits>
9
10namespace num {
11
12// -- ODE integrators --
13
14struct Euler {
15 double h = 1e-3;
16};
17
18struct RK4 {
19 double h = 1e-3;
20};
21
22struct RK45 {
23 double h = 1e-3;
24 double rtol = 1e-6;
25 double atol = 1e-9;
26 idx max_steps = 1000000;
27};
28
29// -- Linear-system solvers --
30
36
43
49
50template<class M>
57
58template<class M>
59PCG(const M&) -> PCG<M>;
60
61// -- MCMC samplers --
62
63struct Metropolis {
64 int equilibration = 1000;
65 int measurements = 500;
66};
67
68/// @brief An MCMC algorithm tag.
69template<typename A>
70concept IsMCMCAlg = std::same_as<std::remove_cvref_t<A>, Metropolis>;
71
72} // namespace num
An MCMC algorithm tag.
Backend enum and default backend selection.
Core type definitions.
double real
Definition types.hpp:10
Backend
Definition policy.hpp:7
std::size_t idx
Definition types.hpp:11
constexpr real e
Definition math.hpp:44
constexpr Backend default_backend
Definition policy.hpp:53
Backend backend
idx max_iter
Backend backend
Backend backend
Backend backend
const M & preconditioner
double atol
double rtol
double h