Table of Contents

Struct KrugerLog

Namespace
NanoQL.Numerics
Assembly
NanoQL.dll

QuantLib's preset log-cubic factory: Kruger's approximation of the logarithms, not monotonic, with second-derivative boundary conditions of 0.

public readonly struct KrugerLog : IInterpolator
Implements
Inherited Members

Remarks

A parameterless configuration struct, so that it can be a type argument where QuantLib names it as one; every instance, its zero value included, is QuantLib's KrugerLog(). QuantLib derives it from LogCubic: here it converts to the LogCubic it is.

Methods

CheckPoints(int)

Runs the checks QuantLib's interpolation makes when it is built over a number of points, before it reads their values: the fewest points its implementation takes, and the counts its configuration needs.

public void CheckPoints(int points)

Parameters

points int

The number of points.

Remarks

The bootstraps read it on their first pass: QuantLib builds a curve's interpolation over its first nodes before their values are solved (interpolateWithoutUpdate), and takes linear interpolation where a global interpolation refuses to be built over that many points (iterativebootstrap.hpp:295-310). Interpolate(ReadOnlySpan<double>, ReadOnlySpan<double>) runs every check, these and the ones on the values alike. The default refuses none, so a factory of one's own keeps compiling; a factory overrides it with its construction checks, so that a curve on it takes the fallback where QuantLib's would.

Exceptions

ArgumentException

The interpolation can't be built over that many points.

NanoQLException

The interpolation's configuration can't be built over that many points.

Interpolate(ReadOnlySpan<double>, ReadOnlySpan<double>)

Builds the preset's LogCubicInterpolation over the given points, which it copies.

public Interpolation Interpolate(ReadOnlySpan<double> x, ReadOnlySpan<double> y)

Parameters

x ReadOnlySpan<double>

The x values, which must be sorted.

y ReadOnlySpan<double>

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

Returns

Interpolation

The interpolation.

Exceptions

ArgumentException

The sizes differ, there are fewer than 2 points, or a y value isn't positive.

Operators

implicit operator LogCubic(KrugerLog)

The LogCubic the preset is.

public static implicit operator LogCubic(KrugerLog preset)

Parameters

preset KrugerLog

The preset.

Returns

LogCubic

A log-cubic factory with Kruger's approximation, not monotonic, and second-derivative conditions of 0.

Explicit Interface Implementations

Global

Gets a value indicating whether the interpolation is global: true, as LogCubic's.

static bool Global { get; }

Returns

bool

RequiredPoints

Gets the fewest points the interpolation takes: 2, as LogCubic's.

static int RequiredPoints { get; }

Returns

int