public final class ParameterizedFunctionalCurve extends Object implements Curve, org.joda.beans.ImmutableBean
This class defines a curve in terms of a function and its parameters.
| Modifier and Type | Class and Description |
|---|---|
static class |
ParameterizedFunctionalCurve.Builder
The bean-builder for
ParameterizedFunctionalCurve. |
static class |
ParameterizedFunctionalCurve.Meta
The meta-bean for
ParameterizedFunctionalCurve. |
| Modifier and Type | Method and Description |
|---|---|
static ParameterizedFunctionalCurve.Builder |
builder()
Returns a builder used to create an instance of the bean.
|
CurrencyParameterSensitivity |
createParameterSensitivity(Currency currency,
DoubleArray sensitivities)
Creates a parameter sensitivity instance for this curve when the sensitivity values are known.
|
UnitParameterSensitivity |
createParameterSensitivity(DoubleArray sensitivities)
Creates a parameter sensitivity instance for this curve when the sensitivity values are known.
|
boolean |
equals(Object obj) |
double |
firstDerivative(double x)
Computes the first derivative of the curve.
|
BiFunction<DoubleArray,Double,Double> |
getDerivativeFunction()
Gets the derivative function.
|
CurveMetadata |
getMetadata()
Gets the curve metadata.
|
double |
getParameter(int parameterIndex)
Gets the value of the parameter at the specified index.
|
int |
getParameterCount()
Gets the number of parameters.
|
DoubleArray |
getParameters()
Gets the array of parameters for the curve function.
|
BiFunction<DoubleArray,Double,DoubleArray> |
getSensitivityFunction()
Gets the parameter sensitivity function.
|
BiFunction<DoubleArray,Double,Double> |
getValueFunction()
Gets the y-value function.
|
int |
hashCode() |
static ParameterizedFunctionalCurve.Meta |
meta()
The meta-bean for
ParameterizedFunctionalCurve. |
ParameterizedFunctionalCurve.Meta |
metaBean() |
static ParameterizedFunctionalCurve |
of(CurveMetadata metadata,
DoubleArray parameters,
BiFunction<DoubleArray,Double,Double> valueFunction,
BiFunction<DoubleArray,Double,Double> derivativeFunction,
BiFunction<DoubleArray,Double,DoubleArray> sensitivityFunction)
Obtains an instance.
|
ParameterizedFunctionalCurve.Builder |
toBuilder()
Returns a builder that allows this bean to be mutated.
|
String |
toString() |
ParameterizedFunctionalCurve |
withMetadata(CurveMetadata metadata)
Returns a new curve with the specified metadata.
|
ParameterizedFunctionalCurve |
withParameter(int parameterIndex,
double newValue)
Returns a copy of the data with the value at the specified index altered.
|
ParameterizedFunctionalCurve |
withParameters(DoubleArray parameters)
Returns a copy of the curve with all of the parameters altered.
|
ParameterizedFunctionalCurve |
withPerturbation(ParameterPerturbation perturbation)
Returns a perturbed copy of the data.
|
double |
yValue(double x)
Computes the y-value for the specified x-value.
|
UnitParameterSensitivity |
yValueParameterSensitivity(double x)
Computes the sensitivity of the y-value with respect to the curve parameters.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitfindParameterIndex, getName, getParameterMetadata, split, withUnderlyingCurvepublic static ParameterizedFunctionalCurve of(CurveMetadata metadata, DoubleArray parameters, BiFunction<DoubleArray,Double,Double> valueFunction, BiFunction<DoubleArray,Double,Double> derivativeFunction, BiFunction<DoubleArray,Double,DoubleArray> sensitivityFunction)
metadata - the metadataparameters - the parametersvalueFunction - the value functionderivativeFunction - the derivative functionsensitivityFunction - the parameter sensitivity functionpublic int getParameterCount()
ParameterizedDataThis returns the number of parameters, which can be used to create a loop to access the other methods on this interface.
getParameterCount in interface ParameterizedDatapublic double getParameter(int parameterIndex)
ParameterizedDatagetParameter in interface ParameterizedDataparameterIndex - the zero-based index of the parameter to getpublic ParameterizedFunctionalCurve withParameter(int parameterIndex, double newValue)
ParameterizedDataThis instance is immutable and unaffected by this method call.
withParameter in interface CurvewithParameter in interface ParameterizedDataparameterIndex - the zero-based index of the parameter to getnewValue - the new value for the specified parameterpublic ParameterizedFunctionalCurve withPerturbation(ParameterPerturbation perturbation)
ParameterizedDataThe perturbation instance will be invoked once for each parameter in this instance, returning the perturbed value for that parameter. The result of this method is a new instance that is based on those perturbed values.
This instance is immutable and unaffected by this method call.
withPerturbation in interface CurvewithPerturbation in interface ParameterizedDataperturbation - the perturbation to applypublic double yValue(double x)
Curvepublic UnitParameterSensitivity yValueParameterSensitivity(double x)
CurveThis returns an array with one element for each parameter of the curve. The array contains the sensitivity of the y-value at the specified x-value to each parameter.
yValueParameterSensitivity in interface Curvex - the x-value at which the parameter sensitivity is computedpublic double firstDerivative(double x)
Curve
The first derivative is dy/dx.
firstDerivative in interface Curvex - the x-value at which the derivative is takenpublic ParameterizedFunctionalCurve withMetadata(CurveMetadata metadata)
CurveThis allows the metadata of the curve to be changed while retaining all other information. If parameter metadata is present, the size of the list must match the number of parameters of this curve.
withMetadata in interface Curvemetadata - the new metadata for the curvepublic ParameterizedFunctionalCurve withParameters(DoubleArray parameters)
This instance is immutable and unaffected by this method call.
parameters - the new parameterspublic UnitParameterSensitivity createParameterSensitivity(DoubleArray sensitivities)
Curve
In most cases, Curve.yValueParameterSensitivity(double) should be used and manipulated.
However, it can be useful to create a UnitParameterSensitivity from pre-computed sensitivity values.
createParameterSensitivity in interface Curvesensitivities - the sensitivity values, which must match the parameter count of the curvepublic CurrencyParameterSensitivity createParameterSensitivity(Currency currency, DoubleArray sensitivities)
Curve
In most cases, Curve.yValueParameterSensitivity(double) should be used and manipulated.
However, it can be useful to create a CurrencyParameterSensitivity from pre-computed sensitivity values.
createParameterSensitivity in interface Curvecurrency - the currencysensitivities - the sensitivity values, which must match the parameter count of the curvepublic static ParameterizedFunctionalCurve.Meta meta()
ParameterizedFunctionalCurve.public static ParameterizedFunctionalCurve.Builder builder()
public ParameterizedFunctionalCurve.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic CurveMetadata getMetadata()
The metadata includes an optional list of parameter metadata. If present, the size of the parameter metadata list will match the number of parameters of this curve.
getMetadata in interface Curvepublic DoubleArray getParameters()
public BiFunction<DoubleArray,Double,Double> getValueFunction()
The function takes parameters and x-value, then returns y-value.
public BiFunction<DoubleArray,Double,Double> getDerivativeFunction()
The function takes parameters and x-value, then returns the first derivative of y-value with respective to x,
i.e., the gradient of the curve.
public BiFunction<DoubleArray,Double,DoubleArray> getSensitivityFunction()
The function takes parameters and x-value, then returns the sensitivities of y-value to the parameters.
public ParameterizedFunctionalCurve.Builder toBuilder()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.