#include <naive_metropolis.h>
Very experimental.
This returns the ratio of n-dimensional integrals
for function specified in
func
and specified in
weight
.
A "Metropolis step" (or simply a "step") is defined by the following procedure: The step is accepted if
or if
where is a uniform random number
newly generated for each step.
nstart steps are taken initially to ensure the first point is created with the correct probability. Afterwards, the average value of the function is stored over niter steps. This average value is computed nblock times to get an overall average and an estimate of the uncertainity.
There is a connection between integration over functions of this type and minimization. The expression
gives the minimum of the function in the region
.
Definition at line 88 of file naive_metropolis.h.
Public Member Functions | |
naive_metropolis () | |
virtual | ~naive_metropolis () |
virtual int | minteg_err (func_t &func, func_t &energy, size_t ndim, const vec_t &a, const vec_t &b, const double beta, double &value, double &err, param_t &pa) |
Calculate the integral returning result in value . | |
virtual int | minteg_array (func_t &func, func_t &energy, size_t ndim, const vec_t &a, const vec_t &b, const double beta, vec_t &results, param_t &pa) |
Calculate the integral returning result in value . | |
Data Fields | |
rng_t | rng |
unsigned long int | niter |
The number of iterations (default 10000). | |
unsigned long int | nstart |
The number of warm-up iterations (default 1000). | |
unsigned long int | nblock |
Number of blocks (default 10). |
virtual int minteg_err | ( | func_t & | func, | |
func_t & | energy, | |||
size_t | ndim, | |||
const vec_t & | a, | |||
const vec_t & | b, | |||
const double | beta, | |||
double & | value, | |||
double & | err, | |||
param_t & | pa | |||
) | [inline, virtual] |
Calculate the integral returning result in value
.
Calculates the integral given the functions func
and weight
over the region specified by a
and b
, both of side ndim
. The value of is specified in
beta
, and the result is returned in value
, with the uncertainty given in err
.
Definition at line 113 of file naive_metropolis.h.
virtual int minteg_array | ( | func_t & | func, | |
func_t & | energy, | |||
size_t | ndim, | |||
const vec_t & | a, | |||
const vec_t & | b, | |||
const double | beta, | |||
vec_t & | results, | |||
param_t & | pa | |||
) | [inline, virtual] |
Calculate the integral returning result in value
.
Calculates the integral given the functions func
and weight
over the region specified by a
and b
, both of side ndim
. The value of is specified in
beta
, and the result is returned in value
, with the uncertainty given in err
.
Definition at line 192 of file naive_metropolis.h.