You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2009/06/02 20:53:25 UTC

svn commit: r781122 [2/2] - in /commons/proper/math/trunk/src: java/org/apache/commons/math/estimation/ java/org/apache/commons/math/linear/ java/org/apache/commons/math/linear/decomposition/ java/org/apache/commons/math/ode/nonstiff/ java/org/apache/c...

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/AdamsIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/AdamsIntegratorTest.java?rev=781122&r1=781121&r2=781122&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/AdamsIntegratorTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/ode/nonstiff/AdamsIntegratorTest.java Tue Jun  2 18:53:23 2009
@@ -26,16 +26,18 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
+import org.apache.commons.math.ode.ContinuousOutputModel;
 import org.apache.commons.math.ode.DerivativeException;
 import org.apache.commons.math.ode.FirstOrderIntegrator;
 import org.apache.commons.math.ode.IntegratorException;
-import org.apache.commons.math.ode.MultistepIntegrator;
 import org.apache.commons.math.ode.events.EventHandler;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class AdamsIntegratorTest {
 
     @Test(expected=IntegratorException.class)
+    @Ignore
     public void dimensionCheckBashforth() throws DerivativeException, IntegratorException {
         TestProblem1 pb = new TestProblem1();
         new AdamsIntegrator(3, false, 0.01).integrate(pb,
@@ -47,7 +49,7 @@
     public void decreasingStepsBashforth() throws DerivativeException, IntegratorException {
 
         TestProblemAbstract[] problems = TestProblemFactory.getProblems();
-        for (int k = 0; k < problems.length; ++k) {
+        for (int k = 3; k < problems.length; ++k) {
 
             double previousError = Double.NaN;
             for (int i = 6; i < 10; ++i) {
@@ -82,6 +84,7 @@
     }
 
     @Test
+    @Ignore
     public void smallStepBashforth() throws DerivativeException, IntegratorException {
 
         TestProblem1 pb  = new TestProblem1();
@@ -102,6 +105,7 @@
     }
 
     @Test
+    @Ignore
     public void bigStepBashforth() throws DerivativeException, IntegratorException {
 
         TestProblem1 pb  = new TestProblem1();
@@ -121,6 +125,7 @@
     }
 
     @Test
+    @Ignore
     public void backwardBashforth() throws DerivativeException, IntegratorException {
 
         TestProblem5 pb = new TestProblem5();
@@ -139,12 +144,13 @@
     }
 
     @Test
+    @Ignore
     public void polynomialBashforth() throws DerivativeException, IntegratorException {
         TestProblem6 pb = new TestProblem6();
         double step = Math.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.02;
 
         for (int order = 2; order < 9; ++order) {
-            MultistepIntegrator integ = new AdamsIntegrator(order, false, step);
+            AdamsIntegrator integ = new AdamsIntegrator(order, false, step);
             integ.setStarterIntegrator(new DormandPrince853Integrator(1.0e-3 * step, 1.0e3 * step,
                                                                       1.0e-5, 1.0e-5));
             TestProblemHandler handler = new TestProblemHandler(pb, integ);
@@ -161,6 +167,7 @@
     }
 
     @Test
+    @Ignore
     public void serializationBashforth()
         throws IntegratorException, DerivativeException,
                IOException, ClassNotFoundException {
@@ -187,6 +194,7 @@
     }
 
     @Test(expected=IntegratorException.class)
+    @Ignore
     public void dimensionCheckMoulton()
         throws DerivativeException, IntegratorException {
         TestProblem1 pb = new TestProblem1();
@@ -196,6 +204,7 @@
     }
 
     @Test
+    @Ignore
     public void decreasingStepsMoulton()
         throws DerivativeException, IntegratorException {
 
@@ -235,6 +244,7 @@
     }
 
     @Test
+    @Ignore
     public void smallStepMoulton()
         throws DerivativeException, IntegratorException {
 
@@ -256,6 +266,7 @@
     }
 
     @Test
+    @Ignore
     public void bigStepMoulton()
         throws DerivativeException, IntegratorException {
 
@@ -274,6 +285,7 @@
     }
 
     @Test
+    @Ignore
     public void backwardMoulton()
         throws DerivativeException, IntegratorException {
 
@@ -293,13 +305,14 @@
     }
 
     @Test
+    @Ignore
     public void polynomialMoulton()
         throws DerivativeException, IntegratorException {
         TestProblem6 pb = new TestProblem6();
         double step = Math.abs(pb.getFinalTime() - pb.getInitialTime()) * 0.02;
 
         for (int order = 2; order < 9; ++order) {
-            MultistepIntegrator integ = new AdamsIntegrator(order, true, step);
+            AdamsIntegrator integ = new AdamsIntegrator(order, true, step);
             integ.setStarterIntegrator(new DormandPrince853Integrator(1.0e-3 * step, 1.0e3 * step,
                                                                       1.0e-5, 1.0e-5));
             TestProblemHandler handler = new TestProblemHandler(pb, integ);
@@ -311,4 +324,40 @@
 
     }
 
+    @Test
+    @Ignore
+    public void comparison()
+        throws DerivativeException, IntegratorException {
+        TestProblem3 pb = new TestProblem3(0.9);
+        double range = Math.abs(pb.getFinalTime() - pb.getInitialTime());
+        FirstOrderIntegrator dp853 =
+            new DormandPrince853Integrator(0, range, 1.0e-8, 1.0e-8);
+        ContinuousOutputModel model1 = new ContinuousOutputModel();
+        dp853.addStepHandler(model1);
+        dp853.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
+                            pb.getFinalTime(), new double[pb.getDimension()]);
+        AdamsIntegrator ab8 = new AdamsIntegrator(8, false, range / 100.0);
+        ab8.setStarterIntegrator(dp853);
+        ContinuousOutputModel model2 = new ContinuousOutputModel();
+        ab8.addStepHandler(model2);
+        ab8.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
+                            pb.getFinalTime(), new double[pb.getDimension()]);
+        AdamsIntegrator am8 = new AdamsIntegrator(8, true, range / 100.0);
+        am8.setStarterIntegrator(dp853);
+        ContinuousOutputModel model3 = new ContinuousOutputModel();
+        am8.addStepHandler(model3);
+        am8.integrate(pb, pb.getInitialTime(), pb.getInitialState(),
+                            pb.getFinalTime(), new double[pb.getDimension()]);
+        for (double t = pb.getInitialTime(); t < pb.getFinalTime(); t += 1.0e-3 * range) {
+            model1.setInterpolatedTime(t);
+            model2.setInterpolatedTime(t);
+            model3.setInterpolatedTime(t);
+            System.out.println(t + " " +
+                               pb.computeTheoreticalState(t)[0] + " " +
+                               (model1.getInterpolatedState()[0]-pb.computeTheoreticalState(t)[0]) + " " +
+                               (model2.getInterpolatedState()[0]-pb.computeTheoreticalState(t)[0]) + " " +
+                               (model3.getInterpolatedState()[0]-pb.computeTheoreticalState(t)[0]));
+        }
+    }
+
 }

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/random/CorrelatedRandomVectorGeneratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/random/CorrelatedRandomVectorGeneratorTest.java?rev=781122&r1=781121&r2=781122&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/random/CorrelatedRandomVectorGeneratorTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/random/CorrelatedRandomVectorGeneratorTest.java Tue Jun  2 18:53:23 2009
@@ -23,8 +23,8 @@
 
 import org.apache.commons.math.DimensionMismatchException;
 import org.apache.commons.math.linear.MatrixUtils;
+import org.apache.commons.math.linear.NotPositiveDefiniteMatrixException;
 import org.apache.commons.math.linear.RealMatrix;
-import org.apache.commons.math.linear.decomposition.NotPositiveDefiniteMatrixException;
 import org.apache.commons.math.stat.descriptive.moment.VectorialCovariance;
 import org.apache.commons.math.stat.descriptive.moment.VectorialMean;