Vulpes  0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
Loading...
Searching...
No Matches
vulpes::random Namespace Reference

Namespaces

namespace  internal

Functions

template<std::size_t M>
std::vector< std::array< double, M > > additiveRecurrence (std::size_t n0, std::size_t n1)
 Generates a sequence of points using an additive recurrence formula.

Function Documentation

◆ additiveRecurrence()

template<std::size_t M>
std::vector< std::array< double, M > > vulpes::random::additiveRecurrence ( std::size_t n0,
std::size_t n1 )

Generates a sequence of points using an additive recurrence formula.

Template Parameters
MThe dimension of each point in the generated sequence.
Parameters
n0The starting index for the sequence.
n1The ending index (exclusive) for the sequence.
Returns
A vector of points, where each point is represented as an array of size M.

The function generates a sequence of points using an additive recurrence formula, based on the reciprocal of \( \phi_m \), the root of the equation \( x^{m+1} = x + 1 \).

For each dimension \( m \), the recurrence formula is:

\[\text{pt}[m] = \text{fmod}(0.5 + \phi_m^{-1} \cdot i, 1.0) \]

where \( i \) is the sequence index and \( \phi_m^{-1} \) is the inverse of \( \phi_m \).

See: https://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/

Note
If \( M \) is large, the computation of \( \phi_m^{-1} \) may become inaccurate as \( \phi \) approaches 1.