ldsgen::HaltonN class

Halton(n) sequence generator.

The HaltonN class is a sequence generator that generates points in a N-dimensional space using the Halton sequence. The Halton sequence is a low-discrepancy sequence that is commonly used in quasi-Monte Carlo methods. It is generated by iterating over two different bases and calculating the fractional parts of the numbers in those bases. The HaltonN class keeps track of the current count and bases, and provides a pop() method that returns the next point in the sequence as a std::vector<double>.

Constructors, destructors, conversion operators

HaltonN(const vector<size_t>& base) explicit
Construct a new Halton N object.

Public functions

auto pop() -> vector< double > -> auto
pop
auto reseed(size_t seed) -> void -> auto
reseed

Function documentation

ldsgen::HaltonN::HaltonN(const vector<size_t>& base) explicit

Construct a new Halton N object.

Parameters
base in

The HaltonN(const vector<size_t> &base) is a constructor for the HaltonN class. It takes one parameter base, which is used as the bases for generating the HaltonN sequence. The explicit keyword indicates that this constructor can only be used for explicit construction and not for implicit conversions.

auto ldsgen::HaltonN::pop() -> vector< double >

pop

Returns vector<double>

The pop() function is used to generate the next value in the sequence. In the VdCorput class, pop() increments the count and calculates the Van der Corput sequence value for that count and base. In the HaltonN class, pop() returns the next point in the Halton sequence as a std::vector<double>. Similarly, in the Circle class, pop() returns the next point on the unit circle as a std::array<double, 2>. In the Sphere class, pop() returns the next point on the unit sphere as a std::array<double, 3>. And in the Sphere3Hopf class, pop() returns the next point on the 3-sphere using the Hopf fibration as a std::array<double, 4>.

auto ldsgen::HaltonN::reseed(size_t seed) -> void

reseed

Parameters
seed in

The reseed(size_t seed) function is used to reset the state of the sequence generator to a specific seed value. This allows the sequence generator to start generating the sequence from the beginning, or from a specific point in the sequence, depending on the value of the seed.