Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator > Class Template Reference

Defines an ND pseudo-random number generator. More...

#include <NDPseudoRandomNumberGenerator.h>

Inheritance diagram for Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >:
Mantid::Kernel::NDRandomNumberGenerator

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...
 
NDPseudoRandomNumberGeneratoroperator= (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...
 
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 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...
 

Detailed Description

template<typename SingleValueGenerator>
class Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >

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.

Constructor & Destructor Documentation

◆ NDPseudoRandomNumberGenerator() [1/4]

template<typename SingleValueGenerator >
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.

Parameters
ndims:: The number of dimensions the point should return
seedValue:: A seed value

Definition at line 75 of file NDPseudoRandomNumberGenerator.h.

◆ NDPseudoRandomNumberGenerator() [2/4]

template<typename SingleValueGenerator >
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

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

◆ NDPseudoRandomNumberGenerator() [3/4]

template<typename SingleValueGenerator >
Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >::NDPseudoRandomNumberGenerator ( )
delete

Disable default constructor.

◆ NDPseudoRandomNumberGenerator() [4/4]

template<typename SingleValueGenerator >
Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >::NDPseudoRandomNumberGenerator ( const NDPseudoRandomNumberGenerator< SingleValueGenerator > &  )
delete

Disable copy operator.

Member Function Documentation

◆ generateNextPoint()

template<typename SingleValueGenerator >
void Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >::generateNextPoint
overridevirtual

Generates the next ND point.

Generates the next point.

Implements Mantid::Kernel::NDRandomNumberGenerator.

Definition at line 106 of file NDPseudoRandomNumberGenerator.h.

◆ operator=()

template<typename SingleValueGenerator >
NDPseudoRandomNumberGenerator & Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >::operator= ( const NDPseudoRandomNumberGenerator< SingleValueGenerator > &  )
delete

Disable assignment operator.

◆ restart()

template<typename SingleValueGenerator >
void Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >::restart
overridevirtual

Resets the generator.

Resets the underlying generator.

Implements Mantid::Kernel::NDRandomNumberGenerator.

Definition at line 115 of file NDPseudoRandomNumberGenerator.h.

◆ restore()

template<typename SingleValueGenerator >
void Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >::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 126 of file NDPseudoRandomNumberGenerator.h.

◆ save()

template<typename SingleValueGenerator >
void Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >::save
overridevirtual

Saves the current state of the generator.

Implements Mantid::Kernel::NDRandomNumberGenerator.

Definition at line 120 of file NDPseudoRandomNumberGenerator.h.

◆ setSeed()

template<typename SingleValueGenerator >
void Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >::setSeed ( const size_t  seedValue)

Set the random number seed.

Parameters
seedValue:: (Re-)seed the generator

Definition at line 101 of file NDPseudoRandomNumberGenerator.h.

Member Data Documentation

◆ m_singleValueGen

template<typename SingleValueGenerator >
SingleValueGenerator Mantid::Kernel::NDPseudoRandomNumberGenerator< SingleValueGenerator >::m_singleValueGen
private

The single value generator.

Definition at line 59 of file NDPseudoRandomNumberGenerator.h.


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