hammersley


hammersley, an Octave code which computes elements of a Hammersley Quasi Monte Carlo (QMC) sequence using a simple interface.

A more sophisticated library is available in HAMMERSLEY_ADVANCED, but I find this simple version to be preferable for everyday use!

The standard M-dimensional Hammersley sequence based on N is simply composed of a first component of successive fractions 0/N, 1/N, ..., N/N, paired with M-1 1-dimensional van der Corput sequences, using as bases the first M-1 primes.

The HAMMERSLEY function will return the M-dimensional element of this sequence with index I.

The HAMMERSLEY_SEQUENCE function will return the M-dimensional elements of this sequence with indices I1 through I2.

The HAMMERSLEY_INVERSE function accepts an M-dimensional value, presumably computed by HAMMERSLEY, and returns its original index I.

Licensing:

The computer code and data files described and made available on this web page are distributed under the MIT license

Languages:

hammersley is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

hammersley_test

cvt, an Octave code which computes elements of a Centroidal Voronoi Tessellation.

faure, an Octave code which computes elements of a Faure sequence.

halton, an Octave code which computes elements of a Halton Quasi Monte Carlo (QMC) sequence.

latin_center, an Octave code which computes elements of a Latin Hypercube dataset, choosing center points.

latin_edge, an Octave code which computes elements of a Latin Hypercube dataset, choosing edge points.

latin_random, an Octave code which computes elements of a Latin Hypercube dataset, choosing points at random.

lattice_rule, an Octave code which approximates multidimensional integrals using lattice rules.

niederreiter2, an Octave code which computes elements of a Niederreiter sequence using base 2.

sobol, an Octave code which computes elements of a Sobol sequence.

uniform, an Octave code which computes elements of a uniform pseudorandom sequence.

van_der_corput, an Octave code which computes elements of a 1D van der Corput Quasi Monte Carlo (QMC) sequence using a simple interface.

Reference:

  1. John Hammersley, Monte Carlo methods for solving multivariable problems, Proceedings of the New York Academy of Science, Volume 86, 1960, pages 844-874.
  2. Ladislav Kocis, William Whiten,
    Computational Investigations of Low-Discrepancy Sequences,
    ACM Transactions on Mathematical Software,
    Volume 23, Number 2, 1997, pages 266-294.

Source Code:


Last revised on 09 November 2022.