public final class CombinedCurve extends Object implements Curve, org.joda.beans.ImmutableBean, Serializable
The parameters of this curve are the combination of the base curve parameters and spread curve parameters. The node sensitivities are calculated in terms of the nodes on the base curve and spread curve.
If one of the two curves must be fixed, use AddFixedCurve.
| Modifier and Type | Class and Description |
|---|---|
static class |
CombinedCurve.Meta
The meta-bean for
CombinedCurve. |
| Modifier and Type | Method and Description |
|---|---|
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.
|
Curve |
getBaseCurve()
Gets the base curve.
|
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.
|
ParameterMetadata |
getParameterMetadata(int parameterIndex)
Gets the metadata of the parameter at the specified index.
|
Curve |
getSpreadCurve()
Gets the spread curve.
|
int |
hashCode() |
static CombinedCurve.Meta |
meta()
The meta-bean for
CombinedCurve. |
CombinedCurve.Meta |
metaBean() |
static CombinedCurve |
of(Curve baseCurve,
Curve spreadCurve)
Creates a curve as the sum of a base curve and a spread curve.
|
static CombinedCurve |
of(Curve baseCurve,
Curve spreadCurve,
CurveMetadata metadata)
Creates a curve as the sum of a base curve and a spread curve with a specified curve metadata.
|
ImmutableList<Curve> |
split()
Obtains a list of underlying curves.
|
String |
toString() |
CombinedCurve |
withMetadata(CurveMetadata metadata)
Returns a new curve with the specified metadata.
|
CombinedCurve |
withParameter(int parameterIndex,
double newValue)
Returns a copy of the data with the value at the specified index altered.
|
CombinedCurve |
withPerturbation(ParameterPerturbation perturbation)
Returns a perturbed copy of the data.
|
CombinedCurve |
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.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitfindParameterIndex, getNamepublic static CombinedCurve of(Curve baseCurve, Curve spreadCurve, CurveMetadata metadata)
baseCurve - the base curvespreadCurve - the spread curvemetadata - the metadatapublic static CombinedCurve of(Curve baseCurve, Curve spreadCurve)
The metadata of the combined curve will be created form the base curve and spread curve.
baseCurve - the base curvespreadCurve - the spread curvepublic CombinedCurve 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 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 ParameterMetadata getParameterMetadata(int parameterIndex)
ParameterizedDataIf there is no specific parameter metadata, an empty instance will be returned.
getParameterMetadata in interface CurvegetParameterMetadata in interface ParameterizedDataparameterIndex - the zero-based index of the parameter to getpublic CombinedCurve 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 CombinedCurve 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 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 ImmutableList<Curve> split()
CurveIn most cases, the number of underlying curves is 1, thus a list of this curve is returned.
public CombinedCurve withUnderlyingCurve(int curveIndex, Curve curve)
Curve
curveIndex must be coherent to the index of the list in split().
withUnderlyingCurve in interface CurvecurveIndex - the curve indexcurve - the new split curvepublic static CombinedCurve.Meta meta()
CombinedCurve.public CombinedCurve.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic Curve getBaseCurve()
public Curve getSpreadCurve()
public CurveMetadata getMetadata()
getMetadata in interface CurveCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.