gsl_vegas2 Class Template Reference

#include <gsl_vegas2.h>

Inheritance diagram for gsl_vegas2:

mcarlo_inte multi_inte

Detailed Description

template<class param_t, class func_t = multi_funct<param_t>, class rng_t = gsl_rnga, class vec_t = ovector_view, class alloc_vec_t = ovector, class alloc_t = ovector_alloc>
class gsl_vegas2< param_t, func_t, rng_t, vec_t, alloc_vec_t, alloc_t >

Multidimensional integration using plain Vegas Carlo (GSL).

(Upgrade of gsl_vegas. Not working yet.)

Original documentation from GSL:

This is an implementation of the adaptive Monte-Carlo algorithm of G. P. Lepage, originally described in J. Comp. Phys. 27, 192(1978). The current version of the algorithm was described in the Cornell preprint CLNS-80/447 of March, 1980.

This code follows most closely the c version by D.R.Yennie, coded in 1984.

The input coordinates are x[j], with upper and lower limits xu[j] and xl[j]. The integration length in the j-th direction is delx[j]. Each coordinate x[j] is rescaled to a variable y[j] in the range 0 to 1. The range is divided into bins with boundaries xi[i][j], where i=0 corresponds to y=0 and i=bins to y=1. The grid is refined (ie, bins are adjusted) using d[i][j] which is some variation on the squared sum. A third parameter used in defining the real coordinate using random numbers is called z. It ranges from 0 to bins. Its integer part gives the lower index of the bin into which a call is to be placed, and the remainder gives the location inside the bin.

When stratified sampling is used the bins are grouped into boxes, and the algorithm allocates an equal number of function calls to each box.

The variable alpha controls how "stiff" the rebinning algorithm is. alpha = 0 means never change the grid. Alpha is typically set between 1 and 2.

Definition at line 77 of file gsl_vegas2.h.


Public Member Functions

int allocate (size_t ldim)
 Desc.
int init ()
void free ()
 Desc.
int vegas_integrate (const vec_t &xl, const vec_t &xu, size_t calls, double *lresult, double *abserr, func_t &func, param_t &pa)
virtual int minteg_err (func_t &func, size_t ndim, const vec_t &a, const vec_t &b, param_t &pa, double &res, double &err)
 Integrate function func from x=a to x=b.
virtual const char * type ()
 Return string denoting type ("gsl_vegas2").

Static Public Attributes

static const int GSL_VEGAS2_MODE_IMPORTANCE = 1
static const int GSL_VEGAS2_MODE_IMPORTANCE_ONLY = 0
static const int GSL_VEGAS2_MODE_STRATIFIED = -1

Protected Types

typedef int coord

Protected Member Functions

void init_box_coord (coord boxt[])
 Desc.
int change_box_coord (coord boxt[])
 Desc.
void init_grid (const vec_t &xl, const vec_t &xu, size_t ldim)
 Desc.
void reset_grid_values ()
 Desc.
void accumulate_distribution (coord lbin[], double y)
 Desc.
void random_point (vec_t &lx, coord lbin[], double *bin_vol, const coord lbox[], const vec_t &xl, const vec_t &xu, rng_t &r)
 Desc.
void resize_grid (unsigned int lbins)
 Desc.
void refine_grid ()
 Desc.
void print_lim (std::ostream *outs, const vec_t &xl, const vec_t &xu, unsigned long ldim)
 Desc.
void print_head (std::ostream *outs, unsigned long num_dim, unsigned long calls, unsigned int lit_num, unsigned int lbins, unsigned int lboxes)
 Desc.
void print_res (std::ostream *outs, unsigned int itr, double res, double err, double cum_res, double cum_err, double chi_sq)
 Desc.
void print_dist (std::ostream *outs, unsigned long ldim)
 Desc.
void print_grid (std::ostream *outs, unsigned long ldim)
 Desc.

Protected Attributes

size_t dim
size_t bins_max
unsigned int bins
unsigned int boxes
double * xi
double * xin
double * delx
double * weight
double vol
int * bin
int * box
double * d
double alpha
int mode
unsigned int iterations
int stage
double jac
double wtd_int_sum
double sum_wgts
double chi_sum
double chisq
double result
double sigma
unsigned int it_start
unsigned int it_num
unsigned int samples
unsigned int calls_per_box
rng_t rng
alloc_t ao
alloc_vec_t x

Static Protected Attributes

static const int BINS_MAX = 50

Member Function Documentation

int change_box_coord ( coord  boxt[]  )  [inline, protected]

Desc.

change_box_coord steps through the box coord like {0,0}, {0, 1}, {0, 2}, {0, 3}, {1, 0}, {1, 1}, {1, 2}, ...

Definition at line 248 of file gsl_vegas2.h.

int vegas_integrate ( const vec_t &  xl,
const vec_t &  xu,
size_t  calls,
double *  lresult,
double *  abserr,
func_t &  func,
param_t &  pa 
) [inline]

FIXME check this

FIXME check this

FIXEM check this

Definition at line 560 of file gsl_vegas2.h.


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

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page