vSMC
vSMC: Scalable Monte Carlo
Static Public Attributes | List of all members
vsmc::traits::XorshiftEngineTrait< ResultType > Struct Template Reference

Traits of XorshiftEngine. More...

#include <vsmc/rng/xorshift.hpp>

Static Public Attributes

static constexpr const std::size_t max_loop_unroll = 4
 Maximum number of states (e.g., 4 in Xorshift4x64) that an unrolled loop will be used. More...
 

Detailed Description

template<typename ResultType>
struct vsmc::traits::XorshiftEngineTrait< ResultType >

Traits of XorshiftEngine.

Definition at line 87 of file xorshift.hpp.

Member Data Documentation

template<typename ResultType >
constexpr const std::size_t vsmc::traits::XorshiftEngineTrait< ResultType >::max_loop_unroll = 4
static

Maximum number of states (e.g., 4 in Xorshift4x64) that an unrolled loop will be used.

The original implementation of Marsaglia promote each value. That is, e.g., for a state of four integers x, y, z, w, there is a step x = y; y = z; z = w. This can be generalized to the situation of any abitrary number of integers. For the number of integers smaller than or equal to this value, the original implementation will be used, equivalent to

for (std::size_t i = 0; i != n - 1; ++i)
state[i] = state[i + 1];

where n is the number of the integers. The loop will be unrolled at compile time. Otherwise, no loop will be performed. Instead, a circular buffer is implemented through the use of modulo operation.

Definition at line 106 of file xorshift.hpp.