Class LinearInterpolation

java.lang.Object
smile.interpolation.AbstractInterpolation
smile.interpolation.LinearInterpolation
All Implemented Interfaces:
Serializable, Interpolation

public class LinearInterpolation extends AbstractInterpolation
Piecewise linear interpolation. Linear interpolation, sometimes known as lerp, is quick and easy, but it is not very precise. Another disadvantage is that the interpolant is not differentiable at the control points x.
See Also:
  • Constructor Details

    • LinearInterpolation

      public LinearInterpolation(double[] x, double[] y)
      Constructor.
      Parameters:
      x - the tabulated points.
      y - the function values at x.
  • Method Details

    • rawinterp

      public double rawinterp(int j, double x)
      Description copied from class: AbstractInterpolation
      Subclasses provide this as the actual interpolation method.
      Specified by:
      rawinterp in class AbstractInterpolation
      Parameters:
      j - 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.
    • toString

      public String toString()
      Overrides:
      toString in class Object