VAN_DER_CORPUT is a MATLAB library which computes the van der Corput Quasi Monte Carlo (QMC) sequence, using a simple interface.
A more sophisticated library is available in VAN_DER_CORPUT_ADVANCED, but I find this simple version to be preferable for everyday use!
The van der Corput sequence generates a sequence of points in [0,1] which never repeats. For positive index I, the elements of the van der Corput sequence are strictly between 0 and 1.
The I-th element of the van der Corput sequence is computed by writing I in the base B (usually 2) and then reflecting its digits about the decimal point. For example, if we start with I = 11, its binary expansion is 1011, and so its reflected binary expansion is 0.1101 which is 1/2+1/4+1/16=0.8125.
The generation is quite simple. Given an index I, the expansion of I in base B is generated. Then, essentially, the result R is generated by writing a decimal point followed by the digits of the expansion of I, in reverse order. This decimal value is actually still in base B, so it must be properly interpreted to generate a usable value.
Here is an example in base 2:
I (decimal) | I (binary) | R (binary) | R (decimal) |
---|---|---|---|
0 | 0 | .0 | 0.0 |
1 | 1 | .1 | 0.5 |
2 | 10 | .01 | 0.25 |
3 | 11 | .11 | 0.75 |
4 | 100 | .001 | 0.125 |
5 | 101 | .101 | 0.625 |
6 | 110 | .011 | 0.375 |
7 | 111 | .111 | 0.875 |
8 | 1000 | .0001 | 0.0625 |
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
VAN_DER_CORPUT is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.
CVT, a MATLAB library which computes elements of a Centroidal Voronoi Tessellation.
FAURE, a MATLAB library which computes elements of a Faure sequence.
GRID, a MATLAB library which computes elements of a grid sequence.
HALTON, a MATLAB library which computes elements of a Halton sequence.
HAMMERSLEY, a MATLAB library which computes elements of a Hammersley Quasi Monte Carlo (QMC) sequence, using a simple interface.
HEX_GRID, a MATLAB library which computes elements of a hexagonal grid dataset.
IHS, a MATLAB library which computes elements of an improved distributed Latin hypercube dataset.
LATIN_CENTER, a MATLAB library which computes elements of a Latin Hypercube dataset, choosing center points.
LATIN_EDGE, a MATLAB library which computes elements of a Latin Hypercube dataset, choosing edge points.
LATIN_RANDOM, a MATLAB library which computes elements of a Latin Hypercube dataset, choosing points at random.
LCVT, a MATLAB library which computes a latinized Centroidal Voronoi Tessellation.
NIEDERREITER2, a MATLAB library which computes elements of a Niederreiter sequence using base 2.
NORMAL, a MATLAB library which computes elements of a sequence of pseudorandom normally distributed values.
SOBOL, a MATLAB library which computes elements of a Sobol quasirandom sequence.
UNIFORM, a MATLAB library which computes elements of a uniform pseudorandom sequence.
VAN_DER_CORPUT, a dataset directory which contains datasets of van der Corput sequences.
VAN_DER_CORPUT_ADVANCED, a MATLAB library which computes elements of a 1D van der Corput Quasi Monte Carlo (QMC) sequence, allowing the user more advanced and sophisticated input.
You can go up one level to the MATLAB source codes.