Table of Contents

Class LatticeRsg

Namespace
NanoQL.Numerics
Assembly
NanoQL.dll

The rank-1 lattice-rule low-discrepancy sequence generator: its i-th point is (i·z_j/N mod 1) in each dimension j, z a generating vector (LatticeRule) and N the number of points.

[WorkingType]
public sealed class LatticeRsg : IRsg
Inheritance
LatticeRsg
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.

Two departures from QuantLib's, each documented: SkipTo(long) moves to the n-th point, as QuantLib's other sequences' skipTo do, where QuantLib's moves n points on (Divergences/LatticeRsgTests.cs); and a dimension beyond the generating vector's, which QuantLib reads past its end, and a number of points below 1, a division by 0, are refused.

Constructors

LatticeRsg(int, ImmutableArray<double>, long)

Initializes a new instance of the LatticeRsg class.

public LatticeRsg(int dimensionality, ImmutableArray<double> z, long n)

Parameters

dimensionality int

The dimension of each point, from 0 to the generating vector's length.

z ImmutableArray<double>

The generating vector.

n long

The number of points, at least 1.

Exceptions

ArgumentOutOfRangeException

dimensionality is negative or beyond z's length, or n is below 1.

Properties

Dimension

Gets the dimension of each sequence.

public int Dimension { get; }

Property Value

int

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 LatticeRsg Clone()

Returns

LatticeRsg

The copy.

LastSequence()

Gets the point the last draw gave.

public Sample<ReadOnlyMemory<double>> LastSequence()

Returns

Sample<ReadOnlyMemory<double>>

The point, a view of the generator's buffer valid until its next draw, and its weight, 1.

NextSequence()

Draws the next point.

public Sample<ReadOnlyMemory<double>> NextSequence()

Returns

Sample<ReadOnlyMemory<double>>

The point, a view of the generator's buffer valid until its next draw, and its weight, 1.

SkipTo(long)

Skips to the n-th point of the sequence: the next draw is the point of index index.

public void SkipTo(long index)

Parameters

index long

The point's index, from 0.

Exceptions

ArgumentOutOfRangeException

index is negative.