Class DeformedSurface

  • All Implemented Interfaces:
    ParameterizedData, Surface, java.io.Serializable, org.joda.beans.Bean, org.joda.beans.ImmutableBean

    public final class DeformedSurface
    extends java.lang.Object
    implements Surface, org.joda.beans.ImmutableBean, java.io.Serializable
    The deformed surface.

    The deformation is applied to Surface, and defined in terms of Function, 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, and deformationFunction defines the constructed surface.

    See Also:
    Serialized Form
    • 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 interface ParameterizedData
        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 interface Surface
        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 interface ParameterizedData
        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 interface ParameterizedData
        Specified by:
        getParameterMetadata in interface Surface
        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 interface ParameterizedData
        Specified by:
        withParameter in interface Surface
        Parameters:
        parameterIndex - the zero-based index of the parameter to get
        newValue - 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.
        Specified by:
        zValue in interface Surface
        Parameters:
        x - the x-value to find the z-value for
        y - the y-value to find the z-value for
        Returns:
        the value at the x/y point
      • 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 interface Surface
        Parameters:
        x - the x-value at which the parameter sensitivity is computed
        y - the y-value at which the parameter sensitivity is computed
        Returns:
        the sensitivity at the x/y/ point
      • of

        public static DeformedSurface of​(SurfaceMetadata metadata,
                                         Surface originalSurface,
                                         java.util.function.Function<DoublesPair,​ValueDerivatives> deformationFunction)
        Obtains an instance.
        Parameters:
        metadata - the surface metadata
        originalSurface - the original surface
        deformationFunction - the deformation function
        Returns:
        the surface
      • meta

        public static DeformedSurface.Meta meta()
        The meta-bean for DeformedSurface.
        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 interface org.joda.beans.Bean
      • getMetadata

        public SurfaceMetadata getMetadata()
        Gets the surface metadata.

        The metadata includes an optional list of parameter metadata.

        Specified by:
        getMetadata in interface Surface
        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 java.util.function.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 returns ValueDerivatives 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
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object