halton
This module defines a function and class for generating halton sequences
- class rbf.pde.halton.GlobalHaltonSequence(dim=1, skip=1, prime_index=0)
A Halton sequence whose count attribute is an alias for the class-level variable COUNT. This ensures that two instances of a GlobalHaltonSequence will produce different sequences.
- class rbf.pde.halton.HaltonSequence(dim=1, start=0, skip=1, prime_index=0)
Produces a Halton sequence when called and remembers the state of the sequence so that repeated calls produce the next items in the sequence
- Parameters:
dim (int, optional) – Dimensions, defaults to 1
start (int, optional) – Starting index in the Halton sequence, defaults to 0
skip (int, optional) – Increment by this amount, defaults to 1
prime_index (int, optional) – Index of the starting prime number, defaults to 0 (i.e. 2 is the starting prime number)
- __call__(size=None)
Call self as a function.
- randint(a, b=None, size=None)
Returns elements of the Halton sequence that have been mapped to integers between a and b. If b is not given, then the returned values are between 0 and a.
- Parameters:
a (int) –
b (int, optional) –
- random(size=None)
Returns elements of a Halton sequence with values between 0 and 1
- Parameters:
size (int, optional) – Number of elements to return. If this is not given, then a single element will be returned as a (dim,) array.
- Returns:
out ((dim,) or (size, dim) array)
- uniform(low=0.0, high=1.0, size=None)
Returns elements of the Halton sequence that have been linearly mapped to floats between low and high.
- Parameters:
low (float or (dim,) float array) –
high (float or (dim,) float array) –
- rbf.pde.halton.halton_sequence(size, dim=1, start=0, skip=1, prime_index=0)
Returns a Halton sequence with length size and dimensions dim
- Parameters:
size (int) – Number of Halton sequence elements to return
dim (int, optional) – Number of dimensions. defaults to 1
start (int, optional) – Starting index for the Halton sequence. defaults to 100
skip (int, optional) – Increment by this amount. defaults to 1
prime_index (int, optional) – Index of the starting prime number, defaults to 0 (i.e. 2 is the starting prime number).
- Returns:
(size, dim) array