public interface Curve extends ParameterizedData
double x-value to a double y-value.
Implementations of this interface provide the ability to find a y-value on the curve from the x-value.
Each implementation will be backed by a number of parameters. The meaning of the parameters is implementation dependent. The sensitivity of the result to each of the parameters can also be obtained.
InterpolatedNodalCurve| Modifier and Type | Method and Description |
|---|---|
default CurrencyParameterSensitivity |
createParameterSensitivity(Currency currency,
DoubleArray sensitivities)
Creates a parameter sensitivity instance for this curve when the sensitivity values are known.
|
default UnitParameterSensitivity |
createParameterSensitivity(DoubleArray sensitivities)
Creates a parameter sensitivity instance for this curve when the sensitivity values are known.
|
default OptionalInt |
findParameterIndex(ParameterMetadata metadata)
Finds the parameter index of the specified metadata.
|
double |
firstDerivative(double x)
Computes the first derivative of the curve.
|
CurveMetadata |
getMetadata()
Gets the curve metadata.
|
default CurveName |
getName()
Gets the curve name.
|
default ParameterMetadata |
getParameterMetadata(int parameterIndex)
Gets the metadata of the parameter at the specified index.
|
default ImmutableList<Curve> |
split()
Obtains a list of underlying curves.
|
Curve |
withMetadata(CurveMetadata metadata)
Returns a new curve with the specified metadata.
|
Curve |
withParameter(int parameterIndex,
double newValue)
Returns a copy of the data with the value at the specified index altered.
|
default Curve |
withPerturbation(ParameterPerturbation perturbation)
Returns a perturbed copy of the data.
|
default Curve |
withUnderlyingCurve(int curveIndex,
Curve curve)
Replaces an underlying curve by a new curve.
|
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.
|
getParameter, getParameterCountCurveMetadata getMetadata()
This method returns metadata about the curve and the curve parameters.
For example, a curve may be defined based on financial instruments.
The parameters might represent 1 day, 1 week, 1 month, 3 months, 6 months and 12 months.
The metadata could be used to describe each parameter in terms of a Period.
The metadata includes an optional list of parameter metadata. If parameter metadata is present, the size of the list will match the number of parameters of this curve.
Curve withMetadata(CurveMetadata metadata)
This 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.
metadata - the new metadata for the curvedefault CurveName getName()
default ParameterMetadata getParameterMetadata(int parameterIndex)
ParameterizedDataIf there is no specific parameter metadata, an empty instance will be returned.
getParameterMetadata in interface ParameterizedDataparameterIndex - the zero-based index of the parameter to getdefault OptionalInt findParameterIndex(ParameterMetadata metadata)
ParameterizedDataIf the parameter metadata is not matched, an empty optional will be returned.
findParameterIndex in interface ParameterizedDatametadata - the parameter metadata to find the index ofCurve withParameter(int parameterIndex, double newValue)
ParameterizedDataThis instance is immutable and unaffected by this method call.
withParameter in interface ParameterizedDataparameterIndex - the zero-based index of the parameter to getnewValue - the new value for the specified parameterdefault Curve 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 ParameterizedDataperturbation - the perturbation to applydouble yValue(double x)
x - the x-value to find the y-value forUnitParameterSensitivity yValueParameterSensitivity(double x)
This 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.
x - the x-value at which the parameter sensitivity is computedRuntimeException - if the sensitivity cannot be calculateddouble firstDerivative(double x)
The first derivative is dy/dx.
x - the x-value at which the derivative is takenRuntimeException - if the derivative cannot be calculateddefault UnitParameterSensitivity createParameterSensitivity(DoubleArray sensitivities)
In most cases, yValueParameterSensitivity(double) should be used and manipulated.
However, it can be useful to create a UnitParameterSensitivity from pre-computed sensitivity values.
sensitivities - the sensitivity values, which must match the parameter count of the curvedefault CurrencyParameterSensitivity createParameterSensitivity(Currency currency, DoubleArray sensitivities)
In most cases, yValueParameterSensitivity(double) should be used and manipulated.
However, it can be useful to create a CurrencyParameterSensitivity from pre-computed sensitivity values.
currency - the currencysensitivities - the sensitivity values, which must match the parameter count of the curvedefault ImmutableList<Curve> split()
In most cases, the number of underlying curves is 1, thus a list of this curve is returned.
default Curve withUnderlyingCurve(int curveIndex, Curve curve)
curveIndex must be coherent to the index of the list in split().
curveIndex - the curve indexcurve - the new split curveIllegalArgumentException - if curveIndex is outside the rangeCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.