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

Halton(n) sequence generator. More...

#include <lds_n.hpp>

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

Public Member Functions

 HaltonN (const vector< unsigned long > &base)
 Construct a new Halton N object.
 
auto value_at (unsigned long n) const -> vector< double >
 Evaluate the N-dimensional Halton point at a given index (pure, no state change)
 
- Public Member Functions inherited from ldsgen::GeneratorBase< HaltonN, vector< double > >
auto pop () -> vector< double >
 Generate the next value in the sequence (advances state).
 
auto peek () -> vector< double >
 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< HaltonN, vector< double > >
std::atomic< unsigned long > count_
 Current sequence index (single source of state)
 

Detailed Description

Halton(n) sequence generator.

The HaltonN class is a sequence generator that generates points in a N-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 HaltonN 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::vector<double>.

*     HaltonN([2,3,5]) sequence (3D):
*     pop() -> [0.5, 0.333, 0.2]    (VdC bases [2,3,5])
*     pop() -> [0.25, 0.666, 0.4]   (next in each sequence)
*     pop() -> [0.75, 0.111, 0.6]   (etc...)
*     ...
* 

Constructor & Destructor Documentation

◆ HaltonN()

ldsgen::HaltonN::HaltonN ( const vector< unsigned long > &  base)
inlineexplicit

Construct a new Halton N object.

Constructs an N-dimensional Halton sequence generator with the specified bases.

Parameters
[in]basevector of unsigned long values representing the bases for each dimension

Member Function Documentation

◆ value_at()

auto ldsgen::HaltonN::value_at ( unsigned long  n) const -> vector<double>
inline

Evaluate the N-dimensional Halton point at a given index (pure, no state change)

\[ H(n) = (\phi_{b_1}(n), \phi_{b_2}(n), \dots, \phi_{b_N}(n)) \]

Parameters
[in]nThe sequence index.
Returns
vector<double> the N-dimensional Halton point for index n.

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