Class LogCubicInterpolation
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
xReadOnlySpan<double>The x values, which must be sorted; at least 2, and at least 4 for Akima's approximation or a Lagrange condition.
yReadOnlySpan<double>The y values, one per x value, each positive.
daCubicInterpolationDerivativeApproxThe first-derivative approximation of the logarithms.
monotonicboolWhether to apply Hyman's monotonicity filter to the logarithms' cubic.
leftCCubicInterpolationBoundaryConditionThe left boundary condition, for the spline approximation.
leftConditionValuedoubleThe left condition's value, where it takes one.
rightCCubicInterpolationBoundaryConditionThe right boundary condition, for the spline approximation.
rightConditionValuedoubleThe 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
xdoubleThe point.
Returns
- double
The derivative.
PrimitiveCore(double)
The primitive at a point, after the range check.
protected override sealed double PrimitiveCore(double x)
Parameters
xdoubleThe 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
xdoubleThe 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
xdoubleThe point.
Returns
- double
The value.