commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r782434 - /commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblemHandler.java
Date Sun, 07 Jun 2009 19:12:18 GMT
Author: luc
Date: Sun Jun  7 19:12:18 2009
New Revision: 782434

URL: http://svn.apache.org/viewvc?rev=782434&view=rev
Log:
improved max errors computations: previously, NaN values induces the error update to be skipped,
thus leading to artificially good results

Modified:
    commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblemHandler.java

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblemHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblemHandler.java?rev=782434&r1=782433&r2=782434&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblemHandler.java
(original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/TestProblemHandler.java
Sun Jun  7 19:12:18 2009
@@ -97,9 +97,7 @@
       double[] theoreticalY  = problem.computeTheoreticalState(cT);
       for (int i = 0; i < interpolatedY.length; ++i) {
         double error = Math.abs(interpolatedY[i] - theoreticalY[i]);
-        if (error > lastError) {
-          lastError = error;
-        }
+        lastError = Math.max(error, lastError);
       }
       lastTime = cT;
     }
@@ -115,11 +113,8 @@
       // update the errors
       for (int i = 0; i < interpolatedY.length; ++i) {
         double error = errorScale[i] * Math.abs(interpolatedY[i] - theoreticalY[i]);
-        if (error > maxValueError) {
-          maxValueError = error;
-        }
+        maxValueError = Math.max(error, maxValueError);
       }
-
     }
   }
 



Mime
View raw message