Class LocalMonotoneCkGenerator

java.lang.Object
org.drip.spline.pchip.LocalMonotoneCkGenerator

public class LocalMonotoneCkGenerator
extends java.lang.Object
LocalMonotoneCkGenerator generates customized Local Stretch by trading off Ck for local control. This class implements the following variants: Akima, Bessel, Harmonic, Hyman83, Hyman89, Kruger, Monotone Convex, as well as the Van Leer and the Huynh/LeFloch limiters. It also provides the following custom control on the resulting C1:
  • Eliminate the Spurious Filter in the Input C1 Entry
  • Apply the Monotone Filter in the Input C1 Entry
  • Generate a Vanilla C1 Array from the specified Array of Predictor Ordinates and the Response Values
  • Generate a Bessel C1 Array from the specified Array of Predictor Ordinates and the Response Values
  • Generate a Hyman83 C1 Array from the specified Array of Predictor Ordinates and the Response Values
  • Generate a Hyman89 C1 Array from the specified Array of Predictor Ordinates and the Response Values
  • Generate a Harmonic C1 Array from the specified Array of Predictor Ordinates and the Response Values
  • Generate a van Leer Limiter C1 Array from the specified Array of Predictor Ordinates and the Response Values
  • Generate a Huynh Le Floch Limiter C1 Array from the specified Array of Predictor Ordinates and the Response Values
  • Generate a Kruger C1 Array from the specified Array of Predictor Ordinates and the Response Values
  • Generate a Akima C1 Array from the specified Array of Predictor Ordinates and the Response Values
  • Verify if the given Quintic Polynomial is Monotone using the Hyman89 Algorithm
  • Generate C1 Slope Quintic Polynomial is Monotone using the Hyman89 Algorithm
  • Generate the Local Control Stretch in accordance with the desired Customization Parameters
  • Retrieve the C1 Array

Module Product Core Module
Library Fixed Income Analytics
Project Basis Splines and Linear Compounders across a Broad Family of Spline Basis Functions
Package Monotone Convex Themed PCHIP Splines

Author:
Lakshmi Krishnamurthy
  • Field Summary

    Fields
    Modifier and Type Field Description
    static java.lang.String C1_AKIMA
    C1 Type: Akima
    static java.lang.String C1_BESSEL
    C1 Type: Bessel
    static java.lang.String C1_HARMONIC
    C1 Type: Harmonic
    static java.lang.String C1_HUYNH_LE_FLOCH
    C1 Type: Huynh - Le Floch Limiter
    static java.lang.String C1_HYMAN83
    C1 Type: Hyman83
    static java.lang.String C1_HYMAN89
    C1 Type: Hyman89
    static java.lang.String C1_KRUGER
    C1 Type: Kruger
    static java.lang.String C1_MONOTONE_CONVEX
    C1 Type: Monotone Convex
    static java.lang.String C1_VAN_LEER
    C1 Type: Van Leer Limiter
    static java.lang.String C1_VANILLA
    C1 Type: Vanilla
  • Method Summary

    Modifier and Type Method Description
    static double[] AkimaC1​(double[] predictorOrdinateArray, double[] responseValueArray)
    Generate a Akima C1 Array from the specified Array of Predictor Ordinates and the Response Values.
    static double[] ApplyMonotoneFilter​(double[] c1Array, double[] linearC1Array)
    Apply the Monotone Filter in the Input C1 Entry
    static double[] BesselC1​(double[] predictorOrdinateArray, double[] responseValueArray)
    Generate a Bessel C1 Array from the specified Array of Predictor Ordinates and the Response Values
    double[] C1()
    Retrieve the C1 Array
    static LocalMonotoneCkGenerator Create​(double[] predictorOrdinateArray, double[] responseValueArray, java.lang.String generatorType, boolean eliminateSpuriousExtrema, boolean applyMonotoneFilter)
    Generate the Local Control Stretch in accordance with the desired Customization Parameters
    static LocalMonotoneCkGenerator Create​(int[] predictorOrdinateArray, double[] responseValueArray, java.lang.String generatorType, boolean eliminateSpuriousExtrema, boolean applyMonotoneFilter)
    Generate the Local Control Stretch in accordance with the desired Customization Parameters
    static double[] EliminateSpuriousExtrema​(double[] c1Array, double[] linearC1Array)
    Eliminate the Spurious Extrema in the Input C1 Entry
    static double[] HarmonicC1​(double[] predictorOrdinateArray, double[] responseValueArray)
    Generate a Harmonic C1 Array from the specified Array of Predictor Ordinates and the Response Values Fritcsh and Butland (1984) A Method for constructing local monotonic piece-wise cubic interpolants - SIAM J on Scientific and Statistical Computing 5, 300-304.
    static double[] HuynhLeFlochLimiterC1​(double[] predictorOrdinateArray, double[] responseValueArray)
    Generate a Huynh Le Floch Limiter C1 Array from the specified Array of Predictor Ordinates and the Response Values.
    static double[] Hyman83C1​(double[] predictorOrdinateArray, double[] responseValueArray)
    Generate a Hyman83 C1 Array from the specified Array of Predictor Ordinates and the Response Values Hyman (1983) Accurate Monotonicity Preserving Cubic Interpolation - SIAM J on Numerical Analysis 4 (4), 645-654.
    static double[] Hyman89C1​(double[] predictorOrdinateArray, double[] responseValueArray)
    Generate a Hyman89 C1 Array from the specified Array of Predictor Ordinates and the Response Values Doherty, Edelman, and Hyman (1989) Non-negative, monotonic, or convexity preserving cubic and quintic Hermite interpolation - Mathematics of Computation 52 (186), 471-494.
    static double[] Hyman89QuinticMonotoneC1​(double[] predictorOrdinateArray, double[] responseValueArray, double[] firstDerivativeArray, double[] secondDerivativeArray)
    Generate C1 Slope Quintic Polynomial is Monotone using the Hyman89 Algorithm Doherty, Edelman, and Hyman (1989) Non-negative, monotonic, or convexity preserving cubic and quintic Hermite interpolation - Mathematics of Computation 52 (186), 471-494.
    static double[] KrugerC1​(double[] predictorOrdinateArray, double[] responseValueArray)
    Generate a Kruger C1 Array from the specified Array of Predictor Ordinates and the Response Values.
    static double[] LinearC1​(double[] predictorOrdinateArray, double[] responseValueArray)
    Generate a Vanilla C1 Array from the specified Array of Predictor Ordinates and the Response Values
    static double[] VanLeerLimiterC1​(double[] predictorOrdinateArray, double[] responseValueArray)
    Generate a Van Leer Limiter C1 Array from the specified Array of Predictor Ordinates and the Response Values.
    static boolean VerifyHyman89QuinticMonotonicity​(double[] predictorOrdinateArray, double[] responseValueArray, double[] firstDerivativeArray, double[] secondDerivativeArray)
    Verify if the given Quintic Polynomial is Monotone using the Hyman89 Algorithm Doherty, Edelman, and Hyman (1989) Non-negative, monotonic, or convexity preserving cubic and quintic Hermite interpolation - Mathematics of Computation 52 (186), 471-494.

    Methods inherited from class java.lang.Object

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

    • C1_VANILLA

      public static final java.lang.String C1_VANILLA
      C1 Type: Vanilla
      See Also:
      Constant Field Values
    • C1_AKIMA

      public static final java.lang.String C1_AKIMA
      C1 Type: Akima
      See Also:
      Constant Field Values
    • C1_BESSEL

      public static final java.lang.String C1_BESSEL
      C1 Type: Bessel
      See Also:
      Constant Field Values
    • C1_HARMONIC

      public static final java.lang.String C1_HARMONIC
      C1 Type: Harmonic
      See Also:
      Constant Field Values
    • C1_HUYNH_LE_FLOCH

      public static final java.lang.String C1_HUYNH_LE_FLOCH
      C1 Type: Huynh - Le Floch Limiter
      See Also:
      Constant Field Values
    • C1_HYMAN83

      public static final java.lang.String C1_HYMAN83
      C1 Type: Hyman83
      See Also:
      Constant Field Values
    • C1_HYMAN89

      public static final java.lang.String C1_HYMAN89
      C1 Type: Hyman89
      See Also:
      Constant Field Values
    • C1_KRUGER

      public static final java.lang.String C1_KRUGER
      C1 Type: Kruger
      See Also:
      Constant Field Values
    • C1_MONOTONE_CONVEX

      public static final java.lang.String C1_MONOTONE_CONVEX
      C1 Type: Monotone Convex
      See Also:
      Constant Field Values
    • C1_VAN_LEER

      public static final java.lang.String C1_VAN_LEER
      C1 Type: Van Leer Limiter
      See Also:
      Constant Field Values
  • Method Details

    • EliminateSpuriousExtrema

      public static final double[] EliminateSpuriousExtrema​(double[] c1Array, double[] linearC1Array)
      Eliminate the Spurious Extrema in the Input C1 Entry
      Parameters:
      c1Array - The C1 Array in which the Spurious Extrema is to be eliminated
      linearC1Array - Array of the Linear C1 Entries
      Returns:
      The C1 Array with the Spurious Extrema eliminated
    • ApplyMonotoneFilter

      public static final double[] ApplyMonotoneFilter​(double[] c1Array, double[] linearC1Array)
      Apply the Monotone Filter in the Input C1 Entry
      Parameters:
      c1Array - The C1 Array in which the Monotone Filter is to be applied
      linearC1Array - Array of the Linear C1 Entries
      Returns:
      The C1 Array with the Monotone Filter applied
    • LinearC1

      public static final double[] LinearC1​(double[] predictorOrdinateArray, double[] responseValueArray)
      Generate a Vanilla C1 Array from the specified Array of Predictor Ordinates and the Response Values
      Parameters:
      predictorOrdinateArray - The Predictor Ordinate Array
      responseValueArray - The Response Value Array
      Returns:
      The C1 Array
    • BesselC1

      public static final double[] BesselC1​(double[] predictorOrdinateArray, double[] responseValueArray)
      Generate a Bessel C1 Array from the specified Array of Predictor Ordinates and the Response Values
      Parameters:
      predictorOrdinateArray - The Predictor Ordinate Array
      responseValueArray - The Response Value Array
      Returns:
      The C1 Array
    • Hyman83C1

      public static final double[] Hyman83C1​(double[] predictorOrdinateArray, double[] responseValueArray)
      Generate a Hyman83 C1 Array from the specified Array of Predictor Ordinates and the Response Values Hyman (1983) Accurate Monotonicity Preserving Cubic Interpolation - SIAM J on Numerical Analysis 4 (4), 645-654.
      Parameters:
      predictorOrdinateArray - The Predictor Ordinate Array
      responseValueArray - The Response Value Array
      Returns:
      The C1 Array
    • Hyman89C1

      public static final double[] Hyman89C1​(double[] predictorOrdinateArray, double[] responseValueArray)
      Generate a Hyman89 C1 Array from the specified Array of Predictor Ordinates and the Response Values Doherty, Edelman, and Hyman (1989) Non-negative, monotonic, or convexity preserving cubic and quintic Hermite interpolation - Mathematics of Computation 52 (186), 471-494.
      Parameters:
      predictorOrdinateArray - The Predictor Ordinate Array
      responseValueArray - The Response Value Array
      Returns:
      The C1 Array
    • HarmonicC1

      public static final double[] HarmonicC1​(double[] predictorOrdinateArray, double[] responseValueArray)
      Generate a Harmonic C1 Array from the specified Array of Predictor Ordinates and the Response Values Fritcsh and Butland (1984) A Method for constructing local monotonic piece-wise cubic interpolants - SIAM J on Scientific and Statistical Computing 5, 300-304.
      Parameters:
      predictorOrdinateArray - The Predictor Ordinate Array
      responseValueArray - The Response Value Array
      Returns:
      The C1 Array
    • VanLeerLimiterC1

      public static final double[] VanLeerLimiterC1​(double[] predictorOrdinateArray, double[] responseValueArray)
      Generate a Van Leer Limiter C1 Array from the specified Array of Predictor Ordinates and the Response Values. Van Leer (1974) Towards the Ultimate Conservative Difference Scheme. II - Monotonicity and Conservation combined in a Second-Order Scheme, Journal of Computational Physics 14 (4), 361-370.
      Parameters:
      predictorOrdinateArray - The Predictor Ordinate Array
      responseValueArray - The Response Value Array
      Returns:
      The C1 Array
    • HuynhLeFlochLimiterC1

      public static final double[] HuynhLeFlochLimiterC1​(double[] predictorOrdinateArray, double[] responseValueArray)
      Generate a Huynh Le Floch Limiter C1 Array from the specified Array of Predictor Ordinates and the Response Values. Huynh (1993) Accurate Monotone Cubic Interpolation, SIAM J on Numerical Analysis 30 (1), 57-100.
      Parameters:
      predictorOrdinateArray - The Predictor Ordinate Array
      responseValueArray - The Response Value Array
      Returns:
      The C1 Array
    • KrugerC1

      public static final double[] KrugerC1​(double[] predictorOrdinateArray, double[] responseValueArray)
      Generate a Kruger C1 Array from the specified Array of Predictor Ordinates and the Response Values. Kruger (2002) Constrained Cubic Spline Interpolations for Chemical Engineering Application, http://www.korf.co.uk/spline.pdf
      Parameters:
      predictorOrdinateArray - The Predictor Ordinate Array
      responseValueArray - The Response Value Array
      Returns:
      The C1 Array
    • AkimaC1

      public static final double[] AkimaC1​(double[] predictorOrdinateArray, double[] responseValueArray)
      Generate a Akima C1 Array from the specified Array of Predictor Ordinates and the Response Values. Akima (1970): A New Method of Interpolation and Smooth Curve Fitting based on Local Procedures, Journal of the Association for the Computing Machinery 17 (4), 589-602.
      Parameters:
      predictorOrdinateArray - The Predictor Ordinate Array
      responseValueArray - The Response Value Array
      Returns:
      The C1 Array
    • VerifyHyman89QuinticMonotonicity

      public static final boolean VerifyHyman89QuinticMonotonicity​(double[] predictorOrdinateArray, double[] responseValueArray, double[] firstDerivativeArray, double[] secondDerivativeArray) throws java.lang.Exception
      Verify if the given Quintic Polynomial is Monotone using the Hyman89 Algorithm Doherty, Edelman, and Hyman (1989) Non-negative, monotonic, or convexity preserving cubic and quintic Hermite interpolation - Mathematics of Computation 52 (186), 471-494.
      Parameters:
      predictorOrdinateArray - Array of Predictor Ordinates
      responseValueArray - Array of Response Values
      firstDerivativeArray - Array of First Derivatives
      secondDerivativeArray - Array of Second Derivatives
      Returns:
      TRUE - The given Quintic Polynomial is Monotone
      Throws:
      java.lang.Exception - Thrown if the Monotonicity cannot be determined
    • Hyman89QuinticMonotoneC1

      public static final double[] Hyman89QuinticMonotoneC1​(double[] predictorOrdinateArray, double[] responseValueArray, double[] firstDerivativeArray, double[] secondDerivativeArray)
      Generate C1 Slope Quintic Polynomial is Monotone using the Hyman89 Algorithm Doherty, Edelman, and Hyman (1989) Non-negative, monotonic, or convexity preserving cubic and quintic Hermite interpolation - Mathematics of Computation 52 (186), 471-494.
      Parameters:
      predictorOrdinateArray - Array of Predictor Ordinates
      responseValueArray - Array of Response Values
      firstDerivativeArray - Array of First Derivatives
      secondDerivativeArray - Array of Second Derivatives
      Returns:
      The C1 Slope Quintic Stretch
    • Create

      public static final LocalMonotoneCkGenerator Create​(double[] predictorOrdinateArray, double[] responseValueArray, java.lang.String generatorType, boolean eliminateSpuriousExtrema, boolean applyMonotoneFilter)
      Generate the Local Control Stretch in accordance with the desired Customization Parameters
      Parameters:
      predictorOrdinateArray - The Predictor Ordinate Array
      responseValueArray - The Response Value Array
      generatorType - The C1 Generator Type
      eliminateSpuriousExtrema - TRUE - Eliminate Spurious Extrema
      applyMonotoneFilter - TRUE - Apply Monotone Filter
      Returns:
      Instance of the Local Control Stretch
    • Create

      public static final LocalMonotoneCkGenerator Create​(int[] predictorOrdinateArray, double[] responseValueArray, java.lang.String generatorType, boolean eliminateSpuriousExtrema, boolean applyMonotoneFilter)
      Generate the Local Control Stretch in accordance with the desired Customization Parameters
      Parameters:
      predictorOrdinateArray - The Predictor Ordinate Array
      responseValueArray - The Response Value Array
      generatorType - The C1 Generator Type
      eliminateSpuriousExtrema - TRUE - Eliminate Spurious Extrema
      applyMonotoneFilter - TRUE - Apply Monotone Filter
      Returns:
      Instance of the Local Control Stretch
    • C1

      public double[] C1()
      Retrieve the C1 Array
      Returns:
      The C1 Array