Table of Contents

Class Projection

Namespace
NanoQL.Numerics
Assembly
NanoQL.dll

A parameter projection: a set of parameters, some of them fixed, mapped to its free parameters and back.

public class Projection
Inheritance
Projection
Inherited Members

Remarks

Immutable: it copies the values and the flags it is given. QuantLib's protected mapFreeParameters and its mutable copy of the parameters, which only a class deriving from both CostFunction and Projection reads, aren't ported: a class with one base composes a projection and calls Include(Vector), which computes the same values.

An extension point, as in QuantLib: Project(Vector) and Include(Vector) are virtual, and the fixed values, the flags and the number of free parameters are protected.

Constructors

Projection(ReadOnlySpan<double>, ReadOnlySpan<bool>)

Initializes a new instance of the Projection class.

public Projection(ReadOnlySpan<double> parameterValues, ReadOnlySpan<bool> fixParameters = default)

Parameters

parameterValues ReadOnlySpan<double>

The values of all the parameters; the fixed ones keep these values.

fixParameters ReadOnlySpan<bool>

Whether each parameter is fixed; empty, the default, for all free.

Exceptions

ArgumentException

The flags aren't one per parameter, or no parameter is free.

Properties

FixParameters

Gets whether each parameter is fixed.

protected ImmutableArray<bool> FixParameters { get; }

Property Value

ImmutableArray<bool>

FixedParameters

Gets the values of all the parameters, as given; the fixed ones keep these values.

protected ImmutableArray<double> FixedParameters { get; }

Property Value

ImmutableArray<double>

NumberOfFreeParameters

Gets the number of free parameters.

protected int NumberOfFreeParameters { get; }

Property Value

int

Methods

Include(Vector)

The whole set of parameters for a set of free ones: the fixed values with the free ones replaced.

public virtual Vector Include(Vector projectedParameters)

Parameters

projectedParameters Vector

The free parameters, in order.

Returns

Vector

A new vector of all the parameters.

Exceptions

ArgumentNullException

projectedParameters is null.

ArgumentException

projectedParameters isn't one value per free parameter.

Project(Vector)

The subset of free parameters of a set of parameters.

public virtual Vector Project(Vector parameters)

Parameters

parameters Vector

All the parameters.

Returns

Vector

A new vector of the free ones, in order.

Exceptions

ArgumentNullException

parameters is null.

ArgumentException

parameters isn't one value per parameter.