Class AbstractInterpolation

java.lang.Object
smile.interpolation.AbstractInterpolation
All Implemented Interfaces:
Serializable, Interpolation
Direct Known Subclasses:
CubicSplineInterpolation1D, LinearInterpolation

public abstract class AbstractInterpolation extends Object implements Interpolation
Abstract base class of one-dimensional interpolation methods.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractInterpolation(double[] x, double[] y)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    interpolate(double x)
    Given a value x, return an interpolated value.
    abstract double
    rawinterp(int jlo, double x)
    Subclasses provide this as the actual interpolation method.
    protected int
    search(double x)
    Given a value x, return a value j such that x is (insofar as possible) centered in the subrange xx[j..j+m-1], where xx is the stored data.

    Methods inherited from class java.lang.Object

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

    • AbstractInterpolation

      public AbstractInterpolation(double[] x, double[] y)
      Constructor. Setup for interpolation on a table of x and y. The value in x must be monotonic, either increasing or decreasing.
      Parameters:
      x - the tabulated points.
      y - the function values at x.
  • Method Details

    • interpolate

      public double interpolate(double x)
      Description copied from interface: Interpolation
      Given a value x, return an interpolated value.
      Specified by:
      interpolate in interface Interpolation
      Parameters:
      x - a real number.
      Returns:
      the interpolated function value.
    • search

      protected int search(double x)
      Given a value x, return a value j such that x is (insofar as possible) centered in the subrange xx[j..j+m-1], where xx is the stored data. The returned value is not less than 0, nor greater than n-1, where n is the length of xx.
      Parameters:
      x - a real number.
      Returns:
      the index j of x in the tabulated points.
    • rawinterp

      public abstract double rawinterp(int jlo, double x)
      Subclasses provide this as the actual interpolation method.
      Parameters:
      jlo - the value jlo is such that x is (insofar as possible) centered in the subrange xx[j..j+m-1], where xx is the stored data.
      x - interpolate at this value
      Returns:
      the raw interpolated value.