Package org.drip.spline.stretch
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 Edgedouble
getRightPredictorOrdinateEdge()
Return the Right Predictor Ordinate Edgeboolean
isCoMonotone(double[] measuredResponseArray)
Verify whether the Stretch mini-max Behavior matches the Measurementboolean
isKnot(double predictorOrdinate)
Is the given Predictor Ordinate a Knot Locationboolean
isLocallyMonotone()
Indicate if all the comprising Segments are MonotoneWengertJacobian
jackDResponseDCalibrationInput(double predictorOrdinate, int order)
Calculate the Response Derivative to the Calibration Inputs at the specified OrdinateWengertJacobian
jackDResponseDManifestMeasure(java.lang.String manifestMeasure, double predictorOrdinate, int order)
Calculate the Response Derivative to the Manifest Measure at the specified OrdinateMonotonocity
monotoneType(double predictorOrdinate)
Identify the Monotone Type for the Segment underlying the given Predictor Ordinateboolean
resetNode(int predictorOrdinateNodeIndex, double resetResponse)
Reset the Predictor Ordinate Node Index with the given Responseboolean
resetNode(int predictorOrdinateNodeIndex, SegmentResponseValueConstraint resetSegmentResponseValueConstraint)
Reset the Predictor Ordinate Node Index with the given Segment Constraintdouble
responseValue(double predictorOrdinate)
Calculate the Response Value at the given Predictor Ordinatedouble
responseValueDerivative(double predictorOrdinate, int order)
Calculate the Response Value Derivative at the given Predictor Ordinate for the specified orderboolean
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 InstanceMethods 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.ExceptionSingleSegmentLagrangePolynomial 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 interfaceSingleSegmentSequence
- Parameters:
leadingY
- Stretch Left-most ResponseresponseValueArray
- Array of Segment Right Edge ResponsesstretchBestFitResponse
- Stretch Fitness Weighted ResponseboundarySettings
- The Calibration Boundary ConditioncalibrationDetail
- The Calibration Detail- Returns:
- TRUE - Set up was successful
-
responseValue
public double responseValue(double predictorOrdinate) throws java.lang.ExceptionDescription copied from interface:SingleSegmentSequence
Calculate the Response Value at the given Predictor Ordinate- Specified by:
responseValue
in interfaceSingleSegmentSequence
- 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.ExceptionDescription copied from interface:SingleSegmentSequence
Calculate the Response Value Derivative at the given Predictor Ordinate for the specified order- Specified by:
responseValueDerivative
in interfaceSingleSegmentSequence
- Parameters:
predictorOrdinate
- Predictor Ordinateorder
- Order the Derivative- Returns:
- The Response Value
- Throws:
java.lang.Exception
- Thrown if the Response Value Derivative cannot be calculated
-
jackDResponseDCalibrationInput
Description copied from interface:SingleSegmentSequence
Calculate the Response Derivative to the Calibration Inputs at the specified Ordinate- Specified by:
jackDResponseDCalibrationInput
in interfaceSingleSegmentSequence
- Parameters:
predictorOrdinate
- Predictor Ordinateorder
- 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 interfaceSingleSegmentSequence
- Parameters:
manifestMeasure
- Manifest Measure whose Sensitivity is soughtpredictorOrdinate
- Predictor Ordinateorder
- Order of Derivative desired- Returns:
- Jacobian of the Response Derivative to the Quote at the Ordinate
-
monotoneType
Description copied from interface:SingleSegmentSequence
Identify the Monotone Type for the Segment underlying the given Predictor Ordinate- Specified by:
monotoneType
in interfaceSingleSegmentSequence
- Parameters:
predictorOrdinate
- Predictor Ordinate- Returns:
- Segment Monotone Type
-
isLocallyMonotone
public boolean isLocallyMonotone() throws java.lang.ExceptionDescription copied from interface:SingleSegmentSequence
Indicate if all the comprising Segments are Monotone- Specified by:
isLocallyMonotone
in interfaceSingleSegmentSequence
- 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.ExceptionDescription copied from interface:SingleSegmentSequence
Verify whether the Stretch mini-max Behavior matches the Measurement- Specified by:
isCoMonotone
in interfaceSingleSegmentSequence
- 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 interfaceSingleSegmentSequence
- 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 interfaceSingleSegmentSequence
- Parameters:
predictorOrdinateNodeIndex
- The Predictor Ordinate Node Index whose Response is to be resetresetResponse
- 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 interfaceSingleSegmentSequence
- Parameters:
predictorOrdinateNodeIndex
- The Predictor Ordinate Node Index whose Response is to be resetresetSegmentResponseValueConstraint
- The Segment Constraint- Returns:
- TRUE - Reset succeeded
-
toAU
Description copied from interface:SingleSegmentSequence
Convert the Segment Sequence into an AbstractUnivariate Instance- Specified by:
toAU
in interfaceSingleSegmentSequence
- Returns:
- The AbstractUnivariate Instance
-
getLeftPredictorOrdinateEdge
public double getLeftPredictorOrdinateEdge()Description copied from interface:SingleSegmentSequence
Return the Left Predictor Ordinate Edge- Specified by:
getLeftPredictorOrdinateEdge
in interfaceSingleSegmentSequence
- 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 interfaceSingleSegmentSequence
- Returns:
- The Right Predictor Ordinate Edge
-