Class prob_cond_mdim_fixed_step (o2scl)¶
-
template<class
vec_t
= boost::numeric::ublas::vector<double>>
classo2scl
::
prob_cond_mdim_fixed_step
: public o2scl::prob_cond_mdim<boost::numeric::ublas::vector<double>>¶ Conditional probability for a random walk inside a hypercube.
This conditional probability is most useful in providing a Metropolis-Hastings distribution with a fixed step size which properly handles a boundary. The Metropolis-Hastings step is accepted if \( r \in [0,1] \) obeys
\[ r < \frac{P(x^{\prime})g(x|x^{\prime})} {P(x)g(x^{\prime}|x)} \]The function \( g(x^{\prime}|x) = g(x^{\prime},x)/g(x) \), and because of the fixed step size these probabilities are just proportional to the inverse allowed volume, i.e. \( V(x)^{-1} V^{-1}(x^{\prime}) / V(x)^{-1} = V^{-1}(x^{\prime}) \) . If \( x^{\prime} \) is near a boundary then \( V(x^{\prime}) \) is decreased and the conditional probability increases accordingly. If the distance between \( x \) and \( x^{\prime} \) is unreachable in a step, then the PDF is zero.- Note
This class is experimental.
- Note
Const functions are not thread-safe because the class contains an internal mutable random number generator object.
Public Functions
-
prob_cond_mdim_fixed_step
()¶
-
prob_cond_mdim_fixed_step
(const prob_cond_mdim_fixed_step &pcmfs)¶ Copy constructor.
-
prob_cond_mdim_fixed_step &
operator=
(const prob_cond_mdim_fixed_step &pcmfs)¶ Copy constructor with operator=.
-
~prob_cond_mdim_fixed_step
()¶ Virtual destructor.
-
void
set_seed
(unsigned long int s)¶ Set the random number generator seed.
-
template<class = vec_t>
prob_cond_mdim_fixed_step
(vec_t &step, vec_t &low, vec_t &high)¶ Create a conditional probability object with specified step sizes and limits.
-
size_t
dim
() const¶ The dimensionality.
-
double
pdf
(const vec_t &x_B, const vec_t &x_A) const¶ The conditional probability of x_A given x_B, i.e. \( P(A|B) \).
Protected Functions