numerics
0.1.0
Loading...
Searching...
No Matches
mcmc.hpp
Go to the documentation of this file.
1
/// @file stochastic/mcmc.hpp
2
/// @brief Metropolis-Hastings sweep API.
3
#pragma once
4
#include "
core/types.hpp
"
5
6
namespace
num::markov
{
7
8
struct
MetropolisStats
{
9
idx
accepted
= 0;
10
idx
total
= 0;
11
real
acceptance_rate
()
const
{
12
return
total
> 0 ?
static_cast<
real
>
(
accepted
) /
total
: 0.0;
13
}
14
};
15
16
struct
UmbrellaStats
{
17
MetropolisStats
mc
;
18
bool
reverted
=
false
;
19
idx
order_param
= 0;
20
};
21
22
struct
UmbrellaWindow
{
23
idx
lo
= 0;
24
idx
hi
= 0;
25
bool
contains
(
idx
v)
const
{
return
v >=
lo
&& v <=
hi
; }
26
};
27
28
}
// namespace num::markov
29
30
#include "
stochastic/detail/mcmc_impl.hpp
"
types.hpp
Core type definitions.
mcmc_impl.hpp
Template implementations for stochastic/mcmc.hpp. Included at the bottom of mcmc.hpp – do not include...
num::markov
Definition
boltzmann_table.hpp:8
num::real
double real
Definition
types.hpp:10
num::idx
std::size_t idx
Definition
types.hpp:11
num::markov::MetropolisStats
Definition
mcmc.hpp:8
num::markov::MetropolisStats::accepted
idx accepted
Definition
mcmc.hpp:9
num::markov::MetropolisStats::acceptance_rate
real acceptance_rate() const
Definition
mcmc.hpp:11
num::markov::MetropolisStats::total
idx total
Definition
mcmc.hpp:10
num::markov::UmbrellaStats
Definition
mcmc.hpp:16
num::markov::UmbrellaStats::mc
MetropolisStats mc
Definition
mcmc.hpp:17
num::markov::UmbrellaStats::reverted
bool reverted
Definition
mcmc.hpp:18
num::markov::UmbrellaStats::order_param
idx order_param
Definition
mcmc.hpp:19
num::markov::UmbrellaWindow
Definition
mcmc.hpp:22
num::markov::UmbrellaWindow::hi
idx hi
Definition
mcmc.hpp:24
num::markov::UmbrellaWindow::lo
idx lo
Definition
mcmc.hpp:23
num::markov::UmbrellaWindow::contains
bool contains(idx v) const
Definition
mcmc.hpp:25
include
stochastic
mcmc.hpp
Generated by
1.9.8