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

Private Member Functions

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

Private Attributes

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

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. More...
 
void cacheNextPoint (const std::vector< double > &nextPoint)
 Cache the while point in one go. More...
 
virtual void generateNextPoint ()=0
 Generate the next point. Override this in you concrete implementation. More...
 
std::vector< double > & getNextPointCache ()
 Some generators need direct access to the cache. More...
 

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 73 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.

Returns the next number in the sequence.

Returns
A double giving the next number in the Sobol sequence for the current dimension

Implements Mantid::Kernel::NDRandomNumberGenerator.

Definition at line 32 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 40 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 47 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 43 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 59 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: