Main Content

haltonset

Halton quasirandom point set

Description

haltonset is a quasirandom point set object that produces points from the Halton sequence. The Halton sequence uses different prime bases in each dimension to fill space in a highly uniform manner.

Creation

Description

p = haltonset(d) constructs a d-dimensional point set p, which is a haltonset object with default property settings. The input argument d corresponds to the Dimensions property of p.

p = haltonset(d,Name,Value) sets properties of p using one or more name-value pair arguments. Enclose each property name in quotes. For example, haltonset(5,'Leap',2) creates a five-dimensional point set from the first point, fourth point, seventh point, tenth point, and so on.

The returned object p encapsulates properties of a Halton quasirandom sequence. The point set is finite, with a length determined by the Skip and Leap properties and by limits on the size of the point set indices (maximum value of 253). Values of the point set are generated whenever you access p using net or parenthesis indexing. Values are not stored within p.

example

Properties

expand all

This property is read-only.

Number of dimensions of the points in the point set, specified as a positive integer scalar. For example, each point in the point set p with p.Dimensions = 5 has five values.

Use the d input argument to specify the number of dimensions when you create a point set using the haltonset function.

Interval between points in the sequence, specified as a positive integer scalar. In other words, the Leap property of a point set specifies the number of points in the sequence to leap over and omit for every point taken. The default Leap value is 0, which corresponds to taking every point from the sequence.

Leaping is a technique used to improve the quality of a point set. However, you must choose the Leap values with care. Many Leap values create sequences that fail to touch on large sub-hyper-rectangles of the unit hypercube and, therefore, fail to be a uniform quasirandom point set. For more information, see [1].

One rule for choosing Leap values for Halton sets is to set the value to (n–1), where n is a prime number that has not been used to generate one of the dimensions. For example, for a d-dimensional point set, specify the (d+1)th or greater prime number for n.

Example: p = haltonset(2,'Leap',4); (where d = 2 and n = 5)

Example: p.Leap = 100;

Settings that control the scrambling of the sequence, specified as a structure with these fields:

  • Type — A character vector containing the name of the scramble

  • Options — A cell array of parameter values for the scramble

Use the scramble object function to set scrambles. For a list of valid scramble types, see the type input argument of scramble. An error occurs if you set an invalid scramble type for a given point set.

The ScrambleMethod property also accepts an empty matrix as a value. The software then clears all scrambling and sets the property to contain a 0x0 structure.

Number of initial points in the sequence to omit from the point set, specified as a positive integer scalar.

Initial points of a sequence sometimes exhibit undesirable properties. For example, the first point is often (0,0,0,...), which can cause the sequence to be unbalanced because the counterpart of the point, (1,1,1,...), never appears. Also, initial points often exhibit correlations among different dimensions, and these correlations disappear later in the sequence.

Example: p = haltonset(__,'Skip',2e3);

Example: p.Skip = 1e3;

This property is read-only.

Sequence type on which the quasirandom point set p is based, specified as 'Halton'.

Object Functions

netGenerate quasirandom point set
scrambleScramble quasirandom point set

You can also use the following MATLAB® functions with a haltonset object. The software treats the point set object like a matrix of multidimensional points.

lengthLength of largest array dimension
sizeArray size

Examples

collapse all

Generate a three-dimensional Halton point set, skip the first 1000 values, and then retain every 101st point.

p = haltonset(3,'Skip',1e3,'Leap',1e2)
p = 
Halton point set in 3 dimensions (89180190640991 points)

Properties:
              Skip : 1000
              Leap : 100
    ScrambleMethod : none

Apply reverse-radix scrambling by using scramble.

p = scramble(p,'RR2')
p = 
Halton point set in 3 dimensions (89180190640991 points)

Properties:
              Skip : 1000
              Leap : 100
    ScrambleMethod : RR2

Generate the first four points by using net.

X0 = net(p,4)
X0 = 4×3

    0.0928    0.6950    0.0029
    0.6958    0.2958    0.8269
    0.3013    0.6497    0.4141
    0.9087    0.7883    0.2166

Generate every third point, up to the eleventh point, by using parenthesis indexing.

X = p(1:3:11,:)
X = 4×3

    0.0928    0.6950    0.0029
    0.9087    0.7883    0.2166
    0.3843    0.9840    0.9878
    0.6831    0.7357    0.7923

Tips

  • The Skip and Leap properties are useful for parallel applications. For example, if you have a Parallel Computing Toolbox™ license, you can partition a sequence of points across N different workers by using the function spmdIndex (Parallel Computing Toolbox). On each nth worker, set the Skip property of the point set to n – 1 and the Leap property to N – 1. The following code shows how to partition a sequence across three workers.

    Nworkers = 3;
    p = haltonset(10,'Leap',Nworkers-1);
    spmd(Nworkers)
        p.Skip = spmdIndex - 1;
    
        % Compute something using points 1,4,7...
        % or points 2,5,8... or points 3,6,9...
    end

Algorithms

expand all

References

[1] Kocis, L., and W. J. Whiten. “Computational Investigations of Low-Discrepancy Sequences.” ACM Transactions on Mathematical Software. Vol. 23, No. 2, 1997, pp. 266–294.

Version History

Introduced in R2008a