Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
7234 Discussions

Quasi-random numbers - results for SOBOL & NIEDERREITER methods identical?

davidspurr
Beginner
504 Views

Using MKL, I get identical QRN's whether I use either the SOBOL or the NIEDERREITER methods. Is this correct, or am I doing something wrong?

Code extract used to generate the QRN's is as below:
USE mkl_vsl

integer status !Error/status
integer brng !Index of generator to initialize stream
integer method !Method = 0 in case of uniform distribution
integer dimen
TYPE (VSL_STREAM_STATE) stream !Random stream
TYPE (VSL_STREAM_STATE) stream2 !Random stream 2

integer, PARAMETER :: nc = 10
integer, PARAMETER :: nr = 1000
real sobel_num(nc,nr)
real niederr_num(nc,nr)

fmt = '(10(:,",",f8.6))'
OPEN(11, file='TestRandomOut.csv')

!SOBEL
write(11,'(///,a,/)') 'SOBOL'
method = 0
sobel_num = 0.0
brng = VSL_BRNG_SOBOL
dimen = 1
status = vslnewstream( stream, brng, dimen ) !Create SOBOL stream
status = vsrnguniform( method, stream, nc*nr, sobel_num, 0.0, 1.0 )
status = vsldeletestream( stream ) !Delete stream
write(11,fmt) sobel_num

!NIEDERREITER
write(11,'(///,a,/)') 'NIEDERREITER'
method = 0
niederr_num = 0.0
brng = VSL_BRNG_NIEDERR
dimen = 1
status = vslnewstream( stream2, brng, dimen ) !Create NIEDERREITER stream
status = vsrnguniform( method, stream2, nc*nr, niederr_num, 0.0, 1.0 )
status = vsldeletestream( stream2 ) !Delete stream
write(11,fmt) niederr_num


0 Kudos
2 Replies
Andrey_N_Intel
Employee
504 Views

VSL implementations of Sobol and Niederreiter QRNGs are both Gray code based (see Vslnotes.pdf for implementation details). The generators are different in their initialization schemes. However, for particular dimension d=1 the generators are initialized similarly, and you have identical outputs.

0 Kudos
davidspurr
Beginner
504 Views
Thanks for the explanation - yes the results were for d=1.
0 Kudos
Reply