Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
o2scl::prob_cond_mdim_fixed_step< vec_t > Class Template Reference

Conditional probability for a random walk inside a hypercube. More...

#include <prob_dens_func.h>

Inheritance diagram for o2scl::prob_cond_mdim_fixed_step< vec_t >:
o2scl::prob_cond_mdim< vec_t >

Detailed Description

template<class vec_t = boost::numeric::ublas::vector<double>>
class o2scl::prob_cond_mdim_fixed_step< vec_t >

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.

Definition at line 1237 of file prob_dens_func.h.

Public Member Functions

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.
 
virtual int set (vec_t &step, vec_t &low, vec_t &high)
 Set step sizes and limits.
 
virtual size_t dim () const
 The dimensionality.
 
virtual double pdf (const vec_t &x, const vec_t &x2) const
 The conditional probability.
 
virtual double log_pdf (const vec_t &x, const vec_t &x2) const
 The log of the conditional probability.
 
virtual void operator() (const vec_t &x, vec_t &x2) const
 Sample the distribution.
 
- Public Member Functions inherited from o2scl::prob_cond_mdim< vec_t >
virtual double log_metrop_hast (const vec_t &x_B, vec_t &x_A) const
 Sample the distribution and return the log of the Metropolis-Hastings ratio. More...
 

Protected Member Functions

int set_internal (size_t sz, vec_t &step, vec_t &low, vec_t &high)
 Internal set function. More...
 

Protected Attributes

std::vector< double > u_step
 Step sizes.
 
std::vector< double > u_low
 Lower limits.
 
std::vector< double > u_high
 Upper limits.
 
rng_gsl rg
 Internal random number generator.
 

Member Function Documentation

◆ set_internal()

template<class vec_t = boost::numeric::ublas::vector<double>>
int o2scl::prob_cond_mdim_fixed_step< vec_t >::set_internal ( size_t  sz,
vec_t &  step,
vec_t &  low,
vec_t &  high 
)
inlineprotected

Definition at line 1264 of file prob_dens_func.h.


The documentation for this class was generated from the following file:

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).