Class UncoupledParameterTransforms
- java.lang.Object
-
- com.opengamma.strata.math.impl.minimization.UncoupledParameterTransforms
-
- All Implemented Interfaces:
NonLinearParameterTransforms
public class UncoupledParameterTransforms extends Object implements NonLinearParameterTransforms
For a set of n function parameters, this takes n ParameterLimitsTransform (which can be the NullTransform which does NOT transform the parameter) which transform a constrained function parameter (e.g. must be between -1 and 1) to a unconstrained fit parameter. It also takes a BitSet (of length n) with an element set to true if that parameter is fixed - a set of n startValues must also be provided, with only those corresponding to fixed parameters being used (i.e. the parameter is fixed at the startValue). The purpose is to allow an optimiser to work with unconstrained parameters without modifying the function that one wishes to optimise.
-
-
Constructor Summary
Constructors Constructor Description UncoupledParameterTransforms(DoubleArray startValues, ParameterLimitsTransform[] transforms, BitSet fixed)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
int
getNumberOfFittingParameters()
int
getNumberOfModelParameters()
int
hashCode()
DoubleMatrix
inverseJacobian(DoubleArray fittingParameters)
Calculates the Jacobian of the transform from fitting parameters to function parameters - the i,j element will be the partial derivative of i^th function parameter with respect.DoubleArray
inverseTransform(DoubleArray fittingParameters)
Transforms from a set of unconstrained fitting parameters to a (possibly larger) set of function parameters (some of which may have constrained range and/or be fixed).DoubleMatrix
jacobian(DoubleArray functionParameters)
Calculates the Jacobian of the transform from function parameters to fitting parameters - the i,j element will be the partial derivative of i^th fitting parameter with respect.DoubleArray
transform(DoubleArray functionParameters)
Transforms from a set of function parameters (some of which may have constrained range and/or be fixed) to a (possibly smaller) set of unconstrained fitting parameters.
-
-
-
Constructor Detail
-
UncoupledParameterTransforms
public UncoupledParameterTransforms(DoubleArray startValues, ParameterLimitsTransform[] transforms, BitSet fixed)
- Parameters:
startValues
- fixed parameter values (if no parameters are fixed this is completely ignored)transforms
- Array of ParameterLimitsTransform (which can be the NullTransform which does NOT transform the parameter) which transform a constrained function parameter (e.g. must be between -1 and 1) to a unconstrained fit parameter.fixed
- BitSet with an element set to true if that parameter is fixed
-
-
Method Detail
-
getNumberOfModelParameters
public int getNumberOfModelParameters()
- Specified by:
getNumberOfModelParameters
in interfaceNonLinearParameterTransforms
- Returns:
- The number of function parameters
-
getNumberOfFittingParameters
public int getNumberOfFittingParameters()
- Specified by:
getNumberOfFittingParameters
in interfaceNonLinearParameterTransforms
- Returns:
- The number of fitting parameters (equals the number of model parameters minus the number of fixed parameters)
-
transform
public DoubleArray transform(DoubleArray functionParameters)
Transforms from a set of function parameters (some of which may have constrained range and/or be fixed) to a (possibly smaller) set of unconstrained fitting parameters. Note: If a parameter is fixed, it is its value as provided by startValues not the value given here that will be returned by inverseTransform (and thus used in the function).- Specified by:
transform
in interfaceNonLinearParameterTransforms
- Parameters:
functionParameters
- The function parameters- Returns:
- The fitting parameters
-
inverseTransform
public DoubleArray inverseTransform(DoubleArray fittingParameters)
Transforms from a set of unconstrained fitting parameters to a (possibly larger) set of function parameters (some of which may have constrained range and/or be fixed).- Specified by:
inverseTransform
in interfaceNonLinearParameterTransforms
- Parameters:
fittingParameters
- The fitting parameters- Returns:
- The function parameters
-
jacobian
public DoubleMatrix jacobian(DoubleArray functionParameters)
Calculates the Jacobian of the transform from function parameters to fitting parameters - the i,j element will be the partial derivative of i^th fitting parameter with respect. to the j^th function parameter- Specified by:
jacobian
in interfaceNonLinearParameterTransforms
- Parameters:
functionParameters
- The function parameters- Returns:
- matrix of partial derivative of fitting parameter with respect to function parameters
-
inverseJacobian
public DoubleMatrix inverseJacobian(DoubleArray fittingParameters)
Calculates the Jacobian of the transform from fitting parameters to function parameters - the i,j element will be the partial derivative of i^th function parameter with respect. to the j^th fitting parameter- Specified by:
inverseJacobian
in interfaceNonLinearParameterTransforms
- Parameters:
fittingParameters
- The fitting parameters- Returns:
- matrix of partial derivative of function parameter with respect to fitting parameters
-
-