Class FaureRsg
The Faure low-discrepancy sequence generator. It is based on existing Fortran and C algorithms to calculate the Pascal matrix and gray transforms: E. Thiemard, Economic generation of low-discrepancy sequences with a b-ary gray code; Algorithms 659, 647, http://www.netlib.org/toms/647, http://www.netlib.org/toms/659.
[WorkingType]
public sealed class FaureRsg : IRsg
- Inheritance
-
FaureRsg
- Implements
- Inherited Members
Remarks
A mutable working type: each draw changes it, and it is not thread-safe. A draw returns a view of its buffer, valid until its next draw. The correctness of the returned values is tested by reproducing known good values.
Its integers are QuantLib's long under MSVC, 32 bits wide, which also sets the number of base-b digits the
sequence carries, ⌊ln(2^31 − 1)/ln b⌋: 30 in two dimensions (base 2), 4 in a hundred (base 101). Once its counter
carries past them the generator refuses ("Error processing Faure sequence."), after 2^30 − 1 draws in base 2 and
101^4 − 1 in base 101, where QuantLib built with a 64-bit long (Linux) draws other numbers and refuses after
about 10^18. These are the Python wheel's numbers.
Constructors
FaureRsg(int)
Initializes a new instance of the FaureRsg class.
public FaureRsg(int dimensionality)
Parameters
dimensionalityintThe dimension of each sequence, at least 1.
Exceptions
- ArgumentOutOfRangeException
dimensionalityis below 1.
Properties
Dimension
Gets the dimension of each sequence.
public int Dimension { get; }
Property Value
Methods
Clone()
Copies the generator deeply: the copy's next draw equals this one's, into its own buffer, and the two change apart.
public FaureRsg Clone()
Returns
- FaureRsg
The copy.
LastIntSequence()
Gets the integer sequence the last draw gave.
public ReadOnlyMemory<int> LastIntSequence()
Returns
- ReadOnlyMemory<int>
The integers, a view of the generator's buffer valid until its next draw.
LastSequence()
Gets the sequence the last draw gave.
public Sample<ReadOnlyMemory<double>> LastSequence()
Returns
- Sample<ReadOnlyMemory<double>>
The sequence, a view of the generator's buffer valid until its next draw, and its weight, 1.
NextIntSequence()
Draws the next integer sequence: the sequence's next point before its normalisation.
public ReadOnlyMemory<int> NextIntSequence()
Returns
- ReadOnlyMemory<int>
The integers, a view of the generator's buffer valid until its next draw.
Exceptions
- NanoQLException
The counter carries past the base-b digits the sequence carries.
NextSequence()
Draws the next sequence, in [0, 1) in each dimension.
public Sample<ReadOnlyMemory<double>> NextSequence()
Returns
- Sample<ReadOnlyMemory<double>>
The sequence, a view of the generator's buffer valid until its next draw, and its weight, 1.
Exceptions
- NanoQLException
The counter carries past the base-b digits the sequence carries.