ldsgen::Disk class

Disk sequence generator.

The Disk class is a sequence generator that generates points in a 2-dimensional space using the Disk sequence. The Disk 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 Disk 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>.

*     Unit Disk:
*         *****
*      ***     ***
*    **         **
*   *             *
*   *             *  More evenly
*   *             *  distributed
*    **         **   than random
*      ***     ***
*         *****
* 

Constructors, destructors, conversion operators

Disk(const unsigned long base0, const unsigned long base1)
Construct a new Disk object.

Public functions

auto pop() -> std::array< double, 2 > -> auto
Generate the next point in the unit disk.
auto peek() -> std::array< double, 2 > -> auto
Peek at the next value without advancing state.
auto skip(unsigned int n) -> void -> auto
Skip n values in the sequence.
auto reseed(const unsigned long& seed) -> void -> auto
Reset the state of the Disk sequence generator.
auto get_index() const -> unsigned long -> auto
Get current index.
auto begin() -> GeneratorIterator< Disk, std::array< double, 2 > > -> auto
Get iterator to beginning.
auto end() const -> GeneratorIterator< Disk, std::array< double, 2 > > -> auto
Get iterator to end (infinite sequence)

Function documentation

ldsgen::Disk::Disk(const unsigned long base0, const unsigned long base1)

Construct a new Disk object.

Parameters
base0 in the base for the first dimension (angle)
base1 in the base for the second dimension (radius)

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

auto ldsgen::Disk::pop() -> std::array< double, 2 >

Generate the next point in the unit disk.

Returns std::array<double, 2> the next point in the unit disk

Returns the next point in the unit disk as an array of two double values.

auto ldsgen::Disk::peek() -> std::array< double, 2 >

Peek at the next value without advancing state.

Returns std::array<double, 2> next point in the disk

auto ldsgen::Disk::skip(unsigned int n) -> void

Skip n values in the sequence.

Parameters
in number of values to skip

auto ldsgen::Disk::reseed(const unsigned long& seed) -> void

Reset the state of the Disk sequence generator.

Parameters
seed in the seed value to reset the sequence generator to

Resets the state of the sequence generator to a specific seed value.

auto ldsgen::Disk::get_index() const -> unsigned long

Get current index.

Returns unsigned long current index in sequence

auto ldsgen::Disk::begin() -> GeneratorIterator< Disk, std::array< double, 2 > >

Get iterator to beginning.

Returns GeneratorIterator<Disk, std::array<double, 2>>

auto ldsgen::Disk::end() const -> GeneratorIterator< Disk, std::array< double, 2 > >

Get iterator to end (infinite sequence)

Returns GeneratorIterator<Disk, std::array<double, 2>>