Class ShepardInterpolation2D

java.lang.Object
smile.interpolation.ShepardInterpolation2D
All Implemented Interfaces:
Serializable, Interpolation2D

public class ShepardInterpolation2D extends Object implements Interpolation2D
Shepard interpolation is a special case of normalized radial basis function interpolation if the function φ(r) goes to infinity as r → 0, and is finite for r > 0. In this case, the weights wi are just equal to the respective function values yi. So we need not solve linear equations and thus it works for very large N.

An example of such φ is φ(r) = r-p with (typically) 1 < p <= 3.

Shepard interpolation is rarely as accurate as the well-tuned application of other radial basis functions. However, it is simple, fast, and often jut the thing for quick and dirty applications.

See Also:
  • Constructor Details

    • ShepardInterpolation2D

      public ShepardInterpolation2D(double[] x1, double[] x2, double[] y)
      Constructor. By default p = 2.
      Parameters:
      x1 - the 1st dimension of data points.
      x2 - the 2nd dimension of data points.
      y - the function values at (x1, x2).
    • ShepardInterpolation2D

      public ShepardInterpolation2D(double[] x1, double[] x2, double[] y, double p)
      Constructor.
      Parameters:
      x1 - the 1st dimension of data points.
      x2 - the 2nd dimension of data points.
      y - the function values at (x1, x2).
      p - the parameter in the radial basis function φ(r) = r-p.
  • Method Details

    • interpolate

      public double interpolate(double x1, double x2)
      Description copied from interface: Interpolation2D
      Interpolate the data at a given 2-dimensional point.
      Specified by:
      interpolate in interface Interpolation2D
      Parameters:
      x1 - the 1st dimension value.
      x2 - the 2nd dimension value.
      Returns:
      the interpolated function value.
    • toString

      public String toString()
      Overrides:
      toString in class Object