LdsGen 1.2.6
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ldsgen::VdCorput Class Reference

Van der Corput sequence generator. More...

#include <lds.hpp>

Inheritance diagram for ldsgen::VdCorput:
[legend]
Collaboration diagram for ldsgen::VdCorput:
[legend]

Public Member Functions

 VdCorput (const unsigned long base)
 Construct a new VdCorput object.
 
auto value_at (unsigned long n) const -> double
 Evaluate the sequence value at a given index (pure, no state change)
 
- Public Member Functions inherited from ldsgen::GeneratorIterable< VdCorput, double >
auto begin () -> GeneratorIterator< VdCorput, double >
 Get iterator to beginning.
 
auto end () const -> GeneratorIterator< VdCorput, double >
 Get iterator to end (infinite sequence)
 
- Public Member Functions inherited from ldsgen::GeneratorBase< Derived, Value >
auto pop () -> Value
 Generate the next value in the sequence (advances state).
 
auto peek () -> Value
 Peek at the next value without advancing state.
 
auto skip (unsigned int n) -> void
 Skip n values in the sequence.
 
auto reseed (const unsigned long &seed) -> void
 Reset the generator to a specific seed value.
 
auto get_index () const -> unsigned long
 Get current index in the sequence.
 

Additional Inherited Members

- Protected Attributes inherited from ldsgen::GeneratorBase< Derived, Value >
std::atomic< unsigned long > count_ {0}
 Current sequence index (single source of state)
 

Detailed Description

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)
*     ...
* 

Constructor & Destructor Documentation

◆ VdCorput()

ldsgen::VdCorput::VdCorput ( const unsigned long  base)
inlineexplicit

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.

Parameters
[in]basethe base of the Van der Corput sequence

Member Function Documentation

◆ value_at()

auto ldsgen::VdCorput::value_at ( unsigned long  n) const -> double
inline

Evaluate the sequence value at a given index (pure, no state change)

Computes the Van der Corput value for index \(n\): \( \phi_b(n) = \sum_{k=0}^{\infty} a_k(n) \, b^{-k-1} \) where \( a_k(n) \) are the base- \( b \) digits of \( n \).

Parameters
[in]nThe sequence index.
Returns
The Van der Corput value for index n.

The documentation for this class was generated from the following file: