#include <lds/lds.hpp>
VdCorput class
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 VdCorput() -> constexpr
- Construct a new VdCorput object.
- auto pop() -> double -> constexpr auto
- Generate the next value in the van der Corput sequence.
- auto peek() -> double -> constexpr auto
- Peek at the next value without advancing state.
- auto skip(unsigned long n) -> void -> constexpr auto
- Skip n values in the sequence.
- auto reseed(const unsigned long& seed) -> void -> constexpr auto
- reseed
- auto get_index() const -> unsigned long -> constexpr auto
- Get current index.
- auto begin() -> GeneratorIterator< VdCorput, double > -> constexpr auto
- Get iterator to beginning.
- auto end() const -> GeneratorIterator< VdCorput, double > -> constexpr auto
- Get iterator to end (infinite sequence)
- auto operator=(VdCorput&&) -> VdCorput& deleted noexcept
Function documentation
constexpr auto lds:: VdCorput<Base>:: 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.
constexpr auto lds:: VdCorput<Base>:: 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.