Mantid
|
This class defines an interface for N dimensional random number generators. More...
#include <NDRandomNumberGenerator.h>
Public Member Functions | |
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... | |
NDRandomNumberGenerator & | operator= (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... | |
Protected Member Functions | |
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... | |
Private Attributes | |
const unsigned int | m_ndims |
The number of dimensions. More... | |
std::vector< double > | m_nextPoint |
Storage the next point to return. More... | |
This class defines an interface for N dimensional random number generators.
A call to next produces N points in an ND space
Definition at line 24 of file NDRandomNumberGenerator.h.
Mantid::Kernel::NDRandomNumberGenerator::NDRandomNumberGenerator | ( | const unsigned int | ndims | ) |
|
virtualdefault |
Virtual destructor to ensure that all inheriting classes have one.
|
delete |
Disable default constructor.
|
delete |
Disable copy operator.
|
protected |
Cache a value for a given dimension index, i.e. 0->ND-1.
Cache a value for a given dimension index, i.e.
0->ND-1
index | :: An index for the dimension of the value generated |
value | :: value to be cached |
Definition at line 34 of file NDRandomNumberGenerator.cpp.
References index, m_ndims, m_nextPoint, and value.
Referenced by Mantid::Kernel::PseudoRandomNumberGenerator::generateNextPoint().
|
protected |
Cache the while point in one go.
Cache the next point.
Should be called by the concrete implementation at the end of generateNextPoint Avoids returning the vectors by value and copying.
nextPoint | :: A vector containing the new set of points |
Definition at line 45 of file NDRandomNumberGenerator.cpp.
References m_ndims, m_nextPoint, and nextPoint().
|
protectedpure virtual |
Generate the next point. Override this in you concrete implementation.
Implemented in Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >, Mantid::Kernel::PseudoRandomNumberGenerator, and Mantid::Kernel::SobolSequence.
Referenced by nextPoint().
|
inlineprotected |
Some generators need direct access to the cache.
Definition at line 64 of file NDRandomNumberGenerator.h.
Referenced by Mantid::Kernel::SobolSequence::generateNextPoint().
const std::vector< double > & Mantid::Kernel::NDRandomNumberGenerator::nextPoint | ( | ) |
Generate the next set of values that form a point in ND space.
Definition at line 23 of file NDRandomNumberGenerator.cpp.
References generateNextPoint(), and m_nextPoint.
Referenced by cacheNextPoint().
|
inline |
Returns the number of dimensions the point will be generated in, i.e.
the size of the vector returned from by nextPoint()
Definition at line 43 of file NDRandomNumberGenerator.h.
|
delete |
Disable assignment operator.
|
pure virtual |
Restarts the generator from the beginning of the sequence.
Implemented in Mantid::Kernel::MersenneTwister, Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >, and Mantid::Kernel::SobolSequence.
|
pure virtual |
Restores the generator to the last saved point, or the beginning if nothing has been saved.
Implemented in Mantid::Kernel::MersenneTwister, Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >, and Mantid::Kernel::SobolSequence.
|
pure virtual |
Saves the current state of the generator.
Implemented in Mantid::Kernel::MersenneTwister, Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >, and Mantid::Kernel::SobolSequence.
|
private |
The number of dimensions.
Definition at line 68 of file NDRandomNumberGenerator.h.
Referenced by cacheGeneratedValue(), and cacheNextPoint().
|
private |
Storage the next point to return.
Definition at line 70 of file NDRandomNumberGenerator.h.
Referenced by cacheGeneratedValue(), cacheNextPoint(), and nextPoint().