HAMMERSLEY is a MATLAB library which computes elements of a Hammersley quasirandom sequence.
HAMMERSLEY includes routines to make it easy to manipulate this computation, to compute the next N entries, to compute a particular entry, to restart the sequence at a particular point, or to compute DIM_NUM-dimensional versions of the sequence.
For the most straightforward use, try either
For more convenience, there are two related routines with almost no input arguments:
Routines in this library select elements of a "leaped" subsequence of the Hammersley sequence. The subsequence elements are indexed by a quantity called STEP, which starts at 0. The STEP-th subsequence element is simply the Hammersley sequence element with index
SEED(1:DIM_NUM) + STEP * LEAP(1:DIM_NUM).
The arguments that the user may set include:
In the standard DIM_NUM-dimensional Hammersley sequence, it is assumed that N, the number of values to be generated, is known beforehand. The first dimension of entries in the sequence will have the form J/N for J from 1 to N. The remaining dimensions are computed using the 1-dimensional van der Corput sequence, using successive primes as bases.
In a generalized Hammersley sequence, each coordinate is allowed to be a fractional or van der Corput sequence. For any fractional sequence, the denominator is arbitrary. However, it is extremely desirable that the values in all coordinates stay between 0 and 1. This happens automatically for any van der Corput sequence, but for fractional sequences, this criterion is enforced using an appropriate modulus function. The consequence is that if you specify a small "base" for a fractional sequence, your sequence will soon wrap around and you will get repeated values.
If you drop the first dimension of the standard DIM_NUM-dimensional Hammersley sequence, you get the standard Halton sequence of dimension DIM_NUM-1.
The standard Hammersley sequence has slightly better dispersion properties than the standard Halton sequence. However, it suffers from the problem that you must know, beforehand, the number of points you are going to generate. Thus, if you have computed a Hammersley sequence of length N = 100, and you want to compute a Hammersley sequence of length 200, you must discard your current values and start over. By contrast, you can compute 100 points of a Halton sequence, and then 100 more, and this will be the same as computing the first 200 points of the Halton sequence in one calculation.
In low dimensions, the multidimensional Hammersley sequence quickly "fills up" the space in a well-distributed pattern. However, for higher dimensions (such as DIM_NUM = 40) for instance, the initial elements of the Hammersley sequence can be very poorly distributed; it is only when N, the number of sequence elements, is large enough relative to the spatial dimension, that the sequence is properly behaved. Remedies for this problem were suggested by Kocis and Whiten.
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
CVT is a MATLAB library which computes elements of a Centroidal Voronoi Tessellation.
FAURE is a MATLAB library which computes elements of a Faure quasirandom sequence.
GRID is a MATLAB library which computes elements of a grid sequence.
HALTON is a MATLAB library which computes elements of a Halton quasirandom sequence.
HAMMERSLEY is also available in a C++ version and a FORTRAN90 version.
HAMMERSLEY_DATASET is a MATLAB program which creates a Hammersley sequence and writes it to a file.
HEX_GRID is a MATLAB library which computes elements of a hexagonal grid dataset.
IHS is a MATLAB library which computes elements of an improved distributed Latin hypercube dataset.
LATIN_CENTER is a MATLAB library which computes elements of a Latin Hypercube dataset, choosing center points.
LATIN_EDGE is a MATLAB library which computes elements of a Latin Hypercube dataset, choosing edge points.
LATIN_RANDOM is a MATLAB library which computes elements of a Latin Hypercube dataset, choosing points at random.
LCVT is a MATLAB library which computes a latinized Centroidal Voronoi Tessellation.
NIEDERREITER2 is a MATLAB library which computes elements of a Niederreiter quasirandom sequence using base 2.
NORMAL is a MATLAB library which computes elements of a sequence of pseudorandom normally distributed values.
SOBOL is a MATLAB library which computes elements of a Sobol quasirandom sequence.
UNIFORM is a MATLAB library which computes elements of a uniform pseudorandom sequence.
VAN_DER_CORPUT is a MATLAB library which computes elements of a 1D van der Corput sequence.
A GZIP'ed TAR file of the contents of this directory is available. This is only done as a convenience for users who want ALL the files, and don't want to download them individually. This is not a convenience for me, so don't be surprised if the tar file is somewhat out of date.
You can go up one level to the MATLAB source codes.