Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Euclid::MathUtils::NdSampler< TKnot > Class Template Reference

#include <NdSampler.h>

Public Member Functions

 NdSampler (std::tuple< std::vector< TKnot >... > knots, const NdArray::NdArray< double > &grid)
 
template<typename Generator >
std::vector< std::tuple< TKnot... > > draw (std::size_t ndraws, Generator &rng) const
 
template<typename Generator , typename... OKnots>
void draw (std::size_t ndraws, Generator &rng, std::vector< std::tuple< OKnots... > > &output) const
 

Detailed Description

template<typename... TKnot>
class Euclid::MathUtils::NdSampler< TKnot >

Multidimensional sampler Inspired on

Definition at line 48 of file NdSampler.h.

Constructor & Destructor Documentation

◆ NdSampler()

template<typename... TKnot>
Euclid::MathUtils::NdSampler< TKnot >::NdSampler ( std::tuple< std::vector< TKnot >... >  knots,
const NdArray::NdArray< double > &  grid 
)

Constructor

Parameters
knotsDimensions of the n-dimensional grid. The first coordinate axis corresponds to the faster changing index on the grid (last one), and the last to the slowest axis (first one). This is compatible with the GridContainer internal memory layout
gridValues of the PDF at each grid intersection.

Member Function Documentation

◆ draw() [1/2]

template<typename... TKnot>
template<typename Generator >
std::vector< std::tuple< TKnot... > > Euclid::MathUtils::NdSampler< TKnot >::draw ( std::size_t  ndraws,
Generator rng 
) const

Draw samples from the n-dimensional distribution

Template Parameters
GeneratorType of the random number generator (i.e std::mt19937)
Parameters
ndrawsNumber of samples
rngInstance of the random number generator
Returns
An NdArray, where the first axis corresponds to the number of draws, and the second to the number of dimensions

◆ draw() [2/2]

template<typename... TKnot>
template<typename Generator , typename... OKnots>
void Euclid::MathUtils::NdSampler< TKnot >::draw ( std::size_t  ndraws,
Generator rng,
std::vector< std::tuple< OKnots... > > &  output 
) const

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