java.lang.Object
net.finmath.randomnumbers.HaltonSequence
- All Implemented Interfaces:
Serializable
,RandomNumberGenerator
Implements a multi-dimensional Halton sequence (quasi random numbers) with the given bases.
- Version:
- 1.0
- Author:
- Christian Fries
- See Also:
- Serialized Form
-
Constructor Summary
ConstructorsConstructorDescriptionHaltonSequence(int[] base)
Constructs a Halton sequence with the given bases. -
Method Summary
Modifier and TypeMethodDescriptionint
Get the sample vector dimension.double[]
getHaltonNumber(long index)
double
getHaltonNumber(long index, int dimension)
static double
getHaltonNumberForGivenBase(long index, int base)
Return a Halton number, sequence starting at index = 0, base > 1.double[]
getNext()
Get the next sample vector of dimension n, where n isgetDimension
.
-
Constructor Details
-
HaltonSequence
public HaltonSequence(int[] base)Constructs a Halton sequence with the given bases. The bases should be integers without common divisor greater than 1, for example, prime numbers.- Parameters:
base
- The array of base integers. The length of the array defines the dimension of the sequence.
-
-
Method Details
-
getNext
public double[] getNext()Description copied from interface:RandomNumberGenerator
Get the next sample vector of dimension n, where n isgetDimension
. An implementation has to be thread safe.- Specified by:
getNext
in interfaceRandomNumberGenerator
- Returns:
- The next sample vector of dimension n, where n is
getDimension
.
-
getDimension
public int getDimension()Description copied from interface:RandomNumberGenerator
Get the sample vector dimension.- Specified by:
getDimension
in interfaceRandomNumberGenerator
- Returns:
- The sample vector dimension n.
-
getHaltonNumber
public double[] getHaltonNumber(long index) -
getHaltonNumber
public double getHaltonNumber(long index, int dimension) -
getHaltonNumberForGivenBase
public static double getHaltonNumberForGivenBase(long index, int base)Return a Halton number, sequence starting at index = 0, base > 1.- Parameters:
index
- The index of the sequence.base
- The base of the sequence. Has to be greater than one (this is not checked).- Returns:
- The Halton number.
-