OpenQMC API
Loading...
Searching...
No Matches
rank1.h File Reference
#include "gpu.h"
#include "pcg.h"
#include "permute.h"
#include <cassert>
#include <cstdint>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

constexpr std::uint32_t oqmc::rotate (std::uint32_t value, std::uint32_t distance)
 Rotate an integer a given distance.
 
constexpr std::uint32_t oqmc::latticeReversedIndex (std::uint32_t index, int dimension)
 Compute a rank 1 lattice value at an index with reversed bits.
 
template<int Depth>
constexpr void oqmc::shuffledRotatedLattice (std::uint32_t index, std::uint32_t patternId, std::uint32_t sample[Depth])
 Compute a randomised rank 1 lattice value.
 

Detailed Description

An implementation of a rank 1 lattice as described in 'Weighted Compound Integration Rules with Higher Order Convergence for all N' by Fred J. Hickernell, et al., made progressive with a radical inversion of the sample index.

Function Documentation

◆ rotate()

constexpr std::uint32_t oqmc::rotate ( std::uint32_t  value,
std::uint32_t  distance 
)
constexpr

Given a 32 bit unsigned integer value, offset the value a given distance, and rely on integer overflow for the value to wrap around. When applied to elements in a lattice, this represents a toroidal shift or rotation, upon the range of representable values. When the distance is constant for all elements, this can be used to efficiently randomise the values.

Parameters
[in]valueInteger value to offset.
[in]distanceDistance to offset value.
Returns
Rotated integer value.
Here is the caller graph for this function:

◆ latticeReversedIndex()

constexpr std::uint32_t oqmc::latticeReversedIndex ( std::uint32_t  index,
int  dimension 
)
constexpr

Given a 32 bit index, where the order of bits in the index have been reversed, compute a rank 1 lattice value to 32 bits of precision for a given dimension. Dimensions must be within the range [0, 4).

Parameters
[in]indexBit reversed index of element.
[in]dimensionDimension of rank 1 lattice.
Returns
Rank 1 lattice value.
Here is the caller graph for this function:

◆ shuffledRotatedLattice()

template<int Depth>
constexpr void oqmc::shuffledRotatedLattice ( std::uint32_t  index,
std::uint32_t  patternId,
std::uint32_t  sample[Depth] 
)
constexpr

Given an index and a patternId, compute a rank 1 lattice value. The index will be shuffled in a manner that is progressive friendly. The value can be multi-dimensional. For a given lattice, the patternId value must be constant.

Template Parameters
DepthDimensional space of output, up to 4 dimensions.
Parameters
[in]indexInput index of lattice value.
[in]patternIdSeed to randomise the lattice.
[out]sampleRandomised lattice value.
Here is the caller graph for this function: