Author: luc
Date: Sun Jul 10 16:51:02 2011
New Revision: 1144902

URL: http://svn.apache.org/viewvc?rev=1144902&view=rev
Log:
Prevent step normalizer to output twice the last point in MULTIPLES mode.

JIRA: MATH-603

Modified:
    
commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepNormalizer.java
    commons/proper/math/trunk/src/site/xdoc/changes.xml

Modified: 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepNormalizer.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepNormalizer.java?rev=1144902&r1=1144901&r2=1144902&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepNormalizer.java
 (original)
+++ 
commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepNormalizer.java
 Sun Jul 10 16:51:02 2011
@@ -22,6 +22,7 @@ import org.apache.commons.math.ode.sampl
 import org.apache.commons.math.ode.sampling.StepHandler;
 import org.apache.commons.math.ode.sampling.StepInterpolator;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
 
 /**
  * This class wraps an object implementing {@link FixedStepHandler}
@@ -213,9 +214,14 @@ public class StepNormalizer implements S
             }
         }
 
+        // Calculate next normalized step time.
         double nextTime = (mode == StepNormalizerMode.INCREMENT) ?
                           lastTime + h :
                           (FastMath.floor(lastTime / h) + 1) * h;
+        if (mode == StepNormalizerMode.MULTIPLES &&
+            MathUtils.equals(nextTime, lastTime, 1)) {
+            nextTime += h;
+        }
         boolean nextInStep = isNextInStep(nextTime, interpolator);
         while (nextInStep) {
             // Output the stored previous step.

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=1144902&r1=1144901&r2=1144902&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Sun Jul 10 16:51:02 2011
@@ -52,12 +52,15 @@ 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="luc" type="fix" issue="MATH-603" due-to="Dennis Hendriks">
+        Prevent step normalizer to output twice the last point in MULTIPLES 
mode.
+      </action>
       <action dev="luc" type="fix" issue="MATH-596,MATH-604">
         Removed the requiresDenseOutput method from the StepHandler interface. 
Now integrators always
         consider dense output is required and set up the appropriate state 
interpolators, so step
         handlers can rely on them.
       </action>
-      <action dev="eran" type="add" issue="MATH-599" due-to="Dennis Hendriks">
+      <action dev="erans" type="add" issue="MATH-599" due-to="Dennis Hendriks">
         Modified "SecantSolver" to comply with the original algorithm. Added 
several
         secant-based solvers. Added a way to select the side of the root with 
bracketing
         solvers.


Reply via email to