Table of Contents

Class LogCubicInterpolation

Namespace
NanoQL.Numerics
Assembly
NanoQL.dll

Log-cubic interpolation between discrete points: the exponential of a CubicInterpolation of the logarithms of the y values, which must be positive.

public class LogCubicInterpolation : Interpolation
Inheritance
LogCubicInterpolation
Derived
Inherited Members
Extension Methods

Remarks

It copies its inputs, as every Interpolation does. It has no primitive. An extension point, as in QuantLib: the named log-cubic interpolations derive from it.

Constructors

LogCubicInterpolation(ReadOnlySpan<double>, ReadOnlySpan<double>, CubicInterpolationDerivativeApprox, bool, CubicInterpolationBoundaryCondition, double, CubicInterpolationBoundaryCondition, double)

Initializes a new instance of the LogCubicInterpolation class.

public LogCubicInterpolation(ReadOnlySpan<double> x, ReadOnlySpan<double> y, CubicInterpolationDerivativeApprox da, bool monotonic, CubicInterpolationBoundaryCondition leftC, double leftConditionValue, CubicInterpolationBoundaryCondition rightC, double rightConditionValue)

Parameters

x ReadOnlySpan<double>

The x values, which must be sorted; at least 2, and at least 4 for Akima's approximation or a Lagrange condition.

y ReadOnlySpan<double>

The y values, one per x value, each positive.

da CubicInterpolationDerivativeApprox

The first-derivative approximation of the logarithms.

monotonic bool

Whether to apply Hyman's monotonicity filter to the logarithms' cubic.

leftC CubicInterpolationBoundaryCondition

The left boundary condition, for the spline approximation.

leftConditionValue double

The left condition's value, where it takes one.

rightC CubicInterpolationBoundaryCondition

The right boundary condition, for the spline approximation.

rightConditionValue double

The right condition's value, where it takes one.

Exceptions

ArgumentException

The sizes differ, there are too few points, or a y value isn't positive.

ArgumentOutOfRangeException

An enum argument isn't a member of its type.

NanoQLException

The scheme or a condition isn't implemented, or the spline's system has a zero pivot.

Methods

DerivativeCore(double)

The first derivative at a point, after the range check.

protected override sealed double DerivativeCore(double x)

Parameters

x double

The point.

Returns

double

The derivative.

PrimitiveCore(double)

The primitive at a point, after the range check.

protected override sealed double PrimitiveCore(double x)

Parameters

x double

The point.

Returns

double

The primitive.

Exceptions

NanoQLException

Always: the log interpolations have no primitive.

SecondDerivativeCore(double)

The second derivative at a point, after the range check.

protected override sealed double SecondDerivativeCore(double x)

Parameters

x double

The point.

Returns

double

The second derivative.

ValueCore(double)

The interpolated value at a point, after the range check.

protected override sealed double ValueCore(double x)

Parameters

x double

The point.

Returns

double

The value.