# VAN_DER_CORPUT_ADVANCED The van der Corput Quasi Monte Carlo (QMC) sequence

VAN_DER_CORPUT_ADVANCED is a C++ library which computes the van der Corput Quasi Monte Carlo (QMC) sequence, using an advanced interface.

VAN_DER_CORPUT_ADVANCED includes several subroutines to make it easy to manipulate this computation, to compute the next N entries, to compute a particular entry, or to restart the sequence at a particular point.

The NDIM-dimensional Halton sequence is derived from the 1-dimensional van der Corput sequence by using a set of different (usually distinct prime) bases for each dimension, and the Hammersley sequence is derived in almost the same way.

The van der Corput sequence is often used to generate a "subrandom" sequence of points which have a better covering property than pseudorandom points.

The van der Corput sequence generates a sequence of points in [0,1] which (theoretically) never repeats. Except for SEED = 0, the elements of the van der Corput sequence are strictly between 0 and 1.

The van der Corput sequence writes an integer in a given base B, and then its digits are "reflected" about the decimal point. This maps the numbers from 1 to N into a set of numbers in [0,1], which are especially nicely distributed if N is one less than a power of the base.

Hammersley suggested generating a set of N nicely distributed points in two dimensions by setting the first component of the Ith point to I/N, and the second to the van der Corput value of I in base 2.

Halton suggested that in many cases, you might not know the number of points you were generating, so Hammersley's formulation was not ideal. Instead, he suggested that to generate a nicely distributed sequence of points in M dimensions, you simply choose the first M primes, P(1:M), and then for the J-th component of the I-th point in the sequence, you compute the van der Corput value of I in base P(J).

Thus, to generate a Halton sequence in a 2 dimensional space, it is typical practice to generate a pair of van der Corput sequences, the first with prime base 2, the second with prime base 3. Similarly, by using the first K primes, a suitable sequence in K-dimensional space can be generated.

The generation is quite simple. Given an integer SEED, the expansion of SEED in base BASE is generated. Then, essentially, the result R is generated by writing a decimal point followed by the digits of the expansion of SEED, in reverse order. This decimal value is actually still in base BASE, so it must be properly interpreted to generate a usable value.

Here is an example in base 2:
SEED (decimal) SEED (binary) VDC (binary) VDC (decimal)
00.00.0
11.10.5
210.010.25
311.110.75
4100.0010.125
5101.1010.625
6110.0110.375
7111.1110.875
81000.00010.0625

### Languages:

VAN_DER_CORPUT_ADVANCED is available in a C++ version and a FORTRAN90 version and a MATLAB version.

### Related Data and Programs:

BOX_BEHNKEN, a C++ library which computes a Box-Behnken design, that is, a set of arguments to sample the behavior of a function of multiple parameters;

CVT, a C++ library which computes points in a Centroidal Voronoi Tessellation.

FAURE, a C++ library which computes Faure sequences.

GRID, a C++ library which computes points on a grid.

HALTON, a C++ library which computes Halton sequences.

HAMMERSLEY, a C++ library which computes Hammersley sequences.

HEX_GRID, a C++ library which computes sets of points in a 2D hexagonal grid.

IHS, a C++ library which computes improved Latin Hypercube datasets.

LATIN_CENTER, a C++ library which computes Latin square data choosing the center value.

LATIN_EDGE, a C++ library which computes Latin square data choosing the edge value.

LATIN_RANDOM, a C++ library which computes Latin square data choosing a random value in the square.

NIEDERREITER2, a C++ library which computes Niederreiter sequences with base 2.

NORMAL, a C++ library which computes a sequence of pseudorandom normally distributed values.

SEQUENCE_STREAK_DISPLAY, a MATLAB program which makes a "streak file" of a van der Corput sequence.

SOBOL, a C++ library which computes Sobol sequences.

UNIFORM, a C++ library which computes uniform random values.

VAN_DER_CORPUT, a C++ library which computes elements of a 1D van der Corput Quasi Monte Carlo (QMC) sequence using a simple interface.

VAN_DER_CORPUT, a dataset directory which contains datasets of van der Corput sequences.

### Reference:

1. John Halton,
On the efficiency of certain quasi-random sequences of points in evaluating multi-dimensional integrals,
Numerische Mathematik,
Volume 2, pages 84-90, 1960.
2. John Hammersley,
Monte Carlo methods for solving multivariable problems,
Proceedings of the New York Academy of Science,
Volume 86, pages 844-874, 1960.
3. Johannes van der Corput,
Verteilungsfunktionen I & II,
Volume 38, 1935, pages 813-820, pages 1058-1066.

### List of Routines:

• CIRCLE_UNIT_VAN_DER_CORPUT picks a van der Corput point on the unit circle.
• GET_SEED returns a random seed for the random number generator.
• I4_LOG_2 returns the integer part of the logarithm base 2 of an I4.
• I4_TO_VAN_DER_CORPUT computes an element of a van der Corput sequence.
• I4_TO_VAN_DER_CORPUT_SEQUENCE: next N elements of a van der Corput sequence.
• R8_EPSILON returns the R8 round off unit.
• R8MAT_WRITE writes an R8MAT file.
• TIMESTAMP prints the current YMDHMS date as a time stamp.
• VAN_DER_CORPUT computes the next element in the van der Corput sequence.
• VAN_DER_CORPUT_BASE_GET gets the base for a van der Corput sequence.
• VAN_DER_CORPUT_BASE_SET sets the base for a van der Corput sequence.
• VAN_DER_CORPUT_SEED_GET gets the "seed" for the van der Corput sequence.
• VAN_DER_CORPUT_SEED_SET sets the "seed" for the van der Corput sequence.
• VAN_DER_CORPUT_SEQUENCE: next N elements in the van der Corput sequence.
• VDC_NUMERATOR_SEQUENCE: van der Corput numerator sequence base 2.

You can go up one level to the C++ source codes.

Last revised on 09 August 2016.