|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jaolho.data.lma.LMAFunction peakml.math.function.PolynomialFunction
public class PolynomialFunction
Implementation of a polynomial function, which can be plugged with the order (n) to use. The polynomial has the form f(x) = x^n + x^n-1 + .. + x. This class provides tight integration with the LMA fit package for function fitting.
Constructor Summary | |
---|---|
PolynomialFunction(double... parameters)
Constructs a new polynomial function with the given parameters. |
|
PolynomialFunction(int order)
Constructs a new polynomial function of the given order. |
Method Summary | |
---|---|
static PolynomialFunction |
fit(int order,
double[] xvals,
double[] yvals)
Fits a polynomial function of the given order through the given data. |
jaolho.data.lma.LMA |
getLMA()
When a fit has been performed by calling fit(int, double[], double[])
the returned object contains data on the fit. |
int |
getOrder()
Returns the order of the polynomial function. |
double[] |
getParameters()
Returns the array with the parameters of this function. |
double |
getPartialDerivate(double x,
double[] a,
int parameterIndex)
|
double |
getY(double x)
Returns the y-value for the given x-value with the parameters stored in the instance of the class. |
double |
getY(double x,
double[] a)
Returns the y-value for the given x-value with the given parameters |
static double[] |
MLE(int order,
double[] xvals)
Performs an estimation of the best starting parameters for the fitting procedure. |
Methods inherited from class jaolho.data.lma.LMAFunction |
---|
constructWeights, generateData, generateData, generateData |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PolynomialFunction(int order)
order
- The order of the polynomial.public PolynomialFunction(double... parameters)
parameters
- The parameters for the function.Method Detail |
---|
public int getOrder()
public double getY(double x) throws java.lang.NullPointerException
getY
in interface Function
x
- The x-value.
java.lang.NullPointerException
- When no parameters are stored in the class.public double getY(double x, double[] a) throws java.lang.RuntimeException, java.lang.NullPointerException
getY
in class jaolho.data.lma.LMAFunction
x
- The x-value.a
- The parameters for the function.
java.lang.RuntimeException
- Thrown when the parameters array a has a different size than 2 elements.
java.lang.NullPointerException
- When the a is null.public double getPartialDerivate(double x, double[] a, int parameterIndex)
getPartialDerivate
in class jaolho.data.lma.LMAFunction
public jaolho.data.lma.LMA getLMA()
fit(int, double[], double[])
the returned object contains data on the fit. This is provided for integration purposes
with the LMA fit package. It's encouraged to use the access methods of this class to
get to the information in this object.
public double[] getParameters()
public static double[] MLE(int order, double[] xvals)
fit(int, double[], double[])
and has been made
public for integration purposes.
public static PolynomialFunction fit(int order, double[] xvals, double[] yvals) throws java.lang.RuntimeException
order
- The order of the polynomial function.xvals
- The x-values to fit the line to.yvals
- The y-values to fit the line to.
java.lang.RuntimeException
- Thrown when an error is encountered in the fitting procedure.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |