Class NearestNeighbourInterpolator

java.lang.Object
edu.kit.mcda.core.functions.NearestNeighbourInterpolator
All Implemented Interfaces:
org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator

public class NearestNeighbourInterpolator extends Object implements org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator
Simple nearest neighbour interpolator generating a NearestNeighbourFunction.
Author:
tim
  • Constructor Details

    • NearestNeighbourInterpolator

      public NearestNeighbourInterpolator()
  • Method Details

    • interpolate

      public NearestNeighbourFunction interpolate(double[] _x, double[] _y) throws org.apache.commons.math3.exception.MathIllegalArgumentException, org.apache.commons.math3.exception.DimensionMismatchException
      Create a nearest neighbour function by defining covering intervals between sample points. As the order is kept, binary search for the interval bounds provides the corresponding interpolated value.
      Specified by:
      interpolate in interface org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator
      Parameters:
      _x - array of sample locations of the sample points
      _y - array of sample values of the corresponding sample points
      Returns:
      a nearest neighbour function
      Throws:
      org.apache.commons.math3.exception.MathIllegalArgumentException
      org.apache.commons.math3.exception.DimensionMismatchException