commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1144861 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/analysis/solvers/ test/java/org/apache/commons/math/analysis/solvers/
Date Sun, 10 Jul 2011 13:48:37 GMT
Author: luc
Date: Sun Jul 10 13:48:36 2011
New Revision: 1144861

URL: http://svn.apache.org/viewvc?rev=1144861&view=rev
Log:
added constructors with function value accuracy

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BaseSecantSolver.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/IllinoisSolver.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/PegasusSolver.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/RegulaFalsiSolver.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BaseSecantSolverAbstractTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BaseSecantSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BaseSecantSolver.java?rev=1144861&r1=1144860&r2=1144861&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BaseSecantSolver.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BaseSecantSolver.java
Sun Jul 10 13:48:36 2011
@@ -85,6 +85,23 @@ public abstract class BaseSecantSolver
         this.method = method;
     }
 
+    /**
+     * Construct a solver.
+     *
+     * @param relativeAccuracy Maximum relative error.
+     * @param absoluteAccuracy Maximum absolute error.
+     * @param functionValueAccuracy Maximum function value error.
+     * @param method <em>Secant</em>-based root-finding method to use
+     */
+    protected BaseSecantSolver(final double relativeAccuracy,
+                               final double absoluteAccuracy,
+                               final double functionValueAccuracy,
+                               final Method method) {
+        super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
+        this.allowed = AllowedSolutions.ANY_SIDE;
+        this.method = method;
+    }
+
     /** {@inheritDoc} */
     public double solve(final int maxEval, final UnivariateRealFunction f,
                         final double min, final double max,

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/IllinoisSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/IllinoisSolver.java?rev=1144861&r1=1144860&r2=1144861&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/IllinoisSolver.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/IllinoisSolver.java
Sun Jul 10 13:48:36 2011
@@ -17,6 +17,7 @@
 
 package org.apache.commons.math.analysis.solvers;
 
+
 /**
  * Implements the <em>Illinois</em> method for root-finding (approximating
  * a zero of a univariate real function). It is a modified
@@ -64,4 +65,18 @@ public class IllinoisSolver extends Base
                           final double absoluteAccuracy) {
         super(relativeAccuracy, absoluteAccuracy, Method.ILLINOIS);
     }
+
+    /**
+     * Construct a solver.
+     *
+     * @param relativeAccuracy relative accuracy
+     * @param absoluteAccuracy absolute accuracy
+     * @param functionValueAccuracy Maximum function value error.
+     */
+    public IllinoisSolver(final double relativeAccuracy,
+                          final double absoluteAccuracy,
+                          final double functionValueAccuracy) {
+        super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, Method.PEGASUS);
+    }
+
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/PegasusSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/PegasusSolver.java?rev=1144861&r1=1144860&r2=1144861&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/PegasusSolver.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/PegasusSolver.java
Sun Jul 10 13:48:36 2011
@@ -66,4 +66,18 @@ public class PegasusSolver extends BaseS
                          final double absoluteAccuracy) {
         super(relativeAccuracy, absoluteAccuracy, Method.PEGASUS);
     }
+
+    /**
+     * Construct a solver.
+     *
+     * @param relativeAccuracy relative accuracy
+     * @param absoluteAccuracy absolute accuracy
+     * @param functionValueAccuracy Maximum function value error.
+     */
+    public PegasusSolver(final double relativeAccuracy,
+                         final double absoluteAccuracy,
+                         final double functionValueAccuracy) {
+        super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, Method.PEGASUS);
+    }
+
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/RegulaFalsiSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/RegulaFalsiSolver.java?rev=1144861&r1=1144860&r2=1144861&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/RegulaFalsiSolver.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/RegulaFalsiSolver.java
Sun Jul 10 13:48:36 2011
@@ -17,6 +17,7 @@
 
 package org.apache.commons.math.analysis.solvers;
 
+
 /**
  * Implements the <em>Regula Falsi</em> or <em>False position</em>
method for
  * root-finding (approximating a zero of a univariate real function). It is a
@@ -61,4 +62,18 @@ public class RegulaFalsiSolver extends B
                              final double absoluteAccuracy) {
         super(relativeAccuracy, absoluteAccuracy, Method.REGULA_FALSI);
     }
+
+    /**
+     * Construct a solver.
+     *
+     * @param relativeAccuracy relative accuracy
+     * @param absoluteAccuracy absolute accuracy
+     * @param functionValueAccuracy Maximum function value error.
+     */
+    public RegulaFalsiSolver(final double relativeAccuracy,
+                             final double absoluteAccuracy,
+                             final double functionValueAccuracy) {
+        super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, Method.PEGASUS);
+    }
+
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BaseSecantSolverAbstractTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BaseSecantSolverAbstractTest.java?rev=1144861&r1=1144860&r2=1144861&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BaseSecantSolverAbstractTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/solvers/BaseSecantSolverAbstractTest.java
Sun Jul 10 13:48:36 2011
@@ -247,7 +247,8 @@ public abstract class BaseSecantSolverAb
                 return Double.NaN;
             }
             PegasusSolver bracketing =
-                    new PegasusSolver(solver.getRelativeAccuracy(), solver.getAbsoluteAccuracy());
+                    new PegasusSolver(solver.getRelativeAccuracy(), solver.getAbsoluteAccuracy(),
+                                      solver.getFunctionValueAccuracy());
             return UnivariateRealSolverUtils.forceSide(maxEval - solver.getEvaluations(),
                                                        f, bracketing, baseRoot, left, right,
                                                        allowedSolutions);



Mime
View raw message