npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
npstat::GridRandomizer Class Reference

#include <GridRandomizer.hh>

Public Member Functions

template<class Array >
 GridRandomizer (const Array &gridData, const BoxND< double > &gridBoundary, const unsigned interpolationDegree)
 
 GridRandomizer (const GridRandomizer &)
 
GridRandomizeroperator= (const GridRandomizer &)
 
bool operator== (const GridRandomizer &r) const
 
bool operator!= (const GridRandomizer &r) const
 
const ArrayND< double > & gridData () const
 
const BoxND< double > & gridBoundary () const
 
unsigned interpolationDegree () const
 
unsigned dim () const
 
double density (const double *x, unsigned xLen) const
 
void generate (const double *uniformRandomInput, unsigned bufLen, double *resultBuf) const
 

Detailed Description

Class for generating random numbers according to a multivariate distribution tabulated on a rectangular grid.

Constructor & Destructor Documentation

◆ GridRandomizer()

template<class Array >
npstat::GridRandomizer::GridRandomizer ( const Array &  gridData,
const BoxND< double > &  gridBoundary,
const unsigned  interpolationDegree 
)
inline

Main constructor. "interpolationDegree" may be either 0 or 1. The function values are assumed to be given in the centers of the bins. The density represented by "gridData" will be internally normalized using grid boundaries to determine the support of the density.

Member Function Documentation

◆ density()

double npstat::GridRandomizer::density ( const double *  x,
unsigned  xLen 
) const

Probability density

◆ generate()

void npstat::GridRandomizer::generate ( const double *  uniformRandomInput,
unsigned  bufLen,
double *  resultBuf 
) const

Generate random numbers according to the density provided in the constructor.

In this method, "bufLen" should not necessarily be equal to the grid dimensionality. When "bufLen" is smaller, the random numbers are efficiently generated for dimensions 0, 1, ..., bufLen - 1. When "bufLen" is larger, only the first "dim()" elements of the "resultBuf" array are filled.

◆ gridData()

const ArrayND<double>& npstat::GridRandomizer::gridData ( ) const
inline

Inspect the properties of this object


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