Class CubicSpline

java.lang.Object
xal.extension.fit.spline.CubicSpline

public class CubicSpline extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    CubicSpline(double[] xx, double[] y)
    constructor which takes only the data points fp0 - the slope at the starting point assumed = 0. fpn - the slope at the end point assumed = 0.
    CubicSpline(double[] xx, double[] y, double fp0, double fpn)
    constructor which also takes initial and final slope constraints
    constructor of a new spline from another one
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Differentiates a spline in place.
    double
    evaluateAt(double xx)
    method to return an interpolated result at a given x value
    void
    Integrates a spline in place.

    Methods inherited from class java.lang.Object

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

    • CubicSpline

      public CubicSpline(CubicSpline sp)
      constructor of a new spline from another one
    • CubicSpline

      public CubicSpline(double[] xx, double[] y, double fp0, double fpn)
      constructor which also takes initial and final slope constraints
      Parameters:
      xx - - the data X values
      y - - the data Y values
      fp0 - - the slope at the starting point
      fpn - - the slope at the end point
    • CubicSpline

      public CubicSpline(double[] xx, double[] y)
      constructor which takes only the data points fp0 - the slope at the starting point assumed = 0. fpn - the slope at the end point assumed = 0.
      Parameters:
      xx - - the data X values
      y - - the data Y values
  • Method Details

    • evaluateAt

      public double evaluateAt(double xx)
      method to return an interpolated result at a given x value
      Parameters:
      xx - - the x value to evaluate the interpolation at If x is outside the parameter rage - set return value = end point
    • differentiate

      public void differentiate()
      Differentiates a spline in place. After calling this routine, a calls to evaluateAt() return the derivative.
    • integrate

      public void integrate()
      Integrates a spline in place. After calling this routine, a calls to evaluateAt() return the integral. The constant of integration is chosen such that i(0) = 0.0;