Class LeastSquaresInterpolator
- java.lang.Object
-
- org.hortonmachine.gears.utils.math.interpolation.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 Summary
Constructors Constructor Description LeastSquaresInterpolator(List<Double> xList, List<Double> yList)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetA0()Return the coefficient a0.doublegetA1()Return the coefficient a1.doublegetInterpolated(double x)Returns the interpolated value y=f(x).doublegetSumX()Return the sum of the x values.doublegetSumXX()Return the sum of the x*x values.doublegetSumXY()Return the sum of the x*y values.doublegetSumY()Return the sum of the y values.
-
-
-
Method Detail
-
getInterpolated
public double getInterpolated(double x)
Description copied from interface:InterpolatorReturns the interpolated value y=f(x).- Specified by:
getInterpolatedin interfaceInterpolator- 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
-
-