Skip to main content

Module qmc

Module qmc 

Source
Expand description

Tools for quasi-Monte Carlo sampling, following scipy.stats.qmc: Latin hypercube samples, the discrepancy of a point set (how far it is from uniform), and scaling between the unit cube and a box. The low-discrepancy sequences themselves, plain or scrambled, are SobolSequence and HaltonSequence.

See the book entry Quasi-random sequences.

Structs§

PoissonDisk
Poisson-disk sampling in a box (SciPy’s qmc.PoissonDisk): random points no two of which are closer than radius, by Bridson’s algorithm. A background grid with cells of side r/√d holds at most one point each, so the test for nearby points looks only at the surrounding cells; new points are drawn as candidates around a random active point and kept if no existing point is within r.

Enums§

Discrepancy
A discrepancy measure (SciPy’s method). All are L² discrepancies with closed forms that cost O(n² d); each is the worst-case integration error, over a unit ball of functions, of the equal-weight rule on the points.
Hypersphere
How PoissonDisk draws candidates around a centre (SciPy’s hypersphere).

Functions§

discrepancy
The discrepancy of points in [0, 1]^d (SciPy’s qmc.discrepancy): smaller is more uniform.
latin_hypercube
n points of a Latin hypercube in [0, 1)^d (SciPy’s qmc.LatinHypercube): in every coordinate, each of the n intervals [i/n, (i+1)/n) holds exactly one point. Each coordinate takes an independent random permutation of the intervals; the point is placed uniformly in its cell, or at the cell’s centre when centered (SciPy’s scramble=False).
scale
Maps points from the unit cube to the box [lower, upper] (SciPy’s qmc.scale), or back when reverse.