Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C002ACDCC for ; Fri, 27 Apr 2012 23:31:05 +0000 (UTC) Received: (qmail 87792 invoked by uid 500); 27 Apr 2012 23:31:05 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 87714 invoked by uid 500); 27 Apr 2012 23:31:05 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 87707 invoked by uid 99); 27 Apr 2012 23:31:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Apr 2012 23:31:05 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Apr 2012 23:31:03 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 109E32388847 for ; Fri, 27 Apr 2012 23:30:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@commons.apache.org From: erans@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120427233042.109E32388847@eris.apache.org> 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;