public final class InterpolatedNodalCube extends Object implements NodalCube, org.joda.beans.ImmutableBean, Serializable
This class defines a cube in terms of a fixed number of nodes, referred to as parameters.
Each node has x-value, y-value, z-value, w-value. The interface is focused on finding the w-value for a given x-value, y-value, z-value. An interpolator is used to find w-values for x-values, y-values, z-values between nodes.
| Modifier and Type | Class and Description |
|---|---|
static class |
InterpolatedNodalCube.Builder
The bean-builder for
InterpolatedNodalCube. |
static class |
InterpolatedNodalCube.Meta
The meta-bean for
InterpolatedNodalCube. |
| Modifier and Type | Method and Description |
|---|---|
static InterpolatedNodalCube.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 cube when the sensitivity values are known.
|
UnitParameterSensitivity |
createParameterSensitivity(DoubleArray sensitivities)
Creates a parameter sensitivity instance for this cube when the sensitivity values are known.
|
boolean |
equals(Object obj) |
ValueDerivatives |
firstPartialDerivatives(double x,
double y,
double z)
Computes the partial derivatives of the cube.
|
CubeInterpolator |
getInterpolator()
Gets the underlying interpolator.
|
CubeMetadata |
getMetadata()
Gets the cube metadata.
|
double |
getParameter(int parameterIndex)
Gets the value of the parameter at the specified index.
|
int |
getParameterCount()
Gets the number of parameters.
|
DoubleArray |
getWValues()
Gets the array of w-values, one for each point.
|
DoubleArray |
getXValues()
Gets the array of x-values, one for each point.
|
DoubleArray |
getYValues()
Gets the array of y-values, one for each point.
|
DoubleArray |
getZValues()
Gets the array of z-values, one for each point.
|
int |
hashCode() |
static InterpolatedNodalCube.Meta |
meta()
The meta-bean for
InterpolatedNodalCube. |
InterpolatedNodalCube.Meta |
metaBean() |
static InterpolatedNodalCube |
of(CubeMetadata metadata,
DoubleArray xValues,
DoubleArray yValues,
DoubleArray zValues,
DoubleArray wValues,
CubeInterpolator interpolator)
Creates an interpolated cube with metadata.
|
static InterpolatedNodalCube |
ofUnsorted(CubeMetadata metadata,
DoubleArray xValues,
DoubleArray yValues,
DoubleArray zValues,
DoubleArray wValues,
CubeInterpolator interpolator)
Creates an interpolated cube with metadata, where the values are not sorted.
|
InterpolatedNodalCube.Builder |
toBuilder()
Returns a builder that allows this bean to be mutated.
|
String |
toString() |
InterpolatedNodalCube |
withMetadata(CubeMetadata metadata)
Returns a new cube with the specified metadata.
|
InterpolatedNodalCube |
withParameter(int parameterIndex,
double newValue)
Returns a copy of the data with the value at the specified index altered.
|
InterpolatedNodalCube |
withPerturbation(ParameterPerturbation perturbation)
Returns a perturbed copy of the data.
|
InterpolatedNodalCube |
withWValues(DoubleArray wValues)
Returns a new cube with the specified values.
|
double |
wValue(double x,
double y,
double z)
Computes the w-value for the specified x-value, y-value, z-value.
|
UnitParameterSensitivity |
wValueParameterSensitivity(double x,
double y,
double z)
Computes the sensitivity of the w-value with respect to the cube parameters.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetParameterMetadatafindParameterIndex, getNamepublic static InterpolatedNodalCube of(CubeMetadata metadata, DoubleArray xValues, DoubleArray yValues, DoubleArray zValues, DoubleArray wValues, CubeInterpolator interpolator)
The value arrays must be sorted, by x-values then y-values, z-values. An exception is thrown if they are not sorted.
metadata - the cube metadataxValues - the x-values, must be sorted from low to highyValues - the y-values, must be sorted from low to high within xzValues - the z-values, must be sorted from low to high within x, ywValues - the w-valuesinterpolator - the interpolatorpublic static InterpolatedNodalCube ofUnsorted(CubeMetadata metadata, DoubleArray xValues, DoubleArray yValues, DoubleArray zValues, DoubleArray wValues, CubeInterpolator interpolator)
The value arrays will be sorted, by x-values then y-values, z-values. Both the w-values and parameter metadata will be sorted along with the x, y, z values.
metadata - the cube metadataxValues - the x-valuesyValues - the y-valueszValues - the z-valueswValues - the w-valuesinterpolator - the interpolatorpublic 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 InterpolatedNodalCube withParameter(int parameterIndex, double newValue)
ParameterizedDataThis instance is immutable and unaffected by this method call.
withParameter in interface CubewithParameter in interface NodalCubewithParameter in interface ParameterizedDataparameterIndex - the zero-based index of the parameter to getnewValue - the new value for the specified parameterpublic InterpolatedNodalCube 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 CubewithPerturbation in interface NodalCubewithPerturbation in interface ParameterizedDataperturbation - the perturbation to applypublic double wValue(double x,
double y,
double z)
Cubepublic UnitParameterSensitivity wValueParameterSensitivity(double x, double y, double z)
CubeThis returns an array with one element for each x-y-z parameter of the cube. The array contains one a sensitivity value for each parameter used to create the cube.
wValueParameterSensitivity in interface Cubex - the x-value at which the parameter sensitivity is computedy - the y-value at which the parameter sensitivity is computedz - the z-value at which the parameter sensitivity is computedpublic ValueDerivatives firstPartialDerivatives(double x, double y, double z)
Cube
The first derivatives are dw/dx, dw/dy, dw/dz.
The derivatives are in the following order:
firstPartialDerivatives in interface Cubex - the x-value at which the partial derivative is takeny - the y-value at which the partial derivative is takenz - the z-value at which the partial derivative is takenpublic InterpolatedNodalCube withMetadata(CubeMetadata metadata)
NodalCubeThis allows the metadata of the cube 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 cube.
withMetadata in interface CubewithMetadata in interface NodalCubemetadata - the new metadata for the cubepublic InterpolatedNodalCube withWValues(DoubleArray wValues)
NodalCubeThis allows the w-values of the cube to be changed while retaining the same x-values, y-values, z-values.
withWValues in interface NodalCubewValues - the new w-values for the cubepublic UnitParameterSensitivity createParameterSensitivity(DoubleArray sensitivities)
Cube
It can be useful to create a UnitParameterSensitivity from pre-computed sensitivity values.
createParameterSensitivity in interface Cubesensitivities - the sensitivity values, which must match the parameter count of the cubepublic CurrencyParameterSensitivity createParameterSensitivity(Currency currency, DoubleArray sensitivities)
Cube
It can be useful to create a CurrencyParameterSensitivity from pre-computed sensitivity values.
createParameterSensitivity in interface Cubecurrency - the currencysensitivities - the sensitivity values, which must match the parameter count of the cubepublic static InterpolatedNodalCube.Meta meta()
InterpolatedNodalCube.public static InterpolatedNodalCube.Builder builder()
public InterpolatedNodalCube.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic CubeMetadata 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 cube.
getMetadata in interface Cubepublic DoubleArray getXValues()
This array will contains at least two elements.
getXValues in interface NodalCubepublic DoubleArray getYValues()
This array will contains at least two elements and be of the same length as x-values.
getYValues in interface NodalCubepublic DoubleArray getZValues()
This array will contains at least two elements and be of the same length as x-values.
getZValues in interface NodalCubepublic DoubleArray getWValues()
This array will contains at least two elements and be of the same length as x-values.
getWValues in interface NodalCubepublic CubeInterpolator getInterpolator()
public InterpolatedNodalCube.Builder toBuilder()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.