Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::Kernel::SobolSequence Class Reference

Defines a generator that produces quasi-random numbers according to a Sobol sequence http://en.wikipedia.org/wiki/Sobol_sequence. More...

#include <SobolSequence.h>

Inheritance diagram for Mantid::Kernel::SobolSequence:
Mantid::Kernel::QuasiRandomNumberSequence Mantid::Kernel::NDRandomNumberGenerator

Public Member Functions

void generateNextPoint () override
 Generates the next value in the sequence.
 
SobolSequenceoperator= (const SobolSequence &)=delete
 Disable assignment operator.
 
void restart () override
 Reset the sequence.
 
void restore () override
 Restores the generator to the last saved point, or the beginning if nothing has been saved.
 
void save () override
 Saves the current state of the generator.
 
 SobolSequence ()=delete
 Disable default constructor.
 
 SobolSequence (const SobolSequence &)=delete
 Disable copy operator.
 
 SobolSequence (const unsigned int ndims)
 Constructor taking the number of dimensions.
 
 ~SobolSequence () override
 Destructor.
 
- Public Member Functions inherited from Mantid::Kernel::QuasiRandomNumberSequence
 QuasiRandomNumberSequence (const unsigned int ndims)
 
- Public Member Functions inherited from Mantid::Kernel::NDRandomNumberGenerator
 NDRandomNumberGenerator ()=delete
 Disable default constructor.
 
 NDRandomNumberGenerator (const NDRandomNumberGenerator &)=delete
 Disable copy operator.
 
 NDRandomNumberGenerator (const unsigned int ndims)
 Constructor.
 
const std::vector< double > & nextPoint ()
 Generate the next set of values that form a point in ND space.
 
unsigned int numberOfDimensions () const
 Returns the number of dimensions the point will be generated in, i.e.
 
NDRandomNumberGeneratoroperator= (const NDRandomNumberGenerator &)=delete
 Disable assignment operator.
 
virtual ~NDRandomNumberGenerator ()=default
 Virtual destructor to ensure that all inheriting classes have one.
 

Private Member Functions

void deleteCurrentGenerator ()
 Frees resources allocated by current generator.
 
void setNumberOfDimensions (const unsigned int ndims)
 Set the number of dimensions.
 

Private Attributes

gsl_qrng * m_gslGenerator
 GSL quasi-random number state generator.
 
gsl_qrng * m_savedGenerator
 Allocated object for save state calls.
 

Additional Inherited Members

- Protected Member Functions inherited from Mantid::Kernel::NDRandomNumberGenerator
void cacheGeneratedValue (const size_t index, const double value)
 Cache a value for a given dimension index, i.e. 0->ND-1.
 
void cacheNextPoint (const std::vector< double > &nextPoint)
 Cache the while point in one go.
 
std::vector< double > & getNextPointCache ()
 Some generators need direct access to the cache.
 

Detailed Description

Defines a generator that produces quasi-random numbers according to a Sobol sequence http://en.wikipedia.org/wiki/Sobol_sequence.

Definition at line 26 of file SobolSequence.h.

Constructor & Destructor Documentation

◆ SobolSequence() [1/3]

Mantid::Kernel::SobolSequence::SobolSequence ( const unsigned int  ndims)
explicit

Constructor taking the number of dimensions.

Constructor taking the number of dimensions for the sequence.

Definition at line 17 of file SobolSequence.cpp.

References setNumberOfDimensions().

◆ ~SobolSequence()

Mantid::Kernel::SobolSequence::~SobolSequence ( )
override

Destructor.

Definition at line 25 of file SobolSequence.cpp.

References deleteCurrentGenerator().

◆ SobolSequence() [2/3]

Mantid::Kernel::SobolSequence::SobolSequence ( )
delete

Disable default constructor.

◆ SobolSequence() [3/3]

Mantid::Kernel::SobolSequence::SobolSequence ( const SobolSequence )
delete

Disable copy operator.

Member Function Documentation

◆ deleteCurrentGenerator()

void Mantid::Kernel::SobolSequence::deleteCurrentGenerator ( )
private

Frees resources allocated by current generator.

Definition at line 71 of file SobolSequence.cpp.

References m_gslGenerator, and m_savedGenerator.

Referenced by setNumberOfDimensions(), and ~SobolSequence().

◆ generateNextPoint()

void Mantid::Kernel::SobolSequence::generateNextPoint ( )
overridevirtual

Generates the next value in the sequence.

Generates the next point in the sequence.

Implements Mantid::Kernel::NDRandomNumberGenerator.

Definition at line 30 of file SobolSequence.cpp.

References Mantid::Kernel::NDRandomNumberGenerator::getNextPointCache(), and m_gslGenerator.

◆ operator=()

SobolSequence & Mantid::Kernel::SobolSequence::operator= ( const SobolSequence )
delete

Disable assignment operator.

◆ restart()

void Mantid::Kernel::SobolSequence::restart ( )
overridevirtual

Reset the sequence.

Reset state back to the start of the sequence.

Implements Mantid::Kernel::NDRandomNumberGenerator.

Definition at line 38 of file SobolSequence.cpp.

References m_gslGenerator.

Referenced by restore().

◆ restore()

void Mantid::Kernel::SobolSequence::restore ( )
overridevirtual

Restores the generator to the last saved point, or the beginning if nothing has been saved.

Implements Mantid::Kernel::NDRandomNumberGenerator.

Definition at line 45 of file SobolSequence.cpp.

References m_gslGenerator, m_savedGenerator, and restart().

◆ save()

void Mantid::Kernel::SobolSequence::save ( )
overridevirtual

Saves the current state of the generator.

Implements Mantid::Kernel::NDRandomNumberGenerator.

Definition at line 41 of file SobolSequence.cpp.

References m_gslGenerator, and m_savedGenerator.

◆ setNumberOfDimensions()

void Mantid::Kernel::SobolSequence::setNumberOfDimensions ( const unsigned int  ndims)
private

Set the number of dimensions.

Sets the number of dimensions for the generator.

Note this destroys any previous state information including any saved state

Definition at line 57 of file SobolSequence.cpp.

References deleteCurrentGenerator(), and m_gslGenerator.

Referenced by SobolSequence().

Member Data Documentation

◆ m_gslGenerator

gsl_qrng* Mantid::Kernel::SobolSequence::m_gslGenerator
private

GSL quasi-random number state generator.

Definition at line 59 of file SobolSequence.h.

Referenced by deleteCurrentGenerator(), generateNextPoint(), restart(), restore(), save(), and setNumberOfDimensions().

◆ m_savedGenerator

gsl_qrng* Mantid::Kernel::SobolSequence::m_savedGenerator
private

Allocated object for save state calls.

Definition at line 61 of file SobolSequence.h.

Referenced by deleteCurrentGenerator(), restore(), and save().


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