Class DeformedSurface
- java.lang.Object
-
- com.opengamma.strata.market.surface.DeformedSurface
-
- All Implemented Interfaces:
ParameterizedData
,Surface
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class DeformedSurface extends Object implements Surface, org.joda.beans.ImmutableBean, Serializable
The deformed surface.The deformation is applied to
Surface
, and defined in terms ofFunction
, which returns z-value and sensitivities to the nodes of the original surface.Typical application of this class is to represent a surface constructed via model calibration to interpolated market data, where the market data points and interpolation are stored in
originalSurface
, anddeformationFunction
defines the constructed surface.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DeformedSurface.Builder
The bean-builder forDeformedSurface
.static class
DeformedSurface.Meta
The meta-bean forDeformedSurface
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DeformedSurface.Builder
builder()
Returns a builder used to create an instance of the bean.boolean
equals(Object obj)
ValueDerivatives
firstPartialDerivatives(double x, double y)
Computes the partial derivatives of the surface.Function<DoublesPair,ValueDerivatives>
getDeformationFunction()
Gets the deformation function.SurfaceMetadata
getMetadata()
Gets the surface metadata.Surface
getOriginalSurface()
Gets the original surface.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.int
hashCode()
static DeformedSurface.Meta
meta()
The meta-bean forDeformedSurface
.DeformedSurface.Meta
metaBean()
static DeformedSurface
of(SurfaceMetadata metadata, Surface originalSurface, Function<DoublesPair,ValueDerivatives> deformationFunction)
Obtains an instance.DeformedSurface.Builder
toBuilder()
Returns a builder that allows this bean to be mutated.String
toString()
DeformedSurface
withMetadata(SurfaceMetadata metadata)
Returns a new surface with the specified metadata.Surface
withParameter(int parameterIndex, double newValue)
Returns a copy of the data with the value at the specified index altered.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.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.opengamma.strata.market.surface.Surface
createParameterSensitivity, createParameterSensitivity, findParameterIndex, getName, withPerturbation, zValue, zValueParameterSensitivity
-
-
-
-
Method Detail
-
getParameterCount
public int getParameterCount()
Description copied from interface:ParameterizedData
Gets the number of parameters.This returns the number of parameters, which can be used to create a loop to access the other methods on this interface.
- Specified by:
getParameterCount
in interfaceParameterizedData
- Returns:
- the number of parameters
-
withMetadata
public DeformedSurface withMetadata(SurfaceMetadata metadata)
Description copied from interface:Surface
Returns a new surface with the specified metadata.This 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.
- Specified by:
withMetadata
in interfaceSurface
- Parameters:
metadata
- the new metadata for the surface- Returns:
- the new surface
-
getParameter
public double getParameter(int parameterIndex)
Description copied from interface:ParameterizedData
Gets the value of the parameter at the specified index.- Specified by:
getParameter
in interfaceParameterizedData
- Parameters:
parameterIndex
- the zero-based index of the parameter to get- Returns:
- the value of the parameter
-
getParameterMetadata
public ParameterMetadata getParameterMetadata(int parameterIndex)
Description copied from interface:ParameterizedData
Gets the metadata of the parameter at the specified index.If there is no specific parameter metadata, an empty instance will be returned.
- Specified by:
getParameterMetadata
in interfaceParameterizedData
- Specified by:
getParameterMetadata
in interfaceSurface
- Parameters:
parameterIndex
- the zero-based index of the parameter to get- Returns:
- the metadata of the parameter
-
withParameter
public Surface withParameter(int parameterIndex, double newValue)
Description copied from interface:ParameterizedData
Returns a copy of the data with the value at the specified index altered.This instance is immutable and unaffected by this method call.
- Specified by:
withParameter
in interfaceParameterizedData
- Specified by:
withParameter
in interfaceSurface
- Parameters:
parameterIndex
- the zero-based index of the parameter to getnewValue
- the new value for the specified parameter- Returns:
- a parameterized data instance based on this with the specified parameter altered
-
zValue
public double zValue(double x, double y)
Description copied from interface:Surface
Computes the z-value for the specified x-value and y-value.
-
zValueParameterSensitivity
public UnitParameterSensitivity zValueParameterSensitivity(double x, double y)
Description copied from interface:Surface
Computes the sensitivity of the z-value with respect to the surface parameters.This 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.
- Specified by:
zValueParameterSensitivity
in interfaceSurface
- Parameters:
x
- the x-value at which the parameter sensitivity is computedy
- the y-value at which the parameter sensitivity is computed- Returns:
- the sensitivity at the x/y/ point
-
firstPartialDerivatives
public ValueDerivatives firstPartialDerivatives(double x, double y)
Description copied from interface:Surface
Computes the partial derivatives of the surface.The first derivatives are
dz/dx and dz/dy
. The derivatives are in the following order:- [0] derivative with respect to x
- [1] derivative with respect to y
- Specified by:
firstPartialDerivatives
in interfaceSurface
- Parameters:
x
- the x-value at which the partial derivative is takeny
- the y-value at which the partial derivative is taken- Returns:
- the z-value and it's partial first derivatives
-
of
public static DeformedSurface of(SurfaceMetadata metadata, Surface originalSurface, Function<DoublesPair,ValueDerivatives> deformationFunction)
Obtains an instance.- Parameters:
metadata
- the surface metadataoriginalSurface
- the original surfacedeformationFunction
- the deformation function- Returns:
- the surface
-
meta
public static DeformedSurface.Meta meta()
The meta-bean forDeformedSurface
.- Returns:
- the meta-bean, not null
-
builder
public static DeformedSurface.Builder builder()
Returns a builder used to create an instance of the bean.- Returns:
- the builder, not null
-
metaBean
public DeformedSurface.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getMetadata
public SurfaceMetadata getMetadata()
Gets the surface metadata.The metadata includes an optional list of parameter metadata.
- Specified by:
getMetadata
in interfaceSurface
- Returns:
- the value of the property, not null
-
getOriginalSurface
public Surface getOriginalSurface()
Gets the original surface.The underlying surface which receives the deformation defined by
deformationFunction
.- Returns:
- the value of the property, not null
-
getDeformationFunction
public Function<DoublesPair,ValueDerivatives> getDeformationFunction()
Gets the deformation function.The deformation to the original surface is define by this function. The function takes
DoublesPair
of x-value and y-value, then returnsValueDerivatives
which contains z-value for the specified x,y values, and node sensitivities to the original surface.- Returns:
- the value of the property, not null
-
toBuilder
public DeformedSurface.Builder toBuilder()
Returns a builder that allows this bean to be mutated.- Returns:
- the mutable builder, not null
-
-