public final class ConstantSurface extends Object implements Surface, org.joda.beans.ImmutableBean, Serializable
This class defines a surface in terms of a single parameter, the constant value.
When queried, zValue(double, double) always returns the constant value.
The sensitivity is 1 and the first derivative is 0.
The surface has one parameter, the value of the constant.
| Modifier and Type | Class and Description |
|---|---|
static class |
ConstantSurface.Meta
The meta-bean for
ConstantSurface. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
ValueDerivatives |
firstPartialDerivatives(double x,
double y)
Computes the partial derivatives of the surface.
|
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.
|
double |
getZValue()
Gets the single z-value.
|
int |
hashCode() |
static ConstantSurface.Meta |
meta()
The meta-bean for
ConstantSurface. |
ConstantSurface.Meta |
metaBean() |
static ConstantSurface |
of(String name,
double zValue)
Creates a constant surface with a specific value.
|
static ConstantSurface |
of(SurfaceMetadata metadata,
double zValue)
Creates a constant surface with a specific value.
|
static ConstantSurface |
of(SurfaceName name,
double zValue)
Creates a constant surface with a specific value.
|
String |
toString() |
ConstantSurface |
withMetadata(SurfaceMetadata metadata)
Returns a new surface with the specified metadata.
|
ConstantSurface |
withParameter(int parameterIndex,
double newValue)
Returns a copy of the data with the value at the specified index altered.
|
ConstantSurface |
withPerturbation(ParameterPerturbation perturbation)
Returns a perturbed copy of the data.
|
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, waitcreateParameterSensitivity, createParameterSensitivity, findParameterIndex, getName, getParameterMetadata, zValue, zValueParameterSensitivitypublic static ConstantSurface of(String name, double zValue)
name - the surface namezValue - the constant z-valuepublic static ConstantSurface of(SurfaceName name, double zValue)
name - the surface namezValue - the constant z-valuepublic static ConstantSurface of(SurfaceMetadata metadata, double zValue)
metadata - the surface metadatazValue - the constant z-valuepublic 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 ConstantSurface withParameter(int parameterIndex, double newValue)
ParameterizedDataThis instance is immutable and unaffected by this method call.
withParameter in interface ParameterizedDatawithParameter in interface SurfaceparameterIndex - the zero-based index of the parameter to getnewValue - the new value for the specified parameterpublic ConstantSurface 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 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 ConstantSurface withMetadata(SurfaceMetadata metadata)
SurfaceThis 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 Surfacemetadata - the new metadata for the surfacepublic static ConstantSurface.Meta meta()
ConstantSurface.public ConstantSurface.Meta metaBean()
metaBean in interface org.joda.beans.Beanpublic SurfaceMetadata getMetadata()
The metadata will have not have parameter metadata.
getMetadata in interface Surfacepublic double getZValue()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.