Class FdmLinearOpLayout
The memory layout of a finite-difference operator's points: the number of points in each direction, the first direction contiguous, each later one spaced by the product of the earlier dimensions.
public sealed class FdmLinearOpLayout
- Inheritance
-
FdmLinearOpLayout
- Inherited Members
Remarks
Immutable once built.
Constructors
FdmLinearOpLayout(IEnumerable<int>)
Initializes a new instance of the FdmLinearOpLayout class.
public FdmLinearOpLayout(IEnumerable<int> dim)
Parameters
dimIEnumerable<int>The number of points in each direction.
Exceptions
- ArgumentNullException
dimis null.- ArgumentOutOfRangeException
A dimension is negative.
- ArgumentException
No dimension is given, where QuantLib writes the first spacing of an empty vector, undefined.
Properties
Dim
Gets the number of points in each direction.
public ImmutableArray<int> Dim { get; }
Property Value
Size
Gets the number of points.
public int Size { get; }
Property Value
Spacing
Gets each direction's spacing in storage order.
public ImmutableArray<int> Spacing { get; }
Property Value
Methods
Begin()
A new iterator at the first point: QuantLib's begin().
public FdmLinearOpIterator Begin()
Returns
- FdmLinearOpIterator
The iterator.
End()
The iterator past the last point: QuantLib's end(), an index without coordinates.
public FdmLinearOpIterator End()
Returns
- FdmLinearOpIterator
The iterator.
Index(ReadOnlySpan<int>)
The index of a point in storage order.
public int Index(ReadOnlySpan<int> coordinates)
Parameters
coordinatesReadOnlySpan<int>The point's coordinates.
Returns
- int
The index.
Exceptions
- ArgumentException
coordinatesholds more coordinates than the layout's directions, where QuantLib reads past its spacing.
IterNeighbourhood(FdmLinearOpIterator, int, int)
A new iterator at a point's neighbour offset steps away in direction i,
reflected at the grid's edges.
public FdmLinearOpIterator IterNeighbourhood(FdmLinearOpIterator iterator, int i, int offset)
Parameters
iteratorFdmLinearOpIteratorThe point.
iintThe direction.
offsetintThe offset.
Returns
- FdmLinearOpIterator
The neighbour's iterator.
Exceptions
- ArgumentNullException
iteratoris null.
Neighbourhood(FdmLinearOpIterator, int, int)
The index of a point's neighbour offset steps away in direction i,
reflected at the grid's edges.
public int Neighbourhood(FdmLinearOpIterator iterator, int i, int offset)
Parameters
iteratorFdmLinearOpIteratorThe point.
iintThe direction.
offsetintThe offset.
Returns
- int
The neighbour's index.
Exceptions
- ArgumentNullException
iteratoris null.
Neighbourhood(FdmLinearOpIterator, int, int, int, int)
The index of a point's neighbour offset1 steps away in direction i1 and
offset2 in direction i2, reflected at the grid's edges.
public int Neighbourhood(FdmLinearOpIterator iterator, int i1, int offset1, int i2, int offset2)
Parameters
iteratorFdmLinearOpIteratorThe point.
i1intThe first direction.
offset1intThe offset in the first direction.
i2intThe second direction.
offset2intThe offset in the second direction.
Returns
- int
The neighbour's index.
Exceptions
- ArgumentNullException
iteratoris null.