wichmann_hill¶
The wichmann_hill engine is the set of 273 Wichmann-Hill’s combined multiplicative congruential generators from NAG Numerical Libraries [NAG].
Description
The set of 372 different basic pseudorandom number generators wichmann_hill is the second basic generator in the NAG libraries.
Generation algorithm
\(x_n=a_{1, j} x_{n-1} (mod \ m_{1, j})\)
\(y_n = a_{2, j} y_{n-1} (mod \ m_{2, j})\)
\(z_n = a_{3, j} z_{n-1} (mod \ m_{3, j})\)
\(w_n = a_{4, j} w_{n-1} (mod \ m_{4, j})\)
\(u_n = (x_n / m_{1, j} + y_n / m_{2, j} + z_n / m_{3, j} + w_n / m_{4, j}) mod \ 1\)
The constants \(a_{i, j}\) range from 112 to 127, the constants \(m_{i, j}\) are prime numbers ranging from 16718909 to 16776917, close to \(2 ^ {24}\).
class wichmann_hill¶
Syntax
namespace oneapi::mkl::rng {
class wichmann_hill {
public:
static constexpr std::uint32_t default_seed = 1;
wichmann_hill(sycl::queue queue, std::uint32_t seed = default_seed);
wichmann_hill(sycl::queue queue, std::uint32_t seed, std::uint32_t engine_idx);
wichmann_hill(sycl::queue queue, std::initializer_list<std::uint32_t> seed);
wichmann_hill(sycl::queue queue, std::initializer_list<std::uint32_t> seed, std::uint32_t engine_idx);
wichmann_hill(const wichmann_hill& other);
wichmann_hill(wichmann_hill&& other);
wichmann_hill& operator=(const wichmann_hill& other);
wichmann_hill& operator=(wichmann_hill&& other);
~wichmann_hill();
};
}
Class Members
Routine |
Description |
---|---|
wichmann_hill(sycl::queue queue, std::uint32_t seed = default_seed) |
Constructor for common seed initialization of the engine (for this case multiple generators of the set would be used) |
wichmann_hill(sycl::queue queue, std::uint32_t seed, std::uint32_t engine_idx) |
Constructor for common seed initialization of the engine (for this case single generator of the set would be used) |
wichmann_hill(sycl::queue& queue, std::initializer_list<std::uint32_t> seed) |
Constructor for extended seed initialization of the engine (for this case multiple generators of the set would be used) |
Constructor for extended seed initialization of the engine (for this case single generator of the set would be used) |
|
Copy constructor |
|
Move constructor |
|
Copy assignment operator |
|
Move assignment operator |
Constructors
wichmann_hill::wichmann_hill(sycl::queue queue, std::uint32_t seed = default_seed)
Input Parameters
- queue
Valid
sycl::queue
object, calls of the oneapi::mkl::rng::generate() routine submits kernels in this queue to obtain random numbers from a given engine.- seed
The initial conditions of the generator state. Assume \(x_0=seed \ mod \ m_1, y_0 = z_0 = w_0 = 1\). If \(x_0 = 0\), assume \(x_0 = 1\).
wichmann_hill::wichmann_hill(sycl::queue queue, std::uint32_t seed, std::uint32_t engine_idx)
Input Parameters
- queue
Valid
sycl::queue
object, calls of the oneapi::mkl::rng::generate() routine submits kernels in this queue to obtain random numbers from a given engine.- seed
The initial conditions of the generator state. Assume \(x_0=seed \ mod \ m_1, y_0 = z_0 = w_0 = 1\). If \(x_0 = 0\), assume \(x_0 = 1\).
- engine_idx
The index of the set 1, …, 273.
Throws
- oneapi::mkl::invalid_argument
Exception is thrown when \(idx > 273\)
wichmann_hill::wichmann_hill(sycl::queue& queue, std::initializer_list<std::uint32_t> seed)
Input Parameters
- queue
Valid
sycl::queue
object, calls of the oneapi::mkl::rng::generate() routine submits kernels in this queue to obtain random numbers from a given engine.- seed
The initial conditions of the generator state, assume: if \(n = 0: x_{0} = y_{0} = z_{0} = w_{0} = 1\)
if \(n = 1: x_{0} = seed[0] \ mod \ m_1, y_{0} = z_{0} = w_{0} = 1\). If \(x_0 = 0\), assume \(x_0 = 1\).
if \(n = 2: x_{0} = seed[0] \ mod \ m_1, y_{0} = seed[1] \ mod \ m_2, z_{0} = w_{0} = 1\).
if \(n = 3: x_{0} = seed[0] \ mod \ m_1, y_{0} = seed[1] \ mod \ m_2, z_{0} = seed[2] \ mod \ m_3, w_{0} = 1\).
if \(n \geqslant 4: x_{0} = seed[0] \ mod \ m_1, y_{0} = seed[1] \ mod \ m_2\)
\(z_{0} = seed[2] \ mod \ m_3, w_{0} = seed[3] \ mod \ m_4\).
wichmann_hill::wichmann_hill(sycl::queue& queue, std::initializer_list<std::uint32_t> seed, std::uint32_t engine_idx)
Input Parameters
- queue
Valid
sycl::queue
object, calls of the oneapi::mkl::rng::generate() routine submits kernels in this queue to obtain random numbers from a given engine.- seed
The initial conditions of the generator state, assume: if \(n = 0: x_{0} = y_{0} = z_{0} = w_{0} = 1\)
if \(n = 1: x_{0} = seed[0] \ mod \ m_1, y_{0} = z_{0} = w_{0} = 1\). If \(x_0 = 0\), assume \(x_0 = 1\).
if \(n = 2: x_{0} = seed[0] \ mod \ m_1, y_{0} = seed[1] \ mod \ m_2, z_{0} = w_{0} = 1\).
if \(n = 3: x_{0} = seed[0] \ mod \ m_1, y_{0} = seed[1] \ mod \ m_2, z_{0} = seed[2] \ mod \ m_3, w_{0} = 1\).
if \(n \geqslant 4: x_{0} = seed[0] \ mod \ m_1, y_{0} = seed[1] \ mod \ m_2\)
\(z_{0} = seed[2] \ mod \ m_3, w_{0} = seed[3] \ mod \ m_4\).
- engine_idx
The index of the set 1, …, 273.
wichmann_hill::wichmann_hill(const wichmann_hill& other)
Input Parameters
- other
Valid
wichmann_hill
object. Thequeue
and state of the other engine is copied and applied to the current engine.
wichmann_hill::wichmann_hill(wichmann_hill&& other)
Input Parameters
- other
Valid
wichmann_hill
object. Thequeue
and state of the other engine is moved to the current engine.
wichmann_hill::wichmann_hill& operator=(const wichmann_hill& other)
Input Parameters
- other
Valid
wichmann_hill
object. Thequeue
and state of the other engine is copied and applied to the current engine.
wichmann_hill::wichmann_hill& operator=(wichmann_hill&& other)
Input Parameters
- other
Valid
wichmann_hill
r-value object. Thequeue
and state of the other engine is moved to the current engine.
Parent topic: Engines (Basic Random Number Generators)