SG++-Doxygen-Documentation
sgpp::quadrature::SampleGenerator Class Reference

Base class for all types of MonteCarlo sample generators used in SGPP. More...

#include <SampleGenerator.hpp>

Inheritance diagram for sgpp::quadrature::SampleGenerator:
sgpp::quadrature::HaltonSampleGenerator sgpp::quadrature::LatinHypercubeSampleGenerator sgpp::quadrature::NaiveSampleGenerator sgpp::quadrature::StratifiedSampleGenerator

Public Member Functions

size_t getDimensions ()
 
virtual void getSample (sgpp::base::DataVector &sample)
 Abstract Method which has to be implemented by each sample generator One single sample is generated by this method. More...
 
void getSamples (sgpp::base::DataMatrix &samples)
 This method generates a given number of samples. More...
 
 SampleGenerator (size_t dimensions, std::uint64_t seed=std::mt19937_64::default_seed)
 Standard constructor. More...
 
void setDimensions (size_t dimensions)
 Sets the number of dimensions for sample generation to the given value. More...
 
virtual ~SampleGenerator ()
 

Protected Attributes

size_t dimensions
 
std::mt19937_64 rng
 
std::uint64_t seed
 

Detailed Description

Base class for all types of MonteCarlo sample generators used in SGPP.

A sample generator is used to generate one or multiple n-dimensional sample vectors inside the n-dimensional unit cube.

Constructor & Destructor Documentation

◆ SampleGenerator()

sgpp::quadrature::SampleGenerator::SampleGenerator ( size_t  dimensions,
std::uint64_t  seed = std::mt19937_64::default_seed 
)
explicit

Standard constructor.

Parameters
dimensionsnumber of dimensions used for sample generation
seedcustom seed (defaults to default seed of mt19937_64)

References rng.

◆ ~SampleGenerator()

sgpp::quadrature::SampleGenerator::~SampleGenerator ( )
virtual

Member Function Documentation

◆ getDimensions()

size_t sgpp::quadrature::SampleGenerator::getDimensions ( )
Returns
current number of dimensions used for sample generation

References dimensions.

Referenced by getSample().

◆ getSample()

virtual void sgpp::quadrature::SampleGenerator::getSample ( sgpp::base::DataVector sample)
inlinevirtual

Abstract Method which has to be implemented by each sample generator One single sample is generated by this method.

The dimensionality of the parameter has to fit the number of dimensions used in this sample generator.

Parameters
sampleprovide a DataVector to store the generated sample.

Reimplemented in sgpp::quadrature::LatinHypercubeSampleGenerator, sgpp::quadrature::StratifiedSampleGenerator, sgpp::quadrature::NaiveSampleGenerator, and sgpp::quadrature::HaltonSampleGenerator.

References getDimensions(), getSamples(), parabolasimple::samples, and setDimensions().

Referenced by getSamples().

◆ getSamples()

void sgpp::quadrature::SampleGenerator::getSamples ( sgpp::base::DataMatrix samples)

This method generates a given number of samples.

The resulting samples are written to the parameter DataMatrix. Therefore the number of cols has to fit the number of dimensions whereas the number of rows defines the number of generated samples.

Parameters
samplesprovide a DataMatrix to hold the generated samples

References dimensions, sgpp::base::DataMatrix::getNcols(), sgpp::base::DataMatrix::getNrows(), getSample(), python.statsfileInfo::i, and sgpp::base::DataMatrix::setRow().

Referenced by sgpp::quadrature::OperationQuadratureMCAdvanced::doQuadrature(), sgpp::quadrature::OperationQuadratureMCAdvanced::doQuadratureFunc(), sgpp::quadrature::OperationQuadratureMCAdvanced::doQuadratureL2Error(), and getSample().

◆ setDimensions()

void sgpp::quadrature::SampleGenerator::setDimensions ( size_t  dimensions)

Sets the number of dimensions for sample generation to the given value.

Parameters
dimensionsnew number of dimensions

References dimensions.

Referenced by getSample().

Member Data Documentation

◆ dimensions

◆ rng

◆ seed

std::uint64_t sgpp::quadrature::SampleGenerator::seed
protected

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