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

Halton sequence generator. More...

#include <lds.hpp>

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

Public Member Functions

 Halton (const unsigned long base0, const unsigned long base1)
 Construct a new Halton object.
 
auto value_at (unsigned long n) const -> std::array< double, 2 >
 Evaluate the 2D Halton point at a given index (pure, no state change)
 
- Public Member Functions inherited from ldsgen::GeneratorIterable< Halton, std::array< double, 2 > >
auto begin () -> GeneratorIterator< Halton, std::array< double, 2 > >
 Get iterator to beginning.
 
auto end () const -> GeneratorIterator< Halton, std::array< double, 2 > >
 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

Halton sequence generator.

The Halton class is a sequence generator that generates points in a 2-dimensional space using the Halton sequence. The Halton sequence is a low-discrepancy sequence that is commonly used in quasi-Monte Carlo methods. It is generated by iterating over two different bases and calculating the fractional parts of the numbers in those bases. The Halton class keeps track of the current count and bases, and provides a pop() method that returns the next point in the sequence as a std::array<double, 2>.

*     Halton(2,3) sequence:
*     pop() -> (0.5, 0.333)  (VdC(2) -> 0.5, VdC(3) -> 0.333)
*     pop() -> (0.25, 0.666) (VdC(2) -> 0.25, VdC(3) -> 0.666)
*     pop() -> (0.75, 0.111) (VdC(2) -> 0.75, VdC(3) -> 0.111)
*     ...
* 

Constructor & Destructor Documentation

◆ Halton()

ldsgen::Halton::Halton ( const unsigned long  base0,
const unsigned long  base1 
)
inline

Construct a new Halton object.

Constructs a Halton sequence generator with the specified bases for the two dimensions.

Parameters
[in]base0the base for the first dimension
[in]base1the base for the second dimension

Member Function Documentation

◆ value_at()

auto ldsgen::Halton::value_at ( unsigned long  n) const -> std::array<double, 2>
inline

Evaluate the 2D Halton point at a given index (pure, no state change)

\( H(n) = \bigl(\phi_{b_0}(n),\; \phi_{b_1}(n)\bigr) \)

Parameters
[in]nThe sequence index.
Returns
The 2D Halton point for index n.

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