HALTON Procedure |
%HALTON (a function) generates an n-vector of the Halton(1964) sequence for the given base (which should be a prime number). Halton sequences are deterministic "low-discrepancy" sequences which fill the unit cube relatively uniformly (with a different base for each dimension) allowing numerical integrals to be estimated more accurately for a given number of function evaluations than would be possible with truly random numbers.
outputVECTOR = %Halton(n,base)
Parameters
|
n |
size of the vector to be generated |
|
base |
(INTEGER) prime number which chooses the sequence |
|
outputVECTOR |
n-VECTOR. This is deterministic given n and base. |
Example
source halton.src
compute r=100
compute uu=%Halton(r,7)
dec vect u(r)
ewise u(i)=%invnormal(uu(i))
generates a Halton sequence of length 100, which would be used like uniform 0,1 values. These are transformed to the equivalent N(0,1) deviates using %INVNORMAL to produce U.
Copyright © 2025 Thomas A. Doan