niederreiter

niederreiter#

The niederreiter generator is a 32-bit Gray code-based quasi-random number generator.

Description

According to results of Bratley, Fox and Niederreiter [Bratley92] Niederreiter sequences have the best known theoretical asymptotic properties. The default dimension of quasi-random vectors can vary from 1 to 318 inclusive. It is also allowed to register user-defined parameters (irreducible polynomials).

Generation algorithm

\(x_n=x_{n_1} \oplus v_c\)

\(u_n=x_n / 2 ^ {32}\)

The value \(c\) is the right-most zero bit in \(n-1\); \(x_n\) is s-dimensional vector of 32-bit values. The s-dimensional vectors (calculated during engine initialization) \(v_i, i = 1, 32\) are called direction numbers. The vector \(u_n\) is the generator output normalized to the unit hypercube \((0, 1) ^ s\).

class niederreiter#

Syntax

namespace oneapi::math::rng {
class niederreiter {
public:
    static constexpr std::uint32_t default_dimensions_number = 1;

    niederreiter(sycl::queue queue, std::uint32_t dimensions = default_dimensions_number);

    niederreiter(sycl::queue queue, std::vector<std::uint32_t>& irred_polynomials);

    niederreiter(const niederreiter& other);

    niederreiter(niederreiter&& other);

    niederreiter& operator=(const niederreiter& other);

    niederreiter& operator=(niederreiter&& other);

    ~niederreiter();
};
}

Class Members

Routine

Description

niederreiter(sycl::queue queue, std::uint32_t dimensions = default_dimensions_number)

Constructor with specified number of dimensions. The value should be \(1..318\).

niederreiter(sycl::queue queue, std::vector<std::uint32_t>& irred_polynomials)

Constructor for extended use-case, when it’s needed to use the number of dimensions greater than 318 or obtain another sequence.

niederreiter(const niederreiter& other)

Copy constructor

niederreiter(niederreiter&& other)

Move constructor

niederreiter& operator=(const niederreiter& other)

Copy assignment operator

niederreiter& operator=(niederreiter&& other)

Move assignment operator

Constructors

niederreiter::niederreiter(sycl::queue queue, std::uint32_t dimensions = default_dimensions_number)

Input Parameters

queue

Valid sycl::queue object, calls of the oneapi::math::rng::generate() routine submits kernels in this queue to obtain random numbers from a given engine.

dimensions

Number of dimensions. If \(dimen < 1\) or \(dimen > 318\), assume \(dimen = 1\).

niederreiter::niederreiter(sycl::queue queue, std::vector<std::uint32_t>& irred_polynomials)

Input Parameters

queue

Valid sycl::queue object, calls of the oneapi::math::rng::generate() routine submits kernels in this queue to obtain random numbers from a given engine.

irred_polynomials

If you want to generate quasi-random vectors of greater dimension or obtain another sequence, you can register a set of your own irreducible polynomials. The number of dimensions corresponds to the length of the vector.

niederreiter::niederreiter(const niederreiter& other)

Input Parameters

other

Valid niederreiter object. The queue and state of the other engine is copied and applied to the current engine.

niederreiter::niederreiter(niederreiter&& other)

Input Parameters

other

Valid niederreiter object. The queue and state of the other engine is moved to the current engine.

niederreiter::niederreiter& operator=(const niederreiter& other)

Input Parameters

other

Valid niederreiter object. The queue and state of the other engine is copied and applied to the current engine.

niederreiter::niederreiter& operator=(niederreiter&& other)

Input Parameters

other

Valid niederreiter r-value object. The queue and state of the other engine is moved to the current engine.

Parent topic: Host Engines (Basic Random Number Generators)