Notes for Intel® oneAPI Math Kernel Library Vector Statistics

ID 772987
Date 12/04/2020
Public
Document Table of Contents

NIEDERREITER

This is a 32-bit Gray code-based quasi-random number generator:

NOTE:

The value c is the right-most zero bit in n-1; xn is s-dimensional vector of 32-bit values. The s-dimensional vectors (calculated during random stream initialization) vi, i = 1,32 are called direction numbers. The vector un is the generator output normalized to the unit hypercube (0,1)s.

According to the results of Bratley, Fox, and Niederreiter [Brat92] Niederreiter sequences have the best known theoretical asymptotic properties. VS implementation allows generating Niederreiter low-discrepancy sequences of length up to 232. This implementation also allows for registration of user-defined parameters (irreducible polynomials or direction numbers), which allows obtaining quasi-random vectors of any dimension. If you do not supply user-defined parameters, the default values are used for generation of quasi-random vectors. The default dimension of quasi-random vectors can vary from 1 to 318 inclusive.

Real Implementation (Single and Double Precision)

The output vector is the sequence of the floating-point values u1, u2, ..., where elements u1, u2, ..., us correspond to the u1, us+1, us+2, ..., u2s correspond to the u2, and so on.

Integer Implementation

The output vector of 32-bit integers x1, x2, ..., where elements x1, x2, ..., xs correspond to the x1, xs+1, xs+2, ..., x2s correspond to the x2, and so on.

Stream Initialization by Function vslNewStream

NIEDERREITER generates the stream and initializes it specifying the input 32-bit parameter seed (dimension dimen of a quasi-random vector):

  1. Assume dimen = seed

  2. If dimen < 1 or dimen > 318, assume dimen = 1.

Stream Initialization by Function vslNewStreamEx

NIEDERREITER generates the stream and initializes it specifying the array params[] of  n 32-bit integers to set the dimension dimen of a quasi-random vector as well as pass other generator related parameters, for example, irreducible polynomials, or direction numbers (matrix of the generator). The general interface for passing stream the polynomials via the params[] array has the following format:

Position in params[] 0 1 2
3...2+dimen
 
dimen
Parameter Class Indicators Initial Values Subclass Indicators Irreducible polynomials

The dimension parameter params[0] is mandatory, and can be initialized as follows:

params[0] = dimen;

The other elements of params intended for passing additional user-supplied data are optional. For example, if they are not presented, then the default table of irreducible polynomials is used for generation of quasi-random vectors. VS default tables of the polynomials allow generating quasi-random sequences for dimensions up to 318.

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. In order to do this, you need to set the Parameter Class Indicators field (params[1]) to VSL_USER_QRNG_INITIAL_VALUES:

params[1] = VSL_USER_QRNG_INITIAL_VALUES;

Further, you should indicate in Initial Values Subclass Indicators field (params[2]) that you want to supply irreducible polynomials:

params[2] = VSL_USER_IRRED_POLYMS;

The remainder of the params array is used to pass irreducible polynomials. They are packed as unsigned integers and serially set into corresponding positions of the params array as shown in the example below (number of the polynomials equals the dimension dimen):

unsigned int uNiederrIrredPoly[dimen] = {...};
...
params[0] = dimen;
params[1] = VSL_USER_QRNG_INITIAL_VALUES;
params[2] = VSL_USER_IRRED_POLYMS;
 
for ( i = 0; i < dimen; i++ ) params[i+3] = uNiederrIrredPoly[i];
 

You can also calculate direction numbers (matrix of the generator) using your own irreducible polynomials and pass this table to the generator. The interface for registration of the direction numbers is as follows:

Position in params[] 0 1 2
3...dimen*32+2
  dimen Parameter Class Indicators Initial Values Subclass Indicators Direction numbers

The dimension parameter params[0] and Parameter Class Indicators field (params[1]) can be initialized as follows:

params[0] = dimen;
params[1] = VSL_USER_QRNG_INITIAL_VALUES;

Further, you need to initialize Initial Values Subclass Indicators field (params[2]):

params[2] = VSL_USER_DIRECTION_NUMBERS;

Direction numbers are assumed to be a dimen x 32 table of unsigned integers and can be passed to the generator in the following way:

unsigned int uNiederrCJ[dimen][32] = {...};
params[0] = dimen;
params[1] = VSL_USER_QRNG_INITIAL_VALUES;
params[2] = VSL_USER_DIRECTION_NUMBERS;
k = 3;
for ( i = 0; i < dimen; i++ )
{
     for ( j = 0; j < 32; j++ )
     {
          params[k++] = uNiederrCJ[i][j];
     }
                     }

In short, the NIEDERREITER stream initialization is as follows:

  1. If n = 0, assume dimen = 1 and initialize the stream using the default table of irreducible polynomials.

  2. If n = 1, dimen = params[0], initialize the stream using the default table of irreducible polynomials; (if dimen < 1 or dimen > 318, assume dimen = 1).

  3. If n > 1, dimen = params[0]

    1. If dimen < 1, assume dimen = 1 and initialize the stream using the default table of irreducible polynomials.

    2. If the externally defined parameters of the generator are packed incorrectly, initialize the stream using the default table of irreducible polynomials; (if dimen > 318, assume dimen = 1).

    3. Initialize the NIEDERREITER quasi-random stream by means of the table of user-defined irreducible polynomials.

Subsequences Selection Methods

vslSkipAheadStream
Supported
vslSkipAheadStreamEx
Not supported
vslLeapfrogStream
Supported
NOTE:
  1. The skip-ahead method skips individual components of quasi-random vectors rather than whole s-dimensional vectors. Hence, to skip N s-dimensional quasi-random vectors, call vslSkipAheadStream subroutine with parameter nskip equal to the Nxs.

  2. The leapfrog method works with individual components of quasi-random vectors rather than with s-dimensional vectors. In addition, its functionality allows picking out a fixed quasi-random component only. In other words, nstreams parameter should be equal to the predefined constant VSL_QRNG_LEAPFROG_COMPONENTS, and k parameter should indicate the index of a component of s-dimensional quasi-random vectors to be picked out (0 ≤ k < s).

Generator Period

Dimensions

1 ≤ s ≤ 318 is the default set of dimensions; user-defined dimensions are accepted.