#include <lds/lds.hpp>
template<unsigned long Base = 2>
lds::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

VdCorput(VdCorput&&) deleted noexcept

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

template<unsigned long Base>
constexpr lds::VdCorput<Base>::VdCorput()

Construct a new VdCorput object.

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.

template<unsigned long Base>
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.

template<unsigned long Base>
constexpr auto lds::VdCorput<Base>::peek() -> double

Peek at the next value without advancing state.

Returns double the next value in the sequence

template<unsigned long Base>
constexpr auto lds::VdCorput<Base>::skip(unsigned long n) -> void

Skip n values in the sequence.

Parameters
in number of values to skip

template<unsigned long 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.

template<unsigned long Base>
constexpr auto lds::VdCorput<Base>::get_index() const -> unsigned long

Get current index.

Returns unsigned long current index in the sequence

template<unsigned long Base>
constexpr auto lds::VdCorput<Base>::begin() -> GeneratorIterator< VdCorput, double >

Get iterator to beginning.

Returns GeneratorIterator<VdCorput, double>

template<unsigned long Base>
constexpr auto lds::VdCorput<Base>::end() const -> GeneratorIterator< VdCorput, double >

Get iterator to end (infinite sequence)

Returns GeneratorIterator<VdCorput, double>

For infinite sequences, you typically use begin() + n to get a specific position