# sobol¶

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

Description

Bratley and Fox [Bratley88] provide an implementation of the SOBOL quasi-random number generator. The default dimensions of quasi-random vectors can vary from 1 to 40 inclusive. It is also allowed to register user-defined parameters (direction numbers).

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 sobol¶

Syntax

namespace oneapi::mkl::rng {
class sobol {
public:
static constexpr std::uint32_t default_dimensions_number = 1;

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

sobol(sycl::queue queue, std::vector<std::uint32_t>& direction_numbers);

sobol(const sobol& other);

sobol(sobol&& other);

sobol& operator=(const sobol& other);

sobol& operator=(sobol&& other);

~sobol();
};
}


Class Members

Routine

Description

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

Constructor with specified number of dimensions. The value should be $$1..40$$.

sobol(sycl::queue queue, std::vector<std::uint32_t>& direction_numbers)

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

sobol(const sobol& other)

Copy constructor

sobol(sobol&& other)

Move constructor

sobol& operator=(const sobol& other)

Copy assignment operator

sobol& operator=(sobol&& other)

Move assignment operator

Constructors

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


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.

dimensions

Number of dimensions. If $$dimen < 1$$ or $$dimen > 40$$, assume $$dimen = 1$$.

sobol::sobol(sycl::queue queue, std::vector<std::uint32_t>& direction_numbers)


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.

direction_numbers

If you want to generate quasi-random vectors of greater dimension or obtain another sequence, you can register a set of your own direction_numbers. The number of dimensions corresponds to direction_numbers.size() / 32.

sobol::sobol(const sobol& other)


Input Parameters

other

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

sobol::sobol(sobol&& other)


Input Parameters

other

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

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


Input Parameters

other

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

sobol::sobol& operator=(sobol&& other)


Input Parameters

other

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

Parent topic: Engines (Basic Random Number Generators)