Mantid
|
Defines an ND pseudo-random number generator. More...
#include <NDPseudoRandomNumberGenerator.h>
Public Member Functions | |
void | generateNextPoint () override |
Generates the next ND point. More... | |
NDPseudoRandomNumberGenerator ()=delete | |
Disable default constructor. More... | |
NDPseudoRandomNumberGenerator (const NDPseudoRandomNumberGenerator &)=delete | |
Disable copy operator. More... | |
NDPseudoRandomNumberGenerator (const unsigned int ndims, const size_t seedValue) | |
Constructor. More... | |
NDPseudoRandomNumberGenerator (const unsigned int ndims, const size_t seedValue, const double start, const double end) | |
Constructor taking a range to limit the each evaluation. More... | |
NDPseudoRandomNumberGenerator & | operator= (const NDPseudoRandomNumberGenerator &)=delete |
Disable assignment operator. More... | |
void | restart () override |
Resets the generator. 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... | |
void | setSeed (const size_t seedValue) |
Set the random number seed. More... | |
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... | |
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... | |
Private Attributes | |
SingleValueGenerator | m_singleValueGen |
The single value generator. 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... | |
Defines an ND pseudo-random number generator.
This uses a single 1D pseudo-random number generator, given by the template type, to produce ND random values. It supports settings a seed value plus a range for each generated value.
Definition at line 29 of file NDPseudoRandomNumberGenerator.h.
Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >::NDPseudoRandomNumberGenerator | ( | const unsigned int | ndims, |
const size_t | seedValue | ||
) |
Constructor.
Constructor taking the number of dimensions and seed The template argument should be the type of a 1DPseudoRandomNumberGenerator and have a constructor that takes a single value as the seed The single value generator is called ndims times for each call to nextPoint.
ndims | :: The number of dimensions the point should return |
seedValue | :: A seed value |
Definition at line 75 of file NDPseudoRandomNumberGenerator.h.
Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >::NDPseudoRandomNumberGenerator | ( | const unsigned int | ndims, |
const size_t | seedValue, | ||
const double | start, | ||
const double | end | ||
) |
Constructor taking a range to limit the each evaluation.
Constructor taking the number of dimensions, seed and a range.
The template argument should be the type of a 1DPseudoRandomNumberGenerator and have a constructor that takes a three values. A seed & two doubles for the start & end range The single value generator is called ndims times for each call to nextPoint
ndims | :: The number of dimensions the point should return |
seedValue | :: A seed value |
start | :: The lower value for the range of generated numbers |
end | :: The upper value for the range of generated numbers |
Definition at line 91 of file NDPseudoRandomNumberGenerator.h.
|
delete |
Disable default constructor.
|
delete |
Disable copy operator.
|
overridevirtual |
Generates the next ND point.
Generates the next point.
Implements Mantid::Kernel::NDRandomNumberGenerator.
Definition at line 106 of file NDPseudoRandomNumberGenerator.h.
|
delete |
Disable assignment operator.
|
overridevirtual |
Resets the generator.
Resets the underlying generator.
Implements Mantid::Kernel::NDRandomNumberGenerator.
Definition at line 115 of file NDPseudoRandomNumberGenerator.h.
|
overridevirtual |
Restores the generator to the last saved point, or the beginning if nothing has been saved.
Implements Mantid::Kernel::NDRandomNumberGenerator.
Definition at line 126 of file NDPseudoRandomNumberGenerator.h.
|
overridevirtual |
Saves the current state of the generator.
Implements Mantid::Kernel::NDRandomNumberGenerator.
Definition at line 120 of file NDPseudoRandomNumberGenerator.h.
void Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >::setSeed | ( | const size_t | seedValue | ) |
Set the random number seed.
seedValue | :: (Re-)seed the generator |
Definition at line 101 of file NDPseudoRandomNumberGenerator.h.
|
private |
The single value generator.
Definition at line 59 of file NDPseudoRandomNumberGenerator.h.