|
LdsGen 1.2.6
|
Van der Corput sequence generator. More...
#include <lds.hpp>
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) | |
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) * ... *
|
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.
| [in] | base | the base of the Van der Corput sequence |
|
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 \).
| [in] | n | The sequence index. |