Class Projection
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
parameterValuesReadOnlySpan<double>The values of all the parameters; the fixed ones keep these values.
fixParametersReadOnlySpan<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
FixedParameters
Gets the values of all the parameters, as given; the fixed ones keep these values.
protected ImmutableArray<double> FixedParameters { get; }
Property Value
NumberOfFreeParameters
Gets the number of free parameters.
protected int NumberOfFreeParameters { get; }
Property Value
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
projectedParametersVectorThe free parameters, in order.
Returns
- Vector
A new vector of all the parameters.
Exceptions
- ArgumentNullException
projectedParametersis null.- ArgumentException
projectedParametersisn'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
parametersVectorAll the parameters.
Returns
- Vector
A new vector of the free ones, in order.
Exceptions
- ArgumentNullException
parametersis null.- ArgumentException
parametersisn't one value per parameter.