Class SingleRangeLimitTransform
- java.lang.Object
-
- com.opengamma.strata.math.impl.minimization.SingleRangeLimitTransform
-
- All Implemented Interfaces:
ParameterLimitsTransform
public class SingleRangeLimitTransform extends Object implements ParameterLimitsTransform
If a model parameter $x$ is constrained to be either above or below some level $a$ (i.e. $x > a$ or $x < a$), the function to transform it to an unconstrained variable $y$ is given by $$ \begin{align*} y = \begin{cases} \ln(e^{x-a} - 1)\quad & x > a\\ a - \ln(e^{a-x} - 1)\quad & x < a \end{cases} \end{align*} $$ with inverse transform $$ \begin{align*} x = \begin{cases} a + \ln(e^y + 1)\quad & x > a\\ a - \ln(e^y + 1)\quad & x < a \end{cases} \end{align*} $$ For large $y > 50$, this becomes $$ \begin{align*} y = \begin{cases} x - a\quad & x > a\\ a - x\quad & x < a \end{cases} \end{align*} $$ with inverse transform $$ \begin{align*} x = \begin{cases} a + y\quad & x > a\\ a - y\quad & x < a \end{cases} \end{align*} $$ so any value of $y$ will give a value of $x$.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.opengamma.strata.math.impl.minimization.ParameterLimitsTransform
ParameterLimitsTransform.LimitType
-
-
Constructor Summary
Constructors Constructor Description SingleRangeLimitTransform(double a, ParameterLimitsTransform.LimitType limitType)
Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
int
hashCode()
double
inverseTransform(double y)
A function to transform an unconstrained fitting parameter (y*) to a constrained model parameter (y) - i.e.double
inverseTransformGradient(double y)
The gradient of the function used to transform from a fitting parameter that can take any value, to a model parameter that is only allows to take certain values.double
transform(double x)
A function to transform a constrained model parameter (y) to an unconstrained fitting parameter (y*) - i.e.double
transformGradient(double x)
The gradient of the function used to transform from a model parameter that is only allows to take certain values, to a fitting parameter that can take any value.
-
-
-
Constructor Detail
-
SingleRangeLimitTransform
public SingleRangeLimitTransform(double a, ParameterLimitsTransform.LimitType limitType)
Creates an instance.- Parameters:
a
- The limit levellimitType
- Type of the limit for the parameter
-
-
Method Detail
-
inverseTransform
public double inverseTransform(double y)
A function to transform an unconstrained fitting parameter (y*) to a constrained model parameter (y) - i.e. y = f^-1(y*)- Specified by:
inverseTransform
in interfaceParameterLimitsTransform
- Parameters:
y
- Fitting parameter- Returns:
- Model parameter
-
transform
public double transform(double x)
A function to transform a constrained model parameter (y) to an unconstrained fitting parameter (y*) - i.e. y* = f(y)- Specified by:
transform
in interfaceParameterLimitsTransform
- Parameters:
x
- Model parameter- Returns:
- Fitting parameter
- Throws:
IllegalArgumentException
- If the value of $x$ is not consistent with the limit (e.g. the limit is $x > a$ and $x$ is less than $a$
-
inverseTransformGradient
public double inverseTransformGradient(double y)
The gradient of the function used to transform from a fitting parameter that can take any value, to a model parameter that is only allows to take certain values.- Specified by:
inverseTransformGradient
in interfaceParameterLimitsTransform
- Parameters:
y
- fitting parameter- Returns:
- the gradient
-
transformGradient
public double transformGradient(double x)
The gradient of the function used to transform from a model parameter that is only allows to take certain values, to a fitting parameter that can take any value.- Specified by:
transformGradient
in interfaceParameterLimitsTransform
- Parameters:
x
- Model parameter- Returns:
- the gradient
- Throws:
IllegalArgumentException
- If the value of $x$ is not consistent with the limit (e.g. the limit is $x > a$ and $x$ is less than $a$
-
-