Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Question about VDRNGUNIFORM

li_r_
Beginner
309 Views

Hi, there,

I am trying to generate 100 3-dimensional quasi-random vectors in the (2,3)^3 space by following the instruction on page 32 of "Intel Math Kernel Library Vector Statistical Library Notes." The illustrative example it provides looks like the following:

include <stdio.h> 
include “mkl.h” 
float mat[100][3]; /* buffer for quasi-random numbers */ 
VSLStreamStatePtr stream; 
/* Initializing */ 
vslNewStream( &stream, VSL_BRNG_SOBOL, 3 ); 
/* Generating */ 
vsRngUniform( VSL_METHOD_SUNIFORM_STD, stream, 100*3, (float*)mat, 2.0f, 3.0f ); 
/* Deleting the streams */ 
vslDeleteStream( &stream );

My question is: To my knowledge, the random number generator generates a series of numbers in sequential and puts them into the matrix in column-major order. Then, why we generate the 100 3-dimensional vectors by specifying it as mat[100][3] not the other way around like mat[3][100]. 

Thanks,

R.

0 Kudos
1 Reply
Andrey_N_Intel
Employee
309 Views

Hello,

The present version of Intel MKL Sobol Quasi-Random Number Generator returns the numbers in the order you describe above: the first 3-dim vector comes first, then the second 3-dim vector comes etc. This order is defined, in particular, by performance aspects of the generator.

Do I correctly understand that you prefer to have a different way of packing the random numbers, that is the first coordinate of the 3 dim vector comes first (for all 100 vectors), the second coordinate comes second, etc? If my understanding is correct, can you please help me better understand reasons for which you need this order?

Thanks,

Andrey

0 Kudos
Reply