quasirandom(n) 1.0 "flibs"

Name

quasirandom - Select quasi-random points in space

Table Of Contents

Synopsis

Description

The quasirandom module provides a class quasirandom_generator to generate quasi-random points in an n-dimensional space. Such points are spread more evenly over the space than would be the case with pseudo-random numbers.

The points are generated in either a unit-hypercube [0,1]^n, on a unit circle or a unit sphere or within a unit disk or a unit ball. Several options are available to influence the precise sequence.

As no random numbers are involved, the sequence is always the same, except for the starting point and the number of points that are skipped (if any).

The algorithm for generating the points is based on: http://extremelearning.com.au/unreasonable-effectiveness-of-quasirandom-sequences/

CLASS AND METHODS

The module defines a single class with a small number of methods:

type(quasirandom_generator) :: q

The class/derived type for generating the points in n-dimensional space

call q%init( dimin, stepsize)

Initialise the quasi-random generator. In the call the dimension or the shape of the occupied space is set. The stepsize allows you to skip points in the sequence, so that different points are selected.

integer dimin

The dimension of the space or the shape:

  • quasi_circle - The points lie on a unit circle (two dimensions)

  • quasi_disk - The points lie within a unit disk (two dimensions)

  • quasi_sphere - The points lie on a unit sphere (three dimensions)

  • quasi_disk - The points lie within a unit ball (three dimensions)

integer, optional :: stepsize

Optional argument: if given, then some points in the sequence will be skipped, so that you get a slightly different set of points. Default value: 1 (no point skipped).

call q%restart( start, stepsize)

Restart the sequence. You can select a new starting point and a stepsize.

integer, optional :: start

The index of the starting point (if not given, 1 is chosen)

integer, optional :: stepsize

The step to be taken in the sequence (if not given, 1 is chosen)

call q%next( coords )

Return the next point in the sequence. The coordinates array coords may be either single or double precision. The array is assumed to be at least as long as the number of dimensions.

real, dimension(:) :: coords

The coordinates of the selected point