Skip to main content

Module quasi_random

Module quasi_random 

Source
Expand description

Low-discrepancy (quasi-random) sequences: Sobol and Halton.

Quasi-random points fill the unit cube far more evenly than pseudo-random ones, so averages over them converge like (log N)^d / N instead of N^{−1/2}. They are deterministic; for error estimates, apply independent random shifts (randomized quasi-Monte Carlo).

See the book entry Quasi-random sequences.

Structs§

HaltonSequence
The Halton sequence: coordinate k is the radical inverse in the k-th prime base. Simple and extensible to any number of points; uniformity degrades in high dimensions (large bases), where Sobol is preferable. Supports up to 100 dimensions. Starts at index 1 (skipping the origin).
SobolSequence
The Sobol sequence in up to 21201 dimensions (Joe-Kuo direction numbers), generated in Gray-code order (Antonov and Saleev), one XOR per coordinate per point. The first point is the origin; every block of 2^k consecutive points starting at a multiple of 2^k is a (t, k, d)-net.

Functions§

radical_inverse
The van der Corput radical inverse of n in base b: the base-b digits of n mirrored about the radix point.
random_shift
Applies a Cranley-Patterson rotation x ← (x + u) mod 1 with a uniform random shift u per coordinate. Independent shifts give unbiased, independent replicates of a quasi-Monte Carlo estimate, whose spread estimates its error.