Quasi Random Sequences Author: Stefan Ilijevski
Random sequences? 2/10
Halton’s sequence Steps for creating Halton’s sequence: Write J as a number in base B (B is a prime number) Reverse the digits Put a radix point in front of the sequence It’s best practice to make each component of a Halton sequence with different prime base B Steps for creating Halton’s sequence: Write J as a number in base B (B is a prime number) Reverse the digits Put a radix point in front of the sequence It’s best practice to make each component of a Halton sequence with different prime base B 3/10
Maximally spread-out order? 4/10
Sobol’ sequence Between zero and one as binary fractions Direction numbers and XOR Better than Halton’s? But is it efficient? Between zero and one as binary fractions Direction numbers and XOR Better than Halton’s? But is it efficient? 5/10 SobolHalton
Antonov and Saleev’s variant Problem with j-th number? Gray code Generating directional numbers? Problem with j-th number? Gray code Generating directional numbers? 6/10
Algorithm on CPU Two parts of the algorithm Initialization Generating random number Potential for optimization? Two parts of the algorithm Initialization Generating random number Potential for optimization? Void sobseq(…) { if (init) { /*initialization*/... } else { /*generating random number*/... //xor operations (direction num.)... } } 7/10
Maxeler comes to rescue else { im = in++; for (j = 1; j <= MAXBIT; j++) { if (!(im & 1)) break; im >>= 1; } if (j > MAXBIT) nrerror("MAXBIT too small in sobseq"); im = (j-1) * MAXDIM; for (k = 1; k <= IMIN(*n, MAXDIM); k++) { ix[k] ^= iv[im+k]; x[k] = ix[k] * fac; } else { im = in++; for (j = 1; j <= MAXBIT; j++) { if (!(im & 1)) break; im >>= 1; } if (j > MAXBIT) nrerror("MAXBIT too small in sobseq"); im = (j-1) * MAXDIM; for (k = 1; k <= IMIN(*n, MAXDIM); k++) { ix[k] ^= iv[im+k]; x[k] = ix[k] * fac; } DFEVar ix = io.input("ix", dfeUInt); DFEVar iv = io.input("iv", dfeUInt); DFEVar fac = io.scalarInput("fac", dfeFloat(8,24)); //ix[k] ^= iv[im+k]; //x[k] = ix[k] * fac; DFEVar ixOut = ixOut ^ iv; DFEVar x = ix * fac; io.output("ixOut", ixOut, dfeUInt); io.output("x", x, dfeFloat(8,24)); 8/10
SPEED! 9/10
References Press, W., Teukolsky, S., Vetterling, W., Flannery, B., “Numerical Recipes in C The Art of Scientific Computing Second Edition” Cambridge University Press; 2 edition, October 1992 Milutinovic, V. et al, Paradigm Shift in SuperComputing: DataFlow vs ControlFlow, Journal of Big Data, 2015 Milutinovic, V., et al, Guide to DataFlow SuperComputing, Springer, -, January 2016 -, January Press, W., Teukolsky, S., Vetterling, W., Flannery, B., “Numerical Recipes in C The Art of Scientific Computing Second Edition” Cambridge University Press; 2 edition, October 1992 Milutinovic, V. et al, Paradigm Shift in SuperComputing: DataFlow vs ControlFlow, Journal of Big Data, 2015 Milutinovic, V., et al, Guide to DataFlow SuperComputing, Springer, -, January 2016 -, January /10