commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1426235 - /commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/forward/ForwardModeDifferentiatorTest.java
Date Thu, 27 Dec 2012 15:55:30 GMT
Author: luc
Date: Thu Dec 27 15:55:30 2012
New Revision: 1426235

URL: http://svn.apache.org/viewvc?rev=1426235&view=rev
Log:
preparing test for multiple objects handling (failing for now as support is not enabled yet)

Modified:
    commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/forward/ForwardModeDifferentiatorTest.java

Modified: commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/forward/ForwardModeDifferentiatorTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/forward/ForwardModeDifferentiatorTest.java?rev=1426235&r1=1426234&r2=1426235&view=diff
==============================================================================
--- commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/forward/ForwardModeDifferentiatorTest.java
(original)
+++ commons/sandbox/nabla/trunk/src/test/java/org/apache/commons/nabla/forward/ForwardModeDifferentiatorTest.java
Thu Dec 27 15:55:30 2012
@@ -21,10 +21,12 @@ import java.lang.reflect.Method;
 import org.apache.commons.math3.analysis.UnivariateFunction;
 import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
 import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
 import org.apache.commons.math3.util.FastMath;
 import org.apache.commons.nabla.AbstractMathTest;
 import org.junit.Assert;
 import org.junit.Test;
+import org.junit.Ignore;
 
 public class ForwardModeDifferentiatorTest extends AbstractMathTest {
 
@@ -342,4 +344,37 @@ public class ForwardModeDifferentiatorTe
         }
     }
 
+    // As of 2012-12-27, this test does not work yet...
+    @Ignore
+    @Test
+    public void testSeveralObjects() {
+        SeveralObjectsFunction function =
+                new SeveralObjectsFunction(1, 2, 3, 4, 5, 6, 7, 8, 9);
+        checkReference(function, 0.0, 10.0, 20, 1.0e-16);
+    }
+
+    public static class SeveralObjectsFunction implements ReferenceFunction {
+
+        private final Vector3D u1;
+        private final Vector3D u2;
+        private final Vector3D u3;
+
+        public SeveralObjectsFunction(double x1, double y1, double z1,
+                                      double x2, double y2, double z2,
+                                      double x3, double y3, double z3) {
+            u1 = new Vector3D(x1, y1, z1);
+            u2 = new Vector3D(x2, y2, z2);
+            u3 = new Vector3D(x3, y3, z3);
+        }
+
+        public double value(double y) {
+            return new Vector3D(1.0, u1, y, u2).dotProduct(u3);
+        }
+
+        public double firstDerivative(double t) {
+            return u2.dotProduct(u3);
+        }
+
+    }
+    
 }



Mime
View raw message