public final class InterpolatedNodalSurface extends Object implements NodalSurface, org.joda.beans.ImmutableBean, Serializable
This class defines a surface in terms of a fixed number of nodes, referred to as parameters.
Each node has an x-value and a y-value. The interface is focused on finding the z-value for a given x-value and y-value. An interpolator is used to find z-values for x-values and y-values between two nodes.
| Modifier and Type | Class and Description |
|---|---|
static class |
InterpolatedNodalSurface.Builder
The bean-builder for
InterpolatedNodalSurface. |
static class |
InterpolatedNodalSurface.Meta
The meta-bean for
InterpolatedNodalSurface. |
| Modifier and Type | Method and Description |
|---|---|
static InterpolatedNodalSurface.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 surface when the sensitivity values are known.
|
UnitParameterSensitivity |
createParameterSensitivity(DoubleArray sensitivities)
Creates a parameter sensitivity instance for this surface when the sensitivity values are known.
|
boolean |
equals(Object obj) |
ValueDerivatives |
firstPartialDerivatives(double x,
double y)
Computes the partial derivatives of the surface.
|
SurfaceInterpolator |
getInterpolator()
Gets the underlying interpolator.
|
SurfaceMetadata |
getMetadata()
Gets the surface metadata.
|
double |
getParameter(int parameterIndex)
Gets the value of the parameter at the specified index.
|
int |
getParameterCount()
Gets the number of parameters.
|
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 InterpolatedNodalSurface.Meta |
meta()
The meta-bean for
InterpolatedNodalSurface. |
InterpolatedNodalSurface.Meta |
metaBean() |
static InterpolatedNodalSurface |
of(SurfaceMetadata metadata,
DoubleArray xValues,
DoubleArray yValues,
DoubleArray zValues,
SurfaceInterpolator interpolator)
Creates an interpolated surface with metadata.
|
static InterpolatedNodalSurface |
ofUnsorted(SurfaceMetadata metadata,
DoubleArray xValues,
DoubleArray yValues,
DoubleArray zValues,
SurfaceInterpolator interpolator)
Creates an interpolated surface with metadata, where the values are not sorted.
|
InterpolatedNodalSurface.Builder |
toBuilder()
Returns a builder that allows this bean to be mutated.
|
String |
toString() |
InterpolatedNodalSurface |
withMetadata(SurfaceMetadata metadata)
Returns a new surface with the specified metadata.
|
InterpolatedNodalSurface |
withParameter(int parameterIndex,
double newValue)
Returns a copy of the data with the value at the specified index altered.
|
InterpolatedNodalSurface |
withPerturbation(ParameterPerturbation perturbation)
Returns a perturbed copy of the data.
|
InterpolatedNodalSurface |
withZValues(DoubleArray zValues)
Returns a new surface with the specified values.
|
double |
zValue(double x,
double y)
Computes the z-value for the specified x-value and y-value.
|
UnitParameterSensitivity |
zValueParameterSensitivity(double x,
double y)
Computes the sensitivity of the z-value with respect to the surface parameters.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetParameterMetadatafindParameterIndex, getName, zValue, zValueParameterSensitivitypublic static InterpolatedNodalSurface of(SurfaceMetadata metadata, DoubleArray xValues, DoubleArray yValues, DoubleArray zValues, SurfaceInterpolator interpolator)
The value arrays must be sorted, by x-values then y-values. An exception is thrown if they are not sorted.
metadata - the surface 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-valuesinterpolator - the interpolatorpublic static InterpolatedNodalSurface ofUnsorted(SurfaceMetadata metadata, DoubleArray xValues, DoubleArray yValues, DoubleArray zValues, SurfaceInterpolator interpolator)
The value arrays will be sorted, by x-values then y-values. Both the z-values and parameter metadata will be sorted along with the x and y values.
metadata - the surface metadataxValues - the x-valuesyValues - the y-valueszValues - the z-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 InterpolatedNodalSurface withParameter(int parameterIndex, double newValue)
ParameterizedDataThis instance is immutable and unaffected by this method call.
withParameter in interface ParameterizedDatawithParameter in interface NodalSurfacewithParameter in interface SurfaceparameterIndex - the zero-based index of the parameter to getnewValue - the new value for the specified parameterpublic InterpolatedNodalSurface 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 ParameterizedDatawithPerturbation in interface NodalSurfacewithPerturbation in interface Surfaceperturbation - the perturbation to applypublic double zValue(double x,
double y)
Surfacepublic UnitParameterSensitivity zValueParameterSensitivity(double x, double y)
SurfaceThis returns an array with one element for each x-y parameter of the surface. The array contains one a sensitivity value for each parameter used to create the surface.
zValueParameterSensitivity in interface Surfacex - the x-value at which the parameter sensitivity is computedy - the y-value at which the parameter sensitivity is computedpublic ValueDerivatives firstPartialDerivatives(double x, double y)
Surface
The first derivatives are dz/dx and dz/dy.
The derivatives are in the following order:
firstPartialDerivatives in interface Surfacex - the x-value at which the partial derivative is takeny - the y-value at which the partial derivative is takenpublic InterpolatedNodalSurface withMetadata(SurfaceMetadata metadata)
NodalSurfaceThis allows the metadata of the surface 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 surface.
withMetadata in interface NodalSurfacewithMetadata in interface Surfacemetadata - the new metadata for the surfacepublic InterpolatedNodalSurface withZValues(DoubleArray zValues)
NodalSurfaceThis allows the z-values of the surface to be changed while retaining the same x-values and y-values.
withZValues in interface NodalSurfacezValues - the new y-values for the surfacepublic UnitParameterSensitivity createParameterSensitivity(DoubleArray sensitivities)
Surface
In most cases, Surface.zValueParameterSensitivity(double, double) should be used and manipulated.
However, it can be useful to create a UnitParameterSensitivity from pre-computed sensitivity values.
createParameterSensitivity in interface Surfacesensitivities - the sensitivity values, which must match the parameter count of the surfacepublic CurrencyParameterSensitivity createParameterSensitivity(Currency currency, DoubleArray sensitivities)
Surface
In most cases, Surface.zValueParameterSensitivity(double, double) should be used and manipulated.
However, it can be useful to create a CurrencyParameterSensitivity from pre-computed sensitivity values.
createParameterSensitivity in interface Surfacecurrency - the currencysensitivities - the sensitivity values, which must match the parameter count of the surfacepublic static InterpolatedNodalSurface.Meta meta()
InterpolatedNodalSurface.public static InterpolatedNodalSurface.Builder builder()
public InterpolatedNodalSurface.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic SurfaceMetadata 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 surface.
getMetadata in interface Surfacepublic DoubleArray getXValues()
This array will contains at least two elements.
getXValues in interface NodalSurfacepublic DoubleArray getYValues()
This array will contains at least two elements and be of the same length as x-values.
getYValues in interface NodalSurfacepublic DoubleArray getZValues()
This array will contains at least two elements and be of the same length as x-values.
getZValues in interface NodalSurfacepublic SurfaceInterpolator getInterpolator()
public InterpolatedNodalSurface.Builder toBuilder()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.