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 doublegetLeftPredictorOrdinateEdge()Return the Left Predictor Ordinate EdgedoublegetRightPredictorOrdinateEdge()Return the Right Predictor Ordinate EdgebooleanisCoMonotone(double[] measuredResponseArray)Verify whether the Stretch mini-max Behavior matches the MeasurementbooleanisKnot(double predictorOrdinate)Is the given Predictor Ordinate a Knot LocationbooleanisLocallyMonotone()Indicate if all the comprising Segments are MonotoneWengertJacobianjackDResponseDCalibrationInput(double predictorOrdinate, int order)Calculate the Response Derivative to the Calibration Inputs at the specified OrdinateWengertJacobianjackDResponseDManifestMeasure(java.lang.String manifestMeasure, double predictorOrdinate, int order)Calculate the Response Derivative to the Manifest Measure at the specified OrdinateMonotonocitymonotoneType(double predictorOrdinate)Identify the Monotone Type for the Segment underlying the given Predictor OrdinatebooleanresetNode(int predictorOrdinateNodeIndex, double resetResponse)Reset the Predictor Ordinate Node Index with the given ResponsebooleanresetNode(int predictorOrdinateNodeIndex, SegmentResponseValueConstraint resetSegmentResponseValueConstraint)Reset the Predictor Ordinate Node Index with the given Segment ConstraintdoubleresponseValue(double predictorOrdinate)Calculate the Response Value at the given Predictor OrdinatedoubleresponseValueDerivative(double predictorOrdinate, int order)Calculate the Response Value Derivative at the given Predictor Ordinate for the specified orderbooleansetup(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.R1ToR1toAU()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:SingleSegmentSequenceSet up (i.e., calibrate) the individual Segments in the Stretch to the Response Values corresponding to each Segment Predictor right Ordinate.- Specified by:
setupin 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:SingleSegmentSequenceCalculate the Response Value at the given Predictor Ordinate- Specified by:
responseValuein 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:SingleSegmentSequenceCalculate the Response Value Derivative at the given Predictor Ordinate for the specified order- Specified by:
responseValueDerivativein 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:SingleSegmentSequenceCalculate the Response Derivative to the Calibration Inputs at the specified Ordinate- Specified by:
jackDResponseDCalibrationInputin 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:SingleSegmentSequenceCalculate the Response Derivative to the Manifest Measure at the specified Ordinate- Specified by:
jackDResponseDManifestMeasurein 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:SingleSegmentSequenceIdentify the Monotone Type for the Segment underlying the given Predictor Ordinate- Specified by:
monotoneTypein interfaceSingleSegmentSequence- Parameters:
predictorOrdinate- Predictor Ordinate- Returns:
- Segment Monotone Type
-
isLocallyMonotone
public boolean isLocallyMonotone() throws java.lang.ExceptionDescription copied from interface:SingleSegmentSequenceIndicate if all the comprising Segments are Monotone- Specified by:
isLocallyMonotonein 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:SingleSegmentSequenceVerify whether the Stretch mini-max Behavior matches the Measurement- Specified by:
isCoMonotonein 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:SingleSegmentSequenceIs the given Predictor Ordinate a Knot Location- Specified by:
isKnotin 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:SingleSegmentSequenceReset the Predictor Ordinate Node Index with the given Response- Specified by:
resetNodein 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:SingleSegmentSequenceReset the Predictor Ordinate Node Index with the given Segment Constraint- Specified by:
resetNodein 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:SingleSegmentSequenceConvert the Segment Sequence into an AbstractUnivariate Instance- Specified by:
toAUin interfaceSingleSegmentSequence- Returns:
- The AbstractUnivariate Instance
-
getLeftPredictorOrdinateEdge
public double getLeftPredictorOrdinateEdge()Description copied from interface:SingleSegmentSequenceReturn the Left Predictor Ordinate Edge- Specified by:
getLeftPredictorOrdinateEdgein interfaceSingleSegmentSequence- Returns:
- The Left Predictor Ordinate Edge
-
getRightPredictorOrdinateEdge
public double getRightPredictorOrdinateEdge()Description copied from interface:SingleSegmentSequenceReturn the Right Predictor Ordinate Edge- Specified by:
getRightPredictorOrdinateEdgein interfaceSingleSegmentSequence- Returns:
- The Right Predictor Ordinate Edge
-