mirror of
https://github.com/apache/commons-math.git
synced 2025-02-07 18:49:40 +00:00
In all unit-tests of DecompositionSolver implementations: removed calls to DecompositionSolver.solve(double[]) (MATH-653)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1164622 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
118387e272
commit
de75806149
@ -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,
|
||||
|
@ -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));
|
||||
|
@ -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
|
||||
@ -108,12 +108,6 @@ public class LUSolverTest {
|
||||
} catch (SingularMatrixException ime) {
|
||||
// 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");
|
||||
@ -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,
|
||||
|
@ -81,12 +81,6 @@ public class QRSolverTest {
|
||||
} catch (MathIllegalArgumentException iae) {
|
||||
// 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");
|
||||
@ -107,12 +101,6 @@ public class QRSolverTest {
|
||||
} catch (SingularMatrixException iae) {
|
||||
// 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");
|
||||
@ -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));
|
||||
|
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user