commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1331635 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/univariate/BrentOptimizer.java
Date Fri, 27 Apr 2012 23:30:41 GMT
Author: erans
Date: Fri Apr 27 23:30:41 2012
New Revision: 1331635

URL: http://svn.apache.org/viewvc?rev=1331635&view=rev
Log:
MATH-782
Location of user-defined convergence check.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/univariate/BrentOptimizer.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/univariate/BrentOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/univariate/BrentOptimizer.java?rev=1331635&r1=1331634&r2=1331635&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/univariate/BrentOptimizer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/univariate/BrentOptimizer.java
Fri Apr 27 23:30:41 2012
@@ -220,6 +220,16 @@ public class BrentOptimizer extends Base
                     fu = -fu;
                 }
 
+                // User-defined convergence checker.
+                previous = current;
+                current = new UnivariatePointValuePair(u, isMinim ? fu : -fu);
+
+                if (checker != null) {
+                    if (checker.converged(iter, previous, current)) {
+                        return current;
+                    }
+                }
+
                 // Update a, b, v, w and x.
                 if (fu <= fx) {
                     if (u < x) {
@@ -233,16 +243,6 @@ public class BrentOptimizer extends Base
                     fw = fx;
                     x = u;
                     fx = fu;
-
-                    // User-defined convergence checker.
-                    previous = current;
-                    current = new UnivariatePointValuePair(x, isMinim ? fx : -fx);
-
-                    if (checker != null) {
-                        if (checker.converged(iter, previous, current)) {
-                            return current;
-                        }
-                    }
                 } else {
                     if (u < x) {
                         a = u;



Mime
View raw message