commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From celes...@apache.org
Subject svn commit: r1164622 - in /commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear: CholeskySolverTest.java EigenSolverTest.java LUSolverTest.java QRSolverTest.java SingularValueSolverTest.java
Date Fri, 02 Sep 2011 16:46:21 GMT
Author: celestin
Date: Fri Sep  2 16:46:20 2011
New Revision: 1164622

URL: http://svn.apache.org/viewvc?rev=1164622&view=rev
Log:
In all unit-tests of DecompositionSolver implementations: removed calls to DecompositionSolver.solve(double[])
(MATH-653)

Modified:
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/CholeskySolverTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/EigenSolverTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/LUSolverTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/QRSolverTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SingularValueSolverTest.java

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/CholeskySolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/CholeskySolverTest.java?rev=1164622&r1=1164621&r2=1164622&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/CholeskySolverTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/CholeskySolverTest.java
Fri Sep  2 16:46:20 2011
@@ -45,7 +45,7 @@ public class CholeskySolverTest {
             // expected behavior
         }
         try {
-            solver.solve(b.getColumn(0));
+            solver.solve(b.getColumnVector(0));
             Assert.fail("an exception should have been thrown");
         } catch (MathIllegalArgumentException iae) {
             // expected behavior
@@ -84,13 +84,6 @@ public class CholeskySolverTest {
         // using double[][]
         Assert.assertEquals(0, MatrixUtils.createRealMatrix(solver.solve(b.getData())).subtract(xRef).getNorm(),
1.0e-13);
 
-        // using double[]
-        for (int i = 0; i < b.getColumnDimension(); ++i) {
-            Assert.assertEquals(0,
-                         new ArrayRealVector(solver.solve(b.getColumn(i))).subtract(xRef.getColumnVector(i)).getNorm(),
-                         1.0e-13);
-        }
-
         // using ArrayRealVector
         for (int i = 0; i < b.getColumnDimension(); ++i) {
             Assert.assertEquals(0,

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/EigenSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/EigenSolverTest.java?rev=1164622&r1=1164621&r2=1164622&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/EigenSolverTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/EigenSolverTest.java
Fri Sep  2 16:46:20 2011
@@ -74,7 +74,7 @@ public class EigenSolverTest {
             // expected behavior
         }
         try {
-            es.solve(b.getColumn(0));
+            es.solve(b.getColumnVector(0));
             Assert.fail("an exception should have been thrown");
         } catch (MathIllegalArgumentException iae) {
             // expected behavior
@@ -124,21 +124,14 @@ public class EigenSolverTest {
         solution = MatrixUtils.createRealMatrix(es.solve(b.getData()));
         Assert.assertEquals(0, solution.subtract(xRef).getNorm(), 2.5e-12);
 
-        // using double[]
-        for (int i = 0; i < b.getColumnDimension(); ++i) {
-            Assert.assertEquals(0,
-                         new ArrayRealVector(es.solve(b.getColumn(i))).subtract(xRef.getColumnVector(i)).getNorm(),
-                         2.0e-11);
-        }
-
-        // using Array2DRowRealMatrix
+        // using RealVector
         for (int i = 0; i < b.getColumnDimension(); ++i) {
             Assert.assertEquals(0,
                          es.solve(b.getColumnVector(i)).subtract(xRef.getColumnVector(i)).getNorm(),
                          2.0e-11);
         }
 
-        // using RealMatrix with an alternate implementation
+        // using RealVector with an alternate implementation
         for (int i = 0; i < b.getColumnDimension(); ++i) {
             ArrayRealVectorTest.RealVectorTestImpl v =
                 new ArrayRealVectorTest.RealVectorTestImpl(b.getColumn(i));

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/LUSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/LUSolverTest.java?rev=1164622&r1=1164621&r2=1164622&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/LUSolverTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/LUSolverTest.java
Fri Sep  2 16:46:20 2011
@@ -83,7 +83,7 @@ public class LUSolverTest {
             // expected behavior
         }
         try {
-            solver.solve(b.getColumn(0));
+            solver.solve(b.getColumnVector(0));
             Assert.fail("an exception should have been thrown");
         } catch (MathIllegalArgumentException iae) {
             // expected behavior
@@ -109,12 +109,6 @@ public class LUSolverTest {
             // expected behavior
         }
         try {
-            solver.solve(b.getColumn(0));
-            Assert.fail("an exception should have been thrown");
-        } catch (SingularMatrixException ime) {
-            // expected behavior
-        }
-        try {
             solver.solve(b.getColumnVector(0));
             Assert.fail("an exception should have been thrown");
         } catch (SingularMatrixException ime) {
@@ -146,13 +140,6 @@ public class LUSolverTest {
         // using double[][]
         Assert.assertEquals(0, MatrixUtils.createRealMatrix(solver.solve(b.getData())).subtract(xRef).getNorm(),
1.0e-13);
 
-        // using double[]
-        for (int i = 0; i < b.getColumnDimension(); ++i) {
-            Assert.assertEquals(0,
-                         new ArrayRealVector(solver.solve(b.getColumn(i))).subtract(xRef.getColumnVector(i)).getNorm(),
-                         1.0e-13);
-        }
-
         // using ArrayRealVector
         for (int i = 0; i < b.getColumnDimension(); ++i) {
             Assert.assertEquals(0,

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/QRSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/QRSolverTest.java?rev=1164622&r1=1164621&r2=1164622&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/QRSolverTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/QRSolverTest.java
Fri Sep  2 16:46:20 2011
@@ -82,12 +82,6 @@ public class QRSolverTest {
             // expected behavior
         }
         try {
-            solver.solve(b.getColumn(0));
-            Assert.fail("an exception should have been thrown");
-        } catch (MathIllegalArgumentException iae) {
-            // expected behavior
-        }
-        try {
             solver.solve(b.getColumnVector(0));
             Assert.fail("an exception should have been thrown");
         } catch (MathIllegalArgumentException iae) {
@@ -108,12 +102,6 @@ public class QRSolverTest {
             // expected behavior
         }
         try {
-            solver.solve(b.getColumn(0));
-            Assert.fail("an exception should have been thrown");
-        } catch (SingularMatrixException iae) {
-            // expected behavior
-        }
-        try {
             solver.solve(b.getColumnVector(0));
             Assert.fail("an exception should have been thrown");
         } catch (SingularMatrixException iae) {
@@ -140,13 +128,6 @@ public class QRSolverTest {
         // using double[][]
         Assert.assertEquals(0, MatrixUtils.createRealMatrix(solver.solve(b.getData())).subtract(xRef).getNorm(),
2.0e-16 * xRef.getNorm());
 
-        // using double[]
-        for (int i = 0; i < b.getColumnDimension(); ++i) {
-            final double[] x = solver.solve(b.getColumn(i));
-            final double error = new ArrayRealVector(x).subtract(xRef.getColumnVector(i)).getNorm();
-            Assert.assertEquals(0, error, 3.0e-16 * xRef.getColumnVector(i).getNorm());
-        }
-
         // using ArrayRealVector
         for (int i = 0; i < b.getColumnDimension(); ++i) {
             final RealVector x = solver.solve(b.getColumnVector(i));

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SingularValueSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SingularValueSolverTest.java?rev=1164622&r1=1164621&r2=1164622&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SingularValueSolverTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SingularValueSolverTest.java
Fri Sep  2 16:46:20 2011
@@ -44,7 +44,7 @@ public class SingularValueSolverTest {
             // expected behavior
         }
         try {
-            solver.solve(b.getColumn(0));
+            solver.solve(b.getColumnVector(0));
             Assert.fail("an exception should have been thrown");
         } catch (MathIllegalArgumentException iae) {
             // expected behavior
@@ -74,9 +74,6 @@ public class SingularValueSolverTest {
         Assert.assertEquals(12, xMatrix.getEntry(0, 1), 1.0e-15);
         Assert.assertEquals(0, xMatrix.getEntry(1, 0), 1.0e-15);
         Assert.assertEquals(0, xMatrix.getEntry(1, 1), 1.0e-15);
-        double[] xCol = solver.solve(b.getColumn(0));
-        Assert.assertEquals(11, xCol[0], 1.0e-15);
-        Assert.assertEquals(0, xCol[1], 1.0e-15);
         RealVector xColVec = solver.solve(b.getColumnVector(0));
         Assert.assertEquals(11, xColVec.getEntry(0), 1.0e-15);
         Assert.assertEquals(0, xColVec.getEntry(1), 1.0e-15);
@@ -104,21 +101,14 @@ public class SingularValueSolverTest {
         // using double[][]
         Assert.assertEquals(0, MatrixUtils.createRealMatrix(solver.solve(b.getData())).subtract(xRef).getNorm(),
normTolerance);
 
-        // using double[]
-        for (int i = 0; i < b.getColumnDimension(); ++i) {
-            Assert.assertEquals(0,
-                         new ArrayRealVector(solver.solve(b.getColumn(i))).subtract(xRef.getColumnVector(i)).getNorm(),
-                         1.0e-13);
-        }
-
-        // using Array2DRowRealMatrix
+        // using ArrayRealVector
         for (int i = 0; i < b.getColumnDimension(); ++i) {
             Assert.assertEquals(0,
                          solver.solve(b.getColumnVector(i)).subtract(xRef.getColumnVector(i)).getNorm(),
                          1.0e-13);
         }
 
-        // using RealMatrix with an alternate implementation
+        // using RealVector with an alternate implementation
         for (int i = 0; i < b.getColumnDimension(); ++i) {
             ArrayRealVectorTest.RealVectorTestImpl v =
                 new ArrayRealVectorTest.RealVectorTestImpl(b.getColumn(i));



Mime
View raw message