jdistlib.math.approx
Class ApproximationFunction
- java.lang.Object
-
- jdistlib.math.approx.ApproximationFunction
-
- All Implemented Interfaces:
- UnivariateFunction
public class ApproximationFunction extends java.lang.Object implements UnivariateFunction
Create an approximation function. This is pretty much like R's approxfun. I'm emulating it here. I don't deal with NaN and Infinity. I don't do sanity check and no uniqueness check here. So, watch out.
-
-
Constructor Summary
Constructors Constructor and Description ApproximationFunction(ApproximationType t, double[] x, double[] y, double lo, double hi, double compromise)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static doubleconstant(double v, double[] x, double[] y, double lo, double hi, double compromise)Constant approximationdoubleeval(double x)static doublelinear(double v, double[] x, double[] y, double lo, double hi)Linear approximationvoidsetObjects(java.lang.Object... obj)voidsetParameters(double... params)
-
-
-
Constructor Detail
-
ApproximationFunction
public ApproximationFunction(ApproximationType t, double[] x, double[] y, double lo, double hi, double compromise)
-
-
Method Detail
-
eval
public double eval(double x)
- Specified by:
evalin interfaceUnivariateFunction
-
setParameters
public void setParameters(double... params)
- Specified by:
setParametersin interfaceUnivariateFunction
-
setObjects
public void setObjects(java.lang.Object... obj)
- Specified by:
setObjectsin interfaceUnivariateFunction
-
linear
public static final double linear(double v, double[] x, double[] y, double lo, double hi)Linear approximation- Parameters:
v-x-y-lo-hi-- Returns:
- Approximated value
-
constant
public static final double constant(double v, double[] x, double[] y, double lo, double hi, double compromise)Constant approximation- Parameters:
v-x-y-lo-hi-compromise-- Returns:
- Approximated value
-
-
DMelt 3.0 © DataMelt by jWork.ORG