commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1071429 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/analysis/ main/java/org/apache/commons/math/optimization/fitting/ site/xdoc/ test/java/org/apache/commons/math/optimization/fitting/
Date Wed, 16 Feb 2011 22:45:47 GMT
Author: erans
Date: Wed Feb 16 22:45:47 2011
New Revision: 1071429

URL: http://svn.apache.org/viewvc?rev=1071429&view=rev
Log:
MATH-513
Renamed "o.a.c.math.optimization.fitting.ParametricRealFunction" to
"o.a.c.math.analysis.ParametricUnivariateRealFunction". Modified all
affected files.

Added:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/ParametricUnivariateRealFunction.java
      - copied, changed from r1071418, commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/ParametricRealFunction.java
Removed:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/ParametricRealFunction.java
Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/CurveFitter.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/GaussianFitter.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/HarmonicFitter.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/ParametricGaussianFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/PolynomialFitter.java
    commons/proper/math/trunk/src/site/xdoc/changes.xml
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/fitting/CurveFitterTest.java

Copied: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/ParametricUnivariateRealFunction.java
(from r1071418, commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/ParametricRealFunction.java)
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/ParametricUnivariateRealFunction.java?p2=commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/ParametricUnivariateRealFunction.java&p1=commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/ParametricRealFunction.java&r1=1071418&r2=1071429&rev=1071429&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/ParametricRealFunction.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/ParametricUnivariateRealFunction.java
Wed Feb 16 22:45:47 2011
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math.optimization.fitting;
+package org.apache.commons.math.analysis;
 
 /**
  * An interface representing a real function that depends on one independent
@@ -23,7 +23,7 @@ package org.apache.commons.math.optimiza
  *
  * @version $Revision$ $Date$
  */
-public interface ParametricRealFunction {
+public interface ParametricUnivariateRealFunction {
     /**
      * Compute the value of the function.
      *
@@ -31,7 +31,7 @@ public interface ParametricRealFunction 
      * @param parameters Function parameters.
      * @return the value.
      */
-    double value(double x, double[] parameters);
+    double value(double x, double ... parameters);
 
     /**
      * Compute the gradient of the function with respect to its parameters.
@@ -40,5 +40,5 @@ public interface ParametricRealFunction 
      * @param parameters Function parameters.
      * @return the value.
      */
-    double[] gradient(double x, double[] parameters);
+    double[] gradient(double x, double ... parameters);
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/CurveFitter.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/CurveFitter.java?rev=1071429&r1=1071428&r2=1071429&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/CurveFitter.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/CurveFitter.java
Wed Feb 16 22:45:47 2011
@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.commons.math.analysis.DifferentiableMultivariateVectorialFunction;
+import org.apache.commons.math.analysis.ParametricUnivariateRealFunction;
 import org.apache.commons.math.analysis.MultivariateMatrixFunction;
 import org.apache.commons.math.optimization.DifferentiableMultivariateVectorialOptimizer;
 import org.apache.commons.math.optimization.VectorialPointValuePair;
@@ -121,7 +122,7 @@ public class CurveFitter {
      * @throws org.apache.commons.math.exception.MathUserException if the
      * parametric function throws one.
      */
-    public double[] fit(final ParametricRealFunction f, final double[] initialGuess) {
+    public double[] fit(final ParametricUnivariateRealFunction f, final double[] initialGuess)
{
         return fit(Integer.MAX_VALUE, f, initialGuess);
     }
 
@@ -143,7 +144,7 @@ public class CurveFitter {
      * @throws org.apache.commons.math.exception.MathUserException if the
      * parametric function throws one.
      */
-    public double[] fit(int maxEval, final ParametricRealFunction f,
+    public double[] fit(int maxEval, final ParametricUnivariateRealFunction f,
                         final double[] initialGuess) {
         // prepare least squares problem
         double[] target  = new double[observations.size()];
@@ -168,12 +169,12 @@ public class CurveFitter {
     private class TheoreticalValuesFunction
         implements DifferentiableMultivariateVectorialFunction {
         /** Function to fit. */
-        private final ParametricRealFunction f;
+        private final ParametricUnivariateRealFunction f;
 
         /** Simple constructor.
          * @param f function to fit.
          */
-        public TheoreticalValuesFunction(final ParametricRealFunction f) {
+        public TheoreticalValuesFunction(final ParametricUnivariateRealFunction f) {
             this.f = f;
         }
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/GaussianFitter.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/GaussianFitter.java?rev=1071429&r1=1071428&r2=1071429&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/GaussianFitter.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/GaussianFitter.java
Wed Feb 16 22:45:47 2011
@@ -86,7 +86,7 @@ public class GaussianFitter {
     /**
      * Fits Gaussian function to the observed points.
      * It will call the base class
-     * {@link CurveFitter#fit(ParametricRealFunction,double[]) fit} method.
+     * {@link CurveFitter#fit(ParametricUnivariateRealFunction,double[]) fit} method.
      *
      * @return the Gaussian function that best fits the observed points.
      * @see CurveFitter

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/HarmonicFitter.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/HarmonicFitter.java?rev=1071429&r1=1071428&r2=1071429&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/HarmonicFitter.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/HarmonicFitter.java
Wed Feb 16 22:45:47 2011
@@ -21,6 +21,7 @@ import org.apache.commons.math.exception
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.optimization.DifferentiableMultivariateVectorialOptimizer;
 import org.apache.commons.math.optimization.OptimizationException;
+import org.apache.commons.math.analysis.ParametricUnivariateRealFunction;
 import org.apache.commons.math.util.FastMath;
 
 /** This class implements a curve fitting specialized for sinusoids.
@@ -102,7 +103,7 @@ public class HarmonicFitter {
     }
 
     /** Parametric harmonic function. */
-    private static class ParametricHarmonicFunction implements ParametricRealFunction {
+    private static class ParametricHarmonicFunction implements ParametricUnivariateRealFunction
{
 
         /** {@inheritDoc} */
         public double value(double x, double[] parameters) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/ParametricGaussianFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/ParametricGaussianFunction.java?rev=1071429&r1=1071428&r2=1071429&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/ParametricGaussianFunction.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/ParametricGaussianFunction.java
Wed Feb 16 22:45:47 2011
@@ -23,7 +23,7 @@ import org.apache.commons.math.exception
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.exception.ZeroException;
 import org.apache.commons.math.exception.NullArgumentException;
-import org.apache.commons.math.optimization.fitting.ParametricRealFunction;
+import org.apache.commons.math.analysis.ParametricUnivariateRealFunction;
 
 /**
  * A Gaussian function.  Specifically:
@@ -53,7 +53,7 @@ import org.apache.commons.math.optimizat
  * @since 2.2
  * @version $Revision$ $Date$
  */
-public class ParametricGaussianFunction implements ParametricRealFunction, Serializable {
+public class ParametricGaussianFunction implements ParametricUnivariateRealFunction, Serializable
{
     /** Serializable version Id. */
     private static final long serialVersionUID = -3875578602503903233L;
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/PolynomialFitter.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/PolynomialFitter.java?rev=1071429&r1=1071428&r2=1071429&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/PolynomialFitter.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/PolynomialFitter.java
Wed Feb 16 22:45:47 2011
@@ -18,6 +18,7 @@
 package org.apache.commons.math.optimization.fitting;
 
 import org.apache.commons.math.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math.analysis.ParametricUnivariateRealFunction;
 import org.apache.commons.math.optimization.DifferentiableMultivariateVectorialOptimizer;
 
 /** This class implements a curve fitting specialized for polynomials.
@@ -80,7 +81,7 @@ public class PolynomialFitter {
     /**
      * Dedicated parametric polynomial class.
      */
-    private static class ParametricPolynomial implements ParametricRealFunction {
+    private static class ParametricPolynomial implements ParametricUnivariateRealFunction
{
 
         /** {@inheritDoc} */
         public double[] gradient(double x, double[] parameters) {

Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=1071429&r1=1071428&r2=1071429&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Wed Feb 16 22:45:47 2011
@@ -52,6 +52,10 @@ The <action> type attribute can be add,u
     If the output is not quite correct, check for invisible trailing spaces!
      -->
     <release version="3.0" date="TBD" description="TBD">
+      <action dev="erans" type="fix" issue="MATH-513">
+        The interface "ParametricRealFunction" (in package "optimization.fitting") has
+        been renamed to "ParametricUnivariateRealFunction" and moved to package "analysis".
+      </action>
       <action dev="sebb" type="fix" issue="MATH-505">
           TestUtils is thread-hostile. Remove getters and setters, and make static variables
final.
       </action>

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/fitting/CurveFitterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/fitting/CurveFitterTest.java?rev=1071429&r1=1071428&r2=1071429&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/fitting/CurveFitterTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/fitting/CurveFitterTest.java
Wed Feb 16 22:45:47 2011
@@ -19,6 +19,7 @@ package org.apache.commons.math.optimiza
 
 import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.optimization.general.LevenbergMarquardtOptimizer;
+import org.apache.commons.math.analysis.ParametricUnivariateRealFunction;
 import org.apache.commons.math.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
@@ -36,7 +37,7 @@ public class CurveFitterTest {
         fitter.addObservedPoint(1.655d, 0.9474675497289684);
         fitter.addObservedPoint(1.725d, 0.9013594835804194d);
 
-        ParametricRealFunction sif = new SimpleInverseFunction();
+        ParametricUnivariateRealFunction sif = new SimpleInverseFunction();
 
         double[] initialguess1 = new double[1];
         initialguess1[0] = 1.0d;
@@ -60,7 +61,7 @@ public class CurveFitterTest {
         fitter.addObservedPoint(1.655d, 0.9474675497289684);
         fitter.addObservedPoint(1.725d, 0.9013594835804194d);
 
-        ParametricRealFunction sif = new SimpleInverseFunction();
+        ParametricUnivariateRealFunction sif = new SimpleInverseFunction();
 
         double[] initialguess1 = new double[1];
         initialguess1[0] = 1.0d;
@@ -85,7 +86,7 @@ public class CurveFitterTest {
         curveFitter.addObservedPoint(250, 45087);
         curveFitter.addObservedPoint(500, 50683);
 
-        ParametricRealFunction f = new ParametricRealFunction() {
+        ParametricUnivariateRealFunction f = new ParametricUnivariateRealFunction() {
 
             public double value(double x, double[] parameters) {
 
@@ -136,7 +137,7 @@ public class CurveFitterTest {
 
     }
 
-    private static class SimpleInverseFunction implements ParametricRealFunction {
+    private static class SimpleInverseFunction implements ParametricUnivariateRealFunction
{
 
         public double value(double x, double[] parameters) {
             return parameters[0] / x + (parameters.length < 2 ? 0 : parameters[1]);



Mime
View raw message