Class SingleSegmentLagrangePolynomial

java.lang.Object
org.drip.spline.stretch.SingleSegmentLagrangePolynomial
All Implemented Interfaces:
SingleSegmentSequence

public class SingleSegmentLagrangePolynomial
extends java.lang.Object
implements SingleSegmentSequence
SingleSegmentLagrangePolynomial implements the SingleSegmentSequence Stretch interface using the Lagrange Polynomial Estimator. As such it provides a perfect fit that travels through all the predictor/response pairs causing Runge's instability.
Module Product Core Module
Library Fixed Income Analytics
Project Basis Splines and Linear Compounders across a Broad Family of Spline Basis Functions
Package Multi-Segment Sequence Spline Stretch

Author:
Lakshmi Krishnamurthy
  • Constructor Summary

    Constructors
    Constructor Description
    SingleSegmentLagrangePolynomial​(double[] predictorOrdinateArray)
    SingleSegmentLagrangePolynomial constructor
  • Method Summary

    Modifier and Type Method Description
    double getLeftPredictorOrdinateEdge()
    Return the Left Predictor Ordinate Edge
    double getRightPredictorOrdinateEdge()
    Return the Right Predictor Ordinate Edge
    boolean isCoMonotone​(double[] measuredResponseArray)
    Verify whether the Stretch mini-max Behavior matches the Measurement
    boolean isKnot​(double predictorOrdinate)
    Is the given Predictor Ordinate a Knot Location
    boolean isLocallyMonotone()
    Indicate if all the comprising Segments are Monotone
    WengertJacobian jackDResponseDCalibrationInput​(double predictorOrdinate, int order)
    Calculate the Response Derivative to the Calibration Inputs at the specified Ordinate
    WengertJacobian jackDResponseDManifestMeasure​(java.lang.String manifestMeasure, double predictorOrdinate, int order)
    Calculate the Response Derivative to the Manifest Measure at the specified Ordinate
    Monotonocity monotoneType​(double predictorOrdinate)
    Identify the Monotone Type for the Segment underlying the given Predictor Ordinate
    boolean resetNode​(int predictorOrdinateNodeIndex, double resetResponse)
    Reset the Predictor Ordinate Node Index with the given Response
    boolean resetNode​(int predictorOrdinateNodeIndex, SegmentResponseValueConstraint resetSegmentResponseValueConstraint)
    Reset the Predictor Ordinate Node Index with the given Segment Constraint
    double responseValue​(double predictorOrdinate)
    Calculate the Response Value at the given Predictor Ordinate
    double responseValueDerivative​(double predictorOrdinate, int order)
    Calculate the Response Value Derivative at the given Predictor Ordinate for the specified order
    boolean setup​(double leadingY, double[] responseValueArray, StretchBestFitResponse stretchBestFitResponse, BoundarySettings boundarySettings, int calibrationDetail)
    Set up (i.e., calibrate) the individual Segments in the Stretch to the Response Values corresponding to each Segment Predictor right Ordinate.
    R1ToR1 toAU()
    Convert the Segment Sequence into an AbstractUnivariate Instance

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SingleSegmentLagrangePolynomial

      public SingleSegmentLagrangePolynomial​(double[] predictorOrdinateArray) throws java.lang.Exception
      SingleSegmentLagrangePolynomial constructor
      Parameters:
      predictorOrdinateArray - Array of Predictor Ordinates
      Throws:
      java.lang.Exception - Thrown if inputs are invalid
  • Method Details

    • setup

      public boolean setup​(double leadingY, double[] responseValueArray, StretchBestFitResponse stretchBestFitResponse, BoundarySettings boundarySettings, int calibrationDetail)
      Description copied from interface: SingleSegmentSequence
      Set up (i.e., calibrate) the individual Segments in the Stretch to the Response Values corresponding to each Segment Predictor right Ordinate.
      Specified by:
      setup in interface SingleSegmentSequence
      Parameters:
      leadingY - Stretch Left-most Response
      responseValueArray - Array of Segment Right Edge Responses
      stretchBestFitResponse - Stretch Fitness Weighted Response
      boundarySettings - The Calibration Boundary Condition
      calibrationDetail - The Calibration Detail
      Returns:
      TRUE - Set up was successful
    • responseValue

      public double responseValue​(double predictorOrdinate) throws java.lang.Exception
      Description copied from interface: SingleSegmentSequence
      Calculate the Response Value at the given Predictor Ordinate
      Specified by:
      responseValue in interface SingleSegmentSequence
      Parameters:
      predictorOrdinate - Predictor Ordinate
      Returns:
      The Response Value
      Throws:
      java.lang.Exception - Thrown if the Response Value cannot be calculated
    • responseValueDerivative

      public double responseValueDerivative​(double predictorOrdinate, int order) throws java.lang.Exception
      Description copied from interface: SingleSegmentSequence
      Calculate the Response Value Derivative at the given Predictor Ordinate for the specified order
      Specified by:
      responseValueDerivative in interface SingleSegmentSequence
      Parameters:
      predictorOrdinate - Predictor Ordinate
      order - Order the Derivative
      Returns:
      The Response Value
      Throws:
      java.lang.Exception - Thrown if the Response Value Derivative cannot be calculated
    • jackDResponseDCalibrationInput

      public WengertJacobian jackDResponseDCalibrationInput​(double predictorOrdinate, int order)
      Description copied from interface: SingleSegmentSequence
      Calculate the Response Derivative to the Calibration Inputs at the specified Ordinate
      Specified by:
      jackDResponseDCalibrationInput in interface SingleSegmentSequence
      Parameters:
      predictorOrdinate - Predictor Ordinate
      order - Order of Derivative desired
      Returns:
      Jacobian of the Response Derivative to the Calibration Inputs at the Ordinate
    • jackDResponseDManifestMeasure

      public WengertJacobian jackDResponseDManifestMeasure​(java.lang.String manifestMeasure, double predictorOrdinate, int order)
      Description copied from interface: SingleSegmentSequence
      Calculate the Response Derivative to the Manifest Measure at the specified Ordinate
      Specified by:
      jackDResponseDManifestMeasure in interface SingleSegmentSequence
      Parameters:
      manifestMeasure - Manifest Measure whose Sensitivity is sought
      predictorOrdinate - Predictor Ordinate
      order - Order of Derivative desired
      Returns:
      Jacobian of the Response Derivative to the Quote at the Ordinate
    • monotoneType

      public Monotonocity monotoneType​(double predictorOrdinate)
      Description copied from interface: SingleSegmentSequence
      Identify the Monotone Type for the Segment underlying the given Predictor Ordinate
      Specified by:
      monotoneType in interface SingleSegmentSequence
      Parameters:
      predictorOrdinate - Predictor Ordinate
      Returns:
      Segment Monotone Type
    • isLocallyMonotone

      public boolean isLocallyMonotone() throws java.lang.Exception
      Description copied from interface: SingleSegmentSequence
      Indicate if all the comprising Segments are Monotone
      Specified by:
      isLocallyMonotone in interface SingleSegmentSequence
      Returns:
      TRUE - Fully locally monotonic
      Throws:
      java.lang.Exception - Thrown if the Segment Monotone Type could not be estimated
    • isCoMonotone

      public boolean isCoMonotone​(double[] measuredResponseArray) throws java.lang.Exception
      Description copied from interface: SingleSegmentSequence
      Verify whether the Stretch mini-max Behavior matches the Measurement
      Specified by:
      isCoMonotone in interface SingleSegmentSequence
      Parameters:
      measuredResponseArray - The Array of Measured Responses
      Returns:
      TRUE - Stretch is co-monotonic with the measured Responses
      Throws:
      java.lang.Exception - Thrown if the Segment Monotone Type could not be estimated
    • isKnot

      public boolean isKnot​(double predictorOrdinate)
      Description copied from interface: SingleSegmentSequence
      Is the given Predictor Ordinate a Knot Location
      Specified by:
      isKnot in interface SingleSegmentSequence
      Parameters:
      predictorOrdinate - Predictor Ordinate
      Returns:
      TRUE - Given Predictor Ordinate corresponds to a Knot
    • resetNode

      public boolean resetNode​(int predictorOrdinateNodeIndex, double resetResponse)
      Description copied from interface: SingleSegmentSequence
      Reset the Predictor Ordinate Node Index with the given Response
      Specified by:
      resetNode in interface SingleSegmentSequence
      Parameters:
      predictorOrdinateNodeIndex - The Predictor Ordinate Node Index whose Response is to be reset
      resetResponse - The Response to reset
      Returns:
      TRUE - Reset succeeded
    • resetNode

      public boolean resetNode​(int predictorOrdinateNodeIndex, SegmentResponseValueConstraint resetSegmentResponseValueConstraint)
      Description copied from interface: SingleSegmentSequence
      Reset the Predictor Ordinate Node Index with the given Segment Constraint
      Specified by:
      resetNode in interface SingleSegmentSequence
      Parameters:
      predictorOrdinateNodeIndex - The Predictor Ordinate Node Index whose Response is to be reset
      resetSegmentResponseValueConstraint - The Segment Constraint
      Returns:
      TRUE - Reset succeeded
    • toAU

      public R1ToR1 toAU()
      Description copied from interface: SingleSegmentSequence
      Convert the Segment Sequence into an AbstractUnivariate Instance
      Specified by:
      toAU in interface SingleSegmentSequence
      Returns:
      The AbstractUnivariate Instance
    • getLeftPredictorOrdinateEdge

      public double getLeftPredictorOrdinateEdge()
      Description copied from interface: SingleSegmentSequence
      Return the Left Predictor Ordinate Edge
      Specified by:
      getLeftPredictorOrdinateEdge in interface SingleSegmentSequence
      Returns:
      The Left Predictor Ordinate Edge
    • getRightPredictorOrdinateEdge

      public double getRightPredictorOrdinateEdge()
      Description copied from interface: SingleSegmentSequence
      Return the Right Predictor Ordinate Edge
      Specified by:
      getRightPredictorOrdinateEdge in interface SingleSegmentSequence
      Returns:
      The Right Predictor Ordinate Edge