Aikido
aikido::common::VanDerCorput Class Reference

Generator for the Van der Corput sequence, a low-discripancy sequence defined over a real interval. More...

#include <aikido/common/VanDerCorput.hpp>

Classes

class  const_iterator
 

Public Member Functions

 VanDerCorput (double span=1.0, bool includeStartpoint=false, bool includeEndpoint=false, double minResolution=0.0)
 Construts the Van der Corput sequence over an interval of length span that terminates when the maximum gap between samples is less than minResolution. More...
 
const_iterator begin () const
 Returns an iterator to the first element of the sequence. More...
 
const_iterator end () const
 Returns an iterator to the element following the last element of the sequence. More...
 
std::pair< double, double > operator[] (int n) const
 Returns the n-th element of the sequence (first element in the pair) and the current resolution (second element in the pair). More...
 
std::size_t getLength () const
 Returns the total length of sequence. More...
 

Private Member Functions

std::pair< double, double > computeVanDerCorput (int n) const
 

Private Attributes

const double mSpan
 
const bool mIncludeStartpoint
 
const bool mIncludeEndpoint
 
double mMinResolution
 

Static Private Attributes

constexpr static int BASE {2}
 
constexpr static int MAX {std::numeric_limits<int>::max()}
 

Detailed Description

Generator for the Van der Corput sequence, a low-discripancy sequence defined over a real interval.

This sequence can be thought of as performing successive level-order traversals of a binary search tree over the interval

Constructor & Destructor Documentation

◆ VanDerCorput()

aikido::common::VanDerCorput::VanDerCorput ( double  span = 1.0,
bool  includeStartpoint = false,
bool  includeEndpoint = false,
double  minResolution = 0.0 
)

Construts the Van der Corput sequence over an interval of length span that terminates when the maximum gap between samples is less than minResolution.

The sequence may be inclusive or exclusive of its end point; i.e. is an open or closed interval.

Parameters
spanlength of the interval
includeStartpointwhether or not to include the startpoint
includeEndpointwhether or not to include the endpoint
minResolutionresolution at which to terminate

Member Function Documentation

◆ begin()

const_iterator aikido::common::VanDerCorput::begin ( ) const

Returns an iterator to the first element of the sequence.

Returns
iterator to the first element of the sequence

◆ computeVanDerCorput()

std::pair<double, double> aikido::common::VanDerCorput::computeVanDerCorput ( int  n) const
private

◆ end()

const_iterator aikido::common::VanDerCorput::end ( ) const

Returns an iterator to the element following the last element of the sequence.

Returns
iterator followin the last element of the sequence

◆ getLength()

std::size_t aikido::common::VanDerCorput::getLength ( ) const

Returns the total length of sequence.

Returns
Non-negative number of the tatal length of sequence.

◆ operator[]()

std::pair<double, double> aikido::common::VanDerCorput::operator[] ( int  n) const

Returns the n-th element of the sequence (first element in the pair) and the current resolution (second element in the pair).

Resolution is defined to be the maximum gap between samples thus far.

Returns
pair of sample and maximum gap in samples

Member Data Documentation

◆ BASE

constexpr static int aikido::common::VanDerCorput::BASE {2}
staticconstexprprivate

◆ MAX

constexpr static int aikido::common::VanDerCorput::MAX {std::numeric_limits<int>::max()}
staticconstexprprivate

◆ mIncludeEndpoint

const bool aikido::common::VanDerCorput::mIncludeEndpoint
private

◆ mIncludeStartpoint

const bool aikido::common::VanDerCorput::mIncludeStartpoint
private

◆ mMinResolution

double aikido::common::VanDerCorput::mMinResolution
private

◆ mSpan

const double aikido::common::VanDerCorput::mSpan
private