VdCorput class
#include <ldsgen/lds.hpp>
Van der Corput sequence generator.
VdCorput is a class that generates the Van der Corput sequence. The Van der Corput sequence is a low-discrepancy sequence that is commonly used in quasi-Monte Carlo methods. The sequence is generated by iterating over a base and calculating the fractional part of the number in that base. The VdCorput class keeps track of the current count and base, and provides a pop() method that returns the next value in the sequence.
* VdCorput(2) sequence: * pop() -> 0.5 (0.1 base 2) * pop() -> 0.25 (0.01 base 2) * pop() -> 0.75 (0.11 base 2) * pop() -> 0.125 (0.001 base 2) * ... *
Constructors, destructors, conversion operators
Public functions
- auto pop() -> double -> auto
- Generate the next value in the Van der Corput sequence.
- auto peek() -> double -> auto
- Peek at the next value without advancing state.
- auto skip(unsigned int n) -> void -> auto
- Skip n values in the sequence.
- auto reseed(const unsigned long& seed) -> void -> auto
- reseed
- auto get_index() const -> unsigned long -> auto
- Get current index.
- auto begin() -> GeneratorIterator< VdCorput, double > -> auto
- Get iterator to beginning.
- auto end() const -> GeneratorIterator< VdCorput, double > -> auto
- Get iterator to end (infinite sequence)
- auto operator=(VdCorput&&) -> VdCorput& deleted noexcept
Function documentation
ldsgen:: VdCorput:: VdCorput(const unsigned long base) explicit
Construct a new VdCorput object.
| Parameters | |
|---|---|
| base in | the base of the Van der Corput sequence |
The VdCorput(unsigned long base) constructor is initializing a VdCorput object with a given base. The base is used to generate the Van der Corput sequence.
auto ldsgen:: VdCorput:: pop() -> double
Generate the next value in the Van der Corput sequence.
| Returns | double the next value in the sequence |
|---|
Generates the next value in the Van der Corput sequence by incrementing the count and calculating the Van der Corput sequence value for that count and base.
auto ldsgen:: VdCorput:: peek() -> double
Peek at the next value without advancing state.
| Returns | double the next value in the sequence |
|---|
auto ldsgen:: VdCorput:: skip(unsigned int n) -> void
Skip n values in the sequence.
| Parameters | |
|---|---|
| n in | number of values to skip |
auto ldsgen:: VdCorput:: reseed(const unsigned long& seed) -> void
reseed
| Parameters | |
|---|---|
| seed in | the seed value to reset the sequence generator to |
The reseed(unsigned long 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.
auto ldsgen:: VdCorput:: get_index() const -> unsigned long
Get current index.
| Returns | unsigned long current index in the sequence |
|---|
auto ldsgen:: VdCorput:: begin() -> GeneratorIterator< VdCorput, double >
Get iterator to beginning.
| Returns | GeneratorIterator<VdCorput, double> |
|---|