ca.nengo.math.impl
Class LinearCurveFitter

java.lang.Object
  extended by ca.nengo.math.impl.LinearCurveFitter
All Implemented Interfaces:
CurveFitter, java.lang.Cloneable

public class LinearCurveFitter
extends java.lang.Object
implements CurveFitter

Interpolates linearly between example points. Outside the range of examples, the last interval is extrapolated.

Inputs x must be sorted from lowest to highest.

TODO: sort inputs

Author:
Bryan Tripp

Nested Class Summary
static class LinearCurveFitter.InterpolatedFunction
          A 1-D Function based on interpolation between known points.
 
Constructor Summary
LinearCurveFitter()
           
 
Method Summary
 CurveFitter clone()
           
 Function fit(float[] x, float[] y)
          Note that inputs x must be sorted from lowest to highest.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinearCurveFitter

public LinearCurveFitter()
Method Detail

fit

public Function fit(float[] x,
                    float[] y)
Note that inputs x must be sorted from lowest to highest.

Specified by:
fit in interface CurveFitter
Parameters:
x - Example x points
y - Example y points (must be same length as x)
Returns:
A Function that approximates the mapping Y=f(X) exemplified by x and y.
See Also:
CurveFitter.fit(float[], float[])

clone

public CurveFitter clone()
                  throws java.lang.CloneNotSupportedException
Specified by:
clone in interface CurveFitter
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException