Class LeastSquaresInterpolator

  • All Implemented Interfaces:
    Interpolator

    public class LeastSquaresInterpolator
    extends Object
    implements Interpolator
    A least square regression interpolator.

    This was done basing on the Java Number Cruncher Book by Ronald Mak (see http://www.apropos-logic.com/books.html).

    Author:
    Andrea Antonello (www.hydrologis.com)
    • Constructor Detail

      • LeastSquaresInterpolator

        public LeastSquaresInterpolator​(List<Double> xList,
                                        List<Double> yList)
        Constructor.
        Parameters:
        xList - the list of X samples.
        yList - the list of Y = f(X) samples.
    • Method Detail

      • getInterpolated

        public double getInterpolated​(double x)
        Description copied from interface: Interpolator
        Returns the interpolated value y=f(x).
        Specified by:
        getInterpolated in interface Interpolator
        Parameters:
        x - the value of x.
        Returns:
        the interpolated value of y.
      • getA0

        public double getA0()
        Return the coefficient a0.
        Returns:
        the value of a0
      • getA1

        public double getA1()
        Return the coefficient a1.
        Returns:
        the value of a1
      • getSumX

        public double getSumX()
        Return the sum of the x values.
        Returns:
        the sum
      • getSumY

        public double getSumY()
        Return the sum of the y values.
        Returns:
        the sum
      • getSumXX

        public double getSumXX()
        Return the sum of the x*x values.
        Returns:
        the sum
      • getSumXY

        public double getSumXY()
        Return the sum of the x*y values.
        Returns:
        the sum