class
#include <ldsgen/lds.hpp>
Halton Halton sequence generator.
The Halton
class is a sequence generator that generates points in a 2-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 Halton
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::array<double, 2>
.
Public functions
- auto Halton(size_t base0, size_t base1) -> CONSTEXPR14
- Construct a new Halton object.
- auto pop() -> std::array< double, 2 > -> CONSTEXPR14 auto
- pop
- auto reseed(size_t seed) -> void -> CONSTEXPR14 auto
- reseed
Function documentation
CONSTEXPR14 ldsgen:: Halton:: Halton(size_t base0,
size_t base1)
Construct a new Halton object.
Parameters | |
---|---|
base0 in | |
base1 in |
The Halton(const size_
is a constructor for the Halton
class. It takes two parameters base0
and base1
, which are used as the bases for generating the Halton sequence. The CONSTEXPR14
keyword indicates that the constructor is constexpr, meaning it can be evaluated at compile-time if possible.
CONSTEXPR14 auto ldsgen:: Halton:: pop() -> std::array< double, 2 >
pop
Returns | std::array<double, 2> |
---|
The pop()
function is used to generate the next value in the sequence. For example, in the VdCorput
class, pop()
increments the count and calculates the Van der Corput sequence value for that count and base. In the Halton
class, pop()
returns the next point in the Halton sequence as a std::array<double, 2>
. 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>
.
CONSTEXPR14 auto ldsgen:: Halton:: reseed(size_t seed) -> void
reseed
Parameters | |
---|---|
seed in |
The reseed(size_
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.