Mantid
Loading...
Searching...
No Matches
NDRandomNumberGenerator.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7//
8// Includes
9//
11#include <cassert>
12
13namespace Mantid::Kernel {
17NDRandomNumberGenerator::NDRandomNumberGenerator(const unsigned int ndims) : m_ndims(ndims), m_nextPoint(ndims, 0.0) {}
18
23const std::vector<double> &NDRandomNumberGenerator::nextPoint() {
24 this->generateNextPoint();
25 return m_nextPoint;
26}
27
35 assert(index < m_ndims);
37}
38
45void NDRandomNumberGenerator::cacheNextPoint(const std::vector<double> &nextPoint) {
46 assert(nextPoint.size() == m_ndims);
48}
49} // namespace Mantid::Kernel
double value
The value of the point.
Definition: FitMW.cpp:51
std::map< DeltaEMode::Type, std::string > index
Definition: DeltaEMode.cpp:19
void cacheNextPoint(const std::vector< double > &nextPoint)
Cache the while point in one go.
const std::vector< double > & nextPoint()
Generate the next set of values that form a point in ND space.
const unsigned int m_ndims
The number of dimensions.
NDRandomNumberGenerator()=delete
Disable default constructor.
virtual void generateNextPoint()=0
Generate the next point. Override this in you concrete implementation.
std::vector< double > m_nextPoint
Storage the next point to return.
void cacheGeneratedValue(const size_t index, const double value)
Cache a value for a given dimension index, i.e. 0->ND-1.