hep-mc
0.8
|
A class for generating random numbers according to a piecewise constant probability distribution function with varying bin widths. The PDF generates random numbers for any dimension by using a separable pdf, i.e. for \( n \)-dimensions the PDF is
\[ p \left( x_1, x_2, \ldots, x_n \right) = \prod_{i=1}^n p_i \left( x_i \right) \]
with \( n \) different piecewise constant one-dimensional PDFs \( p_i \left( x_i \right) \). The value of the PDF is determined by the inverse size of the bins. The bin boundaries \( x_i \) can be accessed by the member function bin_left and set by set_bin_left. The boundaries need to satisfy the consistency condition
\[ 0 = x_0 < x_1 < \ldots < x_{n-1} < x_n = 1 \]
Public Member Functions | |
vegas_pdf (std::size_t dimensions, std::size_t bins) | |
vegas_pdf (std::istream &in) | |
T | bin_left (std::size_t dimension, std::size_t bin) const |
void | set_bin_left (std::size_t dimension, std::size_t bin, T left) |
std::size_t | bins () const |
std::size_t | dimensions () const |
void | serialize (std::ostream &out) const |
|
inline |
Constructor. Constructs a piecewise constant PDF with the given dimensions
, each dimension subdivided by given number of bins
. Initialy each bin has the same size and therefore this PDF generates uniformly distributed random numbers.
|
inlineexplicit |
Deserialization constructor.
|
inline |
Returns the left bin boundary of bin
in dimension
.
|
inline |
The number of bins for each dimension.
|
inline |
The number of dimensions of this PDF.
|
inline |
Serializes this object.
|
inline |
Places the new left boundary of bin
in dimension
at left
. Note that this function does not try to maintain an internally consistent state, i.e. if you use this function make sure the first entry is zero, the last one and all entries in between are strictly increasing.