Changed the return type of the various interpolation algorithms to the
specific implementation of UnivariateRealFunction each one uses (thanks to Gilles for reporting the problem and providing the patch) git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@794709 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3addbb3243
commit
56a4d632c5
|
@ -19,7 +19,6 @@ package org.apache.commons.math.analysis.interpolation;
|
|||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.math.DuplicateSampleAbscissaException;
|
||||
import org.apache.commons.math.analysis.UnivariateRealFunction;
|
||||
import org.apache.commons.math.analysis.polynomials.PolynomialFunctionLagrangeForm;
|
||||
import org.apache.commons.math.analysis.polynomials.PolynomialFunctionNewtonForm;
|
||||
|
||||
|
@ -50,7 +49,7 @@ public class DividedDifferenceInterpolator implements UnivariateRealInterpolator
|
|||
* @return a function which interpolates the data set
|
||||
* @throws DuplicateSampleAbscissaException if arguments are invalid
|
||||
*/
|
||||
public UnivariateRealFunction interpolate(double x[], double y[]) throws
|
||||
public PolynomialFunctionNewtonForm interpolate(double x[], double y[]) throws
|
||||
DuplicateSampleAbscissaException {
|
||||
|
||||
/**
|
||||
|
@ -76,9 +75,8 @@ public class DividedDifferenceInterpolator implements UnivariateRealInterpolator
|
|||
}
|
||||
a = computeDividedDifference(x, y);
|
||||
|
||||
PolynomialFunctionNewtonForm p;
|
||||
p = new PolynomialFunctionNewtonForm(a, c);
|
||||
return p;
|
||||
return new PolynomialFunctionNewtonForm(a, c);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
*/
|
||||
package org.apache.commons.math.analysis.interpolation;
|
||||
|
||||
import org.apache.commons.math.analysis.UnivariateRealFunction;
|
||||
import org.apache.commons.math.MathException;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.commons.math.MathException;
|
||||
import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;
|
||||
|
||||
/**
|
||||
* Implements the <a href="http://en.wikipedia.org/wiki/Local_regression">
|
||||
* Local Regression Algorithm</a> (also Loess, Lowess) for interpolation of
|
||||
|
@ -132,7 +132,7 @@ public class LoessInterpolator
|
|||
* <li> All arguments and values are finite real numbers</li>
|
||||
* </ul>
|
||||
*/
|
||||
public final UnivariateRealFunction interpolate(
|
||||
public final PolynomialSplineFunction interpolate(
|
||||
final double[] xval, final double[] yval) throws MathException {
|
||||
return new SplineInterpolator().interpolate(xval, smooth(xval, yval));
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
package org.apache.commons.math.analysis.interpolation;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.math.MathException;
|
||||
import org.apache.commons.math.analysis.UnivariateRealFunction;
|
||||
import org.apache.commons.math.analysis.polynomials.PolynomialFunctionLagrangeForm;
|
||||
|
||||
/**
|
||||
|
@ -47,11 +47,8 @@ public class NevilleInterpolator implements UnivariateRealInterpolator,
|
|||
* @return a function which interpolates the data set
|
||||
* @throws MathException if arguments are invalid
|
||||
*/
|
||||
public UnivariateRealFunction interpolate(double x[], double y[]) throws
|
||||
MathException {
|
||||
|
||||
PolynomialFunctionLagrangeForm p;
|
||||
p = new PolynomialFunctionLagrangeForm(x, y);
|
||||
return p;
|
||||
public PolynomialFunctionLagrangeForm interpolate(double x[], double y[])
|
||||
throws MathException {
|
||||
return new PolynomialFunctionLagrangeForm(x, y);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.apache.commons.math.analysis.interpolation;
|
||||
|
||||
import org.apache.commons.math.MathRuntimeException;
|
||||
import org.apache.commons.math.analysis.UnivariateRealFunction;
|
||||
import org.apache.commons.math.analysis.polynomials.PolynomialFunction;
|
||||
import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;
|
||||
|
||||
|
@ -56,7 +55,7 @@ public class SplineInterpolator implements UnivariateRealInterpolator {
|
|||
* @param y the values for the interpolation points
|
||||
* @return a function which interpolates the data set
|
||||
*/
|
||||
public UnivariateRealFunction interpolate(double x[], double y[]) {
|
||||
public PolynomialSplineFunction interpolate(double x[], double y[]) {
|
||||
if (x.length != y.length) {
|
||||
throw MathRuntimeException.createIllegalArgumentException(
|
||||
"dimension mismatch {0} != {1}", x.length, y.length);
|
||||
|
|
|
@ -39,6 +39,10 @@ The <action> type attribute can be add,update,fix,remove.
|
|||
</properties>
|
||||
<body>
|
||||
<release version="2.0" date="TBD" description="TBD">
|
||||
<action dev="luc" type="update" due-to="Gilles Sadowski">
|
||||
Changed the return type of the various interpolation algorithms to the
|
||||
specific implementation of UnivariateRealFunction each one uses
|
||||
</action>
|
||||
<action dev="luc" type="fix" issue="MATH-280">
|
||||
The behavior of the bracket method in UnivariateRealSolverUtils has been changed to return successfully
|
||||
when a tentative bracketing interval has a root exactly at one of its end points. Previously, such intervals
|
||||
|
|
Loading…
Reference in New Issue