Package de.gsi.math

Class Spline


  • public class Spline
    extends java.lang.Object
    class implementing natural cubic splines according to: http://en.wikipedia.org/wiki/Spline_(mathematics)
    Author:
    rstein
    • Constructor Summary

      Constructors 
      Constructor Description
      Spline​(double[] x, double[] y)
      default constructor
      Spline​(double[] x, double[] y, int length, int scrPos)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getValue​(double x)
      returns the cubic-spline interpolated value at x
      void printCoefficients()
      Debug out-put of the spline fix-points and coefficients
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Spline

        public Spline​(double[] x,
                      double[] y)
        default constructor
        Parameters:
        x - array of horizontal coordinates
        y - array of vertical coordinates Both arrays are expected to be sorted. The horizontal array should not contain entries with the same value. The default dimension is derived from the
        See Also:
        Spline(double[] x, double[] y, int length, int scrPos)
      • Spline

        public Spline​(double[] x,
                      double[] y,
                      int length,
                      int scrPos)
        Parameters:
        x - array of horizontal coordinates
        y - array of vertical coordinates
        length - length of the data
        scrPos - first index of the data Both arrays are expected to be sorted. The horizontal array should not contain entries with the same value. It is implicitly required that: 0 <= srcPos <= srcPos+length < x.length and length > 3
    • Method Detail

      • getValue

        public double getValue​(double x)
        returns the cubic-spline interpolated value at x
        Parameters:
        x - input parameter
        Returns:
        cubic-spline interpolated value at x
      • printCoefficients

        public void printCoefficients()
        Debug out-put of the spline fix-points and coefficients
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object