Sampler Sobol [JK03] [Owe95]
Description
The Sobol sequence. Samples are generated from a binary product between the binary representation of their index and a matrix, generated from primitive polynomials. By default, uses Juo & Kuo tables [JK03].
The sequence can be scrambled with Owen’s permutation [Owe95].
For a more precise description of this sampler and its performances in terms of aliasing and discrepancy, please refer to the following web bundle https://liris.cnrs.fr/ldbn/HTML_bundle/index.html.
Files
src/samplers/Sobol.cpp
include/utk/samplers/SamplerSobol.hpp
Usage
Sobol sampler
Usage: ./Sobol [OPTIONS]
Options:
-h,--help Print this help message and exit
-n UINT REQUIRED Number of points
-d UINT REQUIRED Dimensions
-s,--seed UINT Seed (unspecified means 'random')
-m UINT [1] Number of pointsets
-o,--out TEXT [out.dat] Output file (format). {i} splits outputs in multiple files and token is replaced by index.
--depth UINT [0] Owen depth (0: no randomness, 32: recommended).
--silent Silence UTK logs
--table TEXT Sobol init table file (Joe&Kuo format). If not specified the [JK03] table is used.
#include <utk/utils/PointsetIO.hpp>
#include <utk/utils/Pointset.hpp>
#include <utk/samplers/SamplerStep.hpp>
int main()
{
utk::Pointset<double> pts;
// If needed, can add template to use 64bits integers
utk::SamplerSobol sobol(2 /* dimension */, 32 /* depth */);
sobol.setRandomSeed(args->seed);
// Check for no errors
if (sobol.generateSamples(pts, 1024 /* Number of points */))
{
write_text_pointset("sobol2d.dat", pts);
}
}
import pyutk
# Only 32 bits integers supported
sobol = pyutk.Sobol(d=2, depth=32)
samples = sobol.sample(1024) # This is a numpy array !
Results
License
See Licence.md file.