hep-mc  0.8
Functions
VEGAS Integrator

Detailed Description

The VEGAS Monte Carlo integration algorithm.

The VEGAS Monte Carlo integration algorithm divides the integration into several sub-integrations, called iterations, and uses the results to automatically construct a PDF that is then used to do importance sampling in order to reduce the error, e.g. compared to plain.

The VEGAS algorithm is available in two forms:

Functions

template<typename I , typename Checkpoint = default_vegas_chkpt<numeric_type_of<I>>, typename Callback = mpi_callback<Checkpoint>>
Checkpoint hep::mpi_vegas (MPI_Comm communicator, I &&integrand, std::vector< std::size_t > const &iteration_calls, Checkpoint chkpt=make_vegas_chkpt< numeric_type_of< I >>(), Callback callback=mpi_callback< Checkpoint >())
 
template<typename I , typename R >
vegas_result< numeric_type_of< I > > hep::vegas_iteration (I &&integrand, std::size_t calls, vegas_pdf< numeric_type_of< I >> const &pdf, R &generator)
 
template<typename I , typename Checkpoint = default_vegas_chkpt<numeric_type_of<I>>, typename Callback = callback<Checkpoint>>
Checkpoint hep::vegas (I &&integrand, std::vector< std::size_t > const &iteration_calls, Checkpoint chkpt=make_vegas_chkpt< numeric_type_of< I >>(), Callback callback=callback< Checkpoint >())
 

Function Documentation

◆ mpi_vegas()

template<typename I , typename Checkpoint = default_vegas_chkpt<numeric_type_of<I>>, typename Callback = mpi_callback<Checkpoint>>
Checkpoint hep::mpi_vegas ( MPI_Comm  communicator,
I &&  integrand,
std::vector< std::size_t > const &  iteration_calls,
Checkpoint  chkpt = make_vegas_chkpt<numeric_type_of<I>>(),
Callback  callback = mpi_callback<Checkpoint>() 
)
inline

MPI version of vegas.

Examples:
mpi_vegas_example.cpp.

◆ vegas()

template<typename I , typename Checkpoint = default_vegas_chkpt<numeric_type_of<I>>, typename Callback = callback<Checkpoint>>
Checkpoint hep::vegas ( I &&  integrand,
std::vector< std::size_t > const &  iteration_calls,
Checkpoint  chkpt = make_vegas_chkpt<numeric_type_of<I>>(),
Callback  callback = callback<Checkpoint>() 
)
inline

Integrates function by performing iteration_calls.size() iterations of the VEGAS algorithm, with as many function calls for each iteration specified by the corresponding value in iteration_calls. The pdf refinement is done using vegas_refine_pdf which is called with the \( \alpha \)-parameter given by alpha.

This function can be used to start from an already adapted pdf, e.g. one by vegas_result::pdf obtained by a previous vegas call.

Examples:
vegas_example.cpp, vegas_stop_after_precision.cpp, and vegas_write_pdf.cpp.

◆ vegas_iteration()

template<typename I , typename R >
vegas_result<numeric_type_of<I> > hep::vegas_iteration ( I &&  integrand,
std::size_t  calls,
vegas_pdf< numeric_type_of< I >> const &  pdf,
R &  generator 
)
inline

Performs one VEGAS iteration. This integrates function over the unit-hypercube using calls function evaluations with random numbers generated by generator. The generator is not seeded. The pdf is used to implement importance sampling; stratified sampling is not used. The dimension of the function is determined by pdf.size().

The parameter total_calls determines the sample size \( N \) of the iteration vegas_iteration performs and therefore usually has usually the same value as calls. If VEGAS is run in parallel, then this function will be called multiple times with a differently seeded generator and with calls parameters each smaller than total_calls but their sum being equal to total_calls.