ca.nengo.math.impl
Class LinearCurveFitter.InterpolatedFunction

java.lang.Object
  extended by ca.nengo.math.impl.AbstractFunction
      extended by ca.nengo.math.impl.LinearCurveFitter.InterpolatedFunction
All Implemented Interfaces:
Function, java.io.Serializable, java.lang.Cloneable
Enclosing class:
LinearCurveFitter

public static class LinearCurveFitter.InterpolatedFunction
extends AbstractFunction

A 1-D Function based on interpolation between known points.

Author:
Bryan Tripp
See Also:
Serialized Form

Field Summary
 
Fields inherited from class ca.nengo.math.impl.AbstractFunction
DIMENSION_PROPERTY
 
Constructor Summary
LinearCurveFitter.InterpolatedFunction(float[] x, float[] y)
           
 
Method Summary
 Function clone()
           
 Configuration getConfiguration()
           
 int getNumPoints()
           
 float[] getX()
           
 float[] getY()
           
static float interpolate(float[] xs, float[] ys, float x)
           
 float map(float[] from)
           
 void setNumPoints(int num)
          If this method is used to increase the number of interpolation points, new points are set to equal what was previously the last point.
 void setX(float[] x)
           
 void setY(float[] y)
           
 
Methods inherited from class ca.nengo.math.impl.AbstractFunction
getDimension, multiMap
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinearCurveFitter.InterpolatedFunction

public LinearCurveFitter.InterpolatedFunction(float[] x,
                                              float[] y)
Parameters:
x - Known function-argument points to interpolate between
y - Known function-output points to interpolate between (must be same length as x)
Method Detail

getConfiguration

public Configuration getConfiguration()
Returns:
Custom configuration

getNumPoints

public int getNumPoints()
Returns:
Number of points between which this function interpolates

setNumPoints

public void setNumPoints(int num)
If this method is used to increase the number of interpolation points, new points are set to equal what was previously the last point.

Parameters:
num - New number of points between which this function interpolates

getX

public float[] getX()
Returns:
Known function-argument points to interpolate between

setX

public void setX(float[] x)
Parameters:
x - Known function-argument points to interpolate between

getY

public float[] getY()
Returns:
Known function-output points to interpolate between

setY

public void setY(float[] y)
Parameters:
y - Known function-output points to interpolate between

map

public float map(float[] from)
Specified by:
map in interface Function
Specified by:
map in class AbstractFunction
Parameters:
from - Must have same length as getDimension()
Returns:
result of function operation on arg
See Also:
AbstractFunction.map(float[])

interpolate

public static float interpolate(float[] xs,
                                float[] ys,
                                float x)
Parameters:
xs - List of x values
ys - List of y values that x values map onto
x - An x value at which to interpolate this mapping
Returns:
The interpolated y value

clone

public Function clone()
               throws java.lang.CloneNotSupportedException
Specified by:
clone in interface Function
Overrides:
clone in class AbstractFunction
Throws:
java.lang.CloneNotSupportedException
See Also:
Object.clone()