commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From celes...@apache.org
Subject svn commit: r1174537 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/linear/ main/java/org/apache/commons/math/ode/nonstiff/ test/java/org/apache/commons/math/linear/
Date Fri, 23 Sep 2011 06:33:00 GMT
Author: celestin
Date: Fri Sep 23 06:32:59 2011
New Revision: 1174537

URL: http://svn.apache.org/viewvc?rev=1174537&view=rev
Log:
Merged FieldLUDecomposition and FieldLUDecompositionImpl (see MATH-662).

Added:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecomposition.java
      - copied, changed from r1173989, commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldLUDecompositionTest.java
      - copied, changed from r1173989, commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldLUDecompositionImplTest.java
Removed:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldLUDecompositionImplTest.java
Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsNordsieckTransformer.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldLUSolverTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SparseFieldMatrixTest.java

Copied: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecomposition.java
(from r1173989, commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java)
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecomposition.java?p2=commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecomposition.java&p1=commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java&r1=1173989&r2=1174537&rev=1174537&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecomposition.java
Fri Sep 23 06:32:59 2011
@@ -31,24 +31,39 @@ import org.apache.commons.math.exception
  * m&times;m.</p>
  * <p>Since {@link FieldElement field elements} do not provide an ordering
  * operator, the permutation matrix is computed here only in order to avoid
- * a zero pivot element, no attempt is done to get the largest pivot element.</p>
+ * a zero pivot element, no attempt is done to get the largest pivot
+ * element.</p>
+ * <p>This class is based on the class with similar name from the
+ * <a href="http://math.nist.gov/javanumerics/jama/">JAMA</a> library.</p>
+ * <ul>
+ *   <li>a {@link #getP() getP} method has been added,</li>
+ *   <li>the {@code det} method has been renamed as {@link #getDeterminant()
+ *   getDeterminant},</li>
+ *   <li>the {@code getDoublePivot} method has been removed (but the int based
+ *   {@link #getPivot() getPivot} method has been kept),</li>
+ *   <li>the {@code solve} and {@code isNonSingular} methods have been replaced
+ *   by a {@link #getSolver() getSolver} method and the equivalent methods
+ *   provided by the returned {@link DecompositionSolver}.</li>
+ * </ul>
  *
  * @param <T> the type of the field elements
+ * @see <a href="http://mathworld.wolfram.com/LUDecomposition.html">MathWorld</a>
+ * @see <a href="http://en.wikipedia.org/wiki/LU_decomposition">Wikipedia</a>
  * @version $Id$
- * @since 2.0
+ * @since 2.0 (changed to concrete class in 3.0)
  */
-public class FieldLUDecompositionImpl<T extends FieldElement<T>> implements FieldLUDecomposition<T>
{
+public class FieldLUDecomposition<T extends FieldElement<T>> {
 
     /** Field to which the elements belong. */
     private final Field<T> field;
 
     /** Entries of LU decomposition. */
-    private T lu[][];
+    private T[][] lu;
 
-    /** Pivot permutation associated with LU decomposition */
+    /** Pivot permutation associated with LU decomposition. */
     private int[] pivot;
 
-    /** Parity of the permutation associated with the LU decomposition */
+    /** Parity of the permutation associated with the LU decomposition. */
     private boolean even;
 
     /** Singularity indicator. */
@@ -68,7 +83,7 @@ public class FieldLUDecompositionImpl<T 
      * @param matrix The matrix to decompose.
      * @throws NonSquareMatrixException if matrix is not square
      */
-    public FieldLUDecompositionImpl(FieldMatrix<T> matrix) {
+    public FieldLUDecomposition(FieldMatrix<T> matrix) {
         if (!matrix.isSquare()) {
             throw new NonSquareMatrixException(matrix.getRowDimension(),
                                                matrix.getColumnDimension());
@@ -150,7 +165,11 @@ public class FieldLUDecompositionImpl<T 
 
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Returns the matrix L of the decomposition.
+     * <p>L is a lower-triangular matrix</p>
+     * @return the L matrix (or null if decomposed matrix is singular)
+     */
     public FieldMatrix<T> getL() {
         if ((cachedL == null) && !singular) {
             final int m = pivot.length;
@@ -166,7 +185,11 @@ public class FieldLUDecompositionImpl<T 
         return cachedL;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Returns the matrix U of the decomposition.
+     * <p>U is an upper-triangular matrix</p>
+     * @return the U matrix (or null if decomposed matrix is singular)
+     */
     public FieldMatrix<T> getU() {
         if ((cachedU == null) && !singular) {
             final int m = pivot.length;
@@ -181,7 +204,15 @@ public class FieldLUDecompositionImpl<T 
         return cachedU;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Returns the P rows permutation matrix.
+     * <p>P is a sparse matrix with exactly one element set to 1.0 in
+     * each row and each column, all other elements being set to 0.0.</p>
+     * <p>The positions of the 1 elements are given by the {@link #getPivot()
+     * pivot permutation vector}.</p>
+     * @return the P rows permutation matrix (or null if decomposed matrix is singular)
+     * @see #getPivot()
+     */
     public FieldMatrix<T> getP() {
         if ((cachedP == null) && !singular) {
             final int m = pivot.length;
@@ -193,12 +224,19 @@ public class FieldLUDecompositionImpl<T 
         return cachedP;
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Returns the pivot permutation vector.
+     * @return the pivot permutation vector
+     * @see #getP()
+     */
     public int[] getPivot() {
         return pivot.clone();
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Return the determinant of the matrix.
+     * @return determinant of the matrix
+     */
     public T getDeterminant() {
         if (singular) {
             return field.getZero();
@@ -212,7 +250,10 @@ public class FieldLUDecompositionImpl<T 
         }
     }
 
-    /** {@inheritDoc} */
+    /**
+     * Get a solver for finding the A &times; X = B solution in exact linear sense.
+     * @return a solver
+     */
     public FieldDecompositionSolver<T> getSolver() {
         return new Solver<T>(field, lu, pivot, singular);
     }
@@ -224,7 +265,7 @@ public class FieldLUDecompositionImpl<T 
         private final Field<T> field;
 
         /** Entries of LU decomposition. */
-        private final T lu[][];
+        private final T[][] lu;
 
         /** Pivot permutation associated with LU decomposition. */
         private final int[] pivot;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsNordsieckTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsNordsieckTransformer.java?rev=1174537&r1=1174536&r2=1174537&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsNordsieckTransformer.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdamsNordsieckTransformer.java
Fri Sep 23 06:32:59 2011
@@ -26,7 +26,7 @@ import org.apache.commons.math.linear.Ar
 import org.apache.commons.math.linear.Array2DRowRealMatrix;
 import org.apache.commons.math.linear.ArrayFieldVector;
 import org.apache.commons.math.linear.FieldDecompositionSolver;
-import org.apache.commons.math.linear.FieldLUDecompositionImpl;
+import org.apache.commons.math.linear.FieldLUDecomposition;
 import org.apache.commons.math.linear.FieldMatrix;
 import org.apache.commons.math.linear.MatrixUtils;
 import org.apache.commons.math.linear.QRDecomposition;
@@ -154,7 +154,7 @@ public class AdamsNordsieckTransformer {
         // compute exact coefficients
         FieldMatrix<BigFraction> bigP = buildP(nSteps);
         FieldDecompositionSolver<BigFraction> pSolver =
-            new FieldLUDecompositionImpl<BigFraction>(bigP).getSolver();
+            new FieldLUDecomposition<BigFraction>(bigP).getSolver();
 
         BigFraction[] u = new BigFraction[nSteps];
         Arrays.fill(u, BigFraction.ONE);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java?rev=1174537&r1=1174536&r2=1174537&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java
Fri Sep 23 06:32:59 2011
@@ -434,8 +434,8 @@ public final class BlockFieldMatrixTest 
     @Test
     public void testTranspose() {
         FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(testData);
-        FieldMatrix<Fraction> mIT = new FieldLUDecompositionImpl<Fraction>(m).getSolver().getInverse().transpose();
-        FieldMatrix<Fraction> mTI = new FieldLUDecompositionImpl<Fraction>(m.transpose()).getSolver().getInverse();
+        FieldMatrix<Fraction> mIT = new FieldLUDecomposition<Fraction>(m).getSolver().getInverse().transpose();
+        FieldMatrix<Fraction> mTI = new FieldLUDecomposition<Fraction>(m.transpose()).getSolver().getInverse();
         TestUtils.assertEquals(mIT, mTI);
         m = new BlockFieldMatrix<Fraction>(testData2);
         FieldMatrix<Fraction> mt = new BlockFieldMatrix<Fraction>(testData2T);
@@ -532,7 +532,7 @@ public final class BlockFieldMatrixTest 
         Assert.assertEquals(2, p.getRowDimension());
         Assert.assertEquals(2, p.getColumnDimension());
         // Invert p
-        FieldMatrix<Fraction> pInverse = new FieldLUDecompositionImpl<Fraction>(p).getSolver().getInverse();
+        FieldMatrix<Fraction> pInverse = new FieldLUDecomposition<Fraction>(p).getSolver().getInverse();
         Assert.assertEquals(2, pInverse.getRowDimension());
         Assert.assertEquals(2, pInverse.getColumnDimension());
 
@@ -547,7 +547,7 @@ public final class BlockFieldMatrixTest 
             new Fraction(1), new Fraction(-2), new Fraction(1)
         };
         Fraction[] solution;
-        solution = new FieldLUDecompositionImpl<Fraction>(coefficients)
+        solution = new FieldLUDecomposition<Fraction>(coefficients)
             .getSolver()
             .solve(new ArrayFieldVector<Fraction>(constants, false)).toArray();
         Assert.assertEquals(new Fraction(2).multiply(solution[0]).

Copied: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldLUDecompositionTest.java
(from r1173989, commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldLUDecompositionImplTest.java)
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldLUDecompositionTest.java?p2=commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldLUDecompositionTest.java&p1=commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldLUDecompositionImplTest.java&r1=1173989&r2=1174537&rev=1174537&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldLUDecompositionImplTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldLUDecompositionTest.java
Fri Sep 23 06:32:59 2011
@@ -24,7 +24,7 @@ import org.apache.commons.math.TestUtils
 import org.apache.commons.math.fraction.Fraction;
 import org.apache.commons.math.fraction.FractionField;
 
-public class FieldLUDecompositionImplTest {
+public class FieldLUDecompositionTest {
     private Fraction[][] testData = {
             { new Fraction(1), new Fraction(2), new Fraction(3)},
             { new Fraction(2), new Fraction(5), new Fraction(3)},
@@ -58,7 +58,7 @@ public class FieldLUDecompositionImplTes
     public void testDimensions() {
         FieldMatrix<Fraction> matrix =
             new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(), testData);
-        FieldLUDecomposition<Fraction> LU = new FieldLUDecompositionImpl<Fraction>(matrix);
+        FieldLUDecomposition<Fraction> LU = new FieldLUDecomposition<Fraction>(matrix);
         Assert.assertEquals(testData.length, LU.getL().getRowDimension());
         Assert.assertEquals(testData.length, LU.getL().getColumnDimension());
         Assert.assertEquals(testData.length, LU.getU().getRowDimension());
@@ -73,7 +73,7 @@ public class FieldLUDecompositionImplTes
     public void testNonSquare() {
         try {
             // we don't use FractionField.getInstance() for testing purposes
-            new FieldLUDecompositionImpl<Fraction>(new Array2DRowFieldMatrix<Fraction>(new
Fraction[][] {
+            new FieldLUDecomposition<Fraction>(new Array2DRowFieldMatrix<Fraction>(new
Fraction[][] {
                     { Fraction.ZERO, Fraction.ZERO },
                     { Fraction.ZERO, Fraction.ZERO },
                     { Fraction.ZERO, Fraction.ZERO }
@@ -88,14 +88,14 @@ public class FieldLUDecompositionImplTes
     @Test
     public void testPAEqualLU() {
         FieldMatrix<Fraction> matrix = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
testData);
-        FieldLUDecomposition<Fraction> lu = new FieldLUDecompositionImpl<Fraction>(matrix);
+        FieldLUDecomposition<Fraction> lu = new FieldLUDecomposition<Fraction>(matrix);
         FieldMatrix<Fraction> l = lu.getL();
         FieldMatrix<Fraction> u = lu.getU();
         FieldMatrix<Fraction> p = lu.getP();
         TestUtils.assertEquals(p.multiply(matrix), l.multiply(u));
 
         matrix = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(), testDataMinus);
-        lu = new FieldLUDecompositionImpl<Fraction>(matrix);
+        lu = new FieldLUDecomposition<Fraction>(matrix);
         l = lu.getL();
         u = lu.getU();
         p = lu.getP();
@@ -105,21 +105,21 @@ public class FieldLUDecompositionImplTes
         for (int i = 0; i < matrix.getRowDimension(); ++i) {
             matrix.setEntry(i, i, Fraction.ONE);
         }
-        lu = new FieldLUDecompositionImpl<Fraction>(matrix);
+        lu = new FieldLUDecomposition<Fraction>(matrix);
         l = lu.getL();
         u = lu.getU();
         p = lu.getP();
         TestUtils.assertEquals(p.multiply(matrix), l.multiply(u));
 
         matrix = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(), singular);
-        lu = new FieldLUDecompositionImpl<Fraction>(matrix);
+        lu = new FieldLUDecomposition<Fraction>(matrix);
         Assert.assertFalse(lu.getSolver().isNonSingular());
         Assert.assertNull(lu.getL());
         Assert.assertNull(lu.getU());
         Assert.assertNull(lu.getP());
 
         matrix = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(), bigSingular);
-        lu = new FieldLUDecompositionImpl<Fraction>(matrix);
+        lu = new FieldLUDecomposition<Fraction>(matrix);
         Assert.assertFalse(lu.getSolver().isNonSingular());
         Assert.assertNull(lu.getL());
         Assert.assertNull(lu.getU());
@@ -131,7 +131,7 @@ public class FieldLUDecompositionImplTes
     @Test
     public void testLLowerTriangular() {
         FieldMatrix<Fraction> matrix = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
testData);
-        FieldMatrix<Fraction> l = new FieldLUDecompositionImpl<Fraction>(matrix).getL();
+        FieldMatrix<Fraction> l = new FieldLUDecomposition<Fraction>(matrix).getL();
         for (int i = 0; i < l.getRowDimension(); i++) {
             Assert.assertEquals(Fraction.ONE, l.getEntry(i, i));
             for (int j = i + 1; j < l.getColumnDimension(); j++) {
@@ -144,7 +144,7 @@ public class FieldLUDecompositionImplTes
     @Test
     public void testUUpperTriangular() {
         FieldMatrix<Fraction> matrix = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
testData);
-        FieldMatrix<Fraction> u = new FieldLUDecompositionImpl<Fraction>(matrix).getU();
+        FieldMatrix<Fraction> u = new FieldLUDecomposition<Fraction>(matrix).getU();
         for (int i = 0; i < u.getRowDimension(); i++) {
             for (int j = 0; j < i; j++) {
                 Assert.assertEquals(Fraction.ZERO, u.getEntry(i, j));
@@ -156,7 +156,7 @@ public class FieldLUDecompositionImplTes
     @Test
     public void testPPermutation() {
         FieldMatrix<Fraction> matrix = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
testData);
-        FieldMatrix<Fraction> p   = new FieldLUDecompositionImpl<Fraction>(matrix).getP();
+        FieldMatrix<Fraction> p   = new FieldLUDecomposition<Fraction>(matrix).getP();
 
         FieldMatrix<Fraction> ppT = p.multiply(p.transpose());
         FieldMatrix<Fraction> id  =
@@ -212,11 +212,11 @@ public class FieldLUDecompositionImplTes
     @Test
     public void testSingular() {
         FieldLUDecomposition<Fraction> lu =
-            new FieldLUDecompositionImpl<Fraction>(new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
testData));
+            new FieldLUDecomposition<Fraction>(new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
testData));
         Assert.assertTrue(lu.getSolver().isNonSingular());
-        lu = new FieldLUDecompositionImpl<Fraction>(new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
singular));
+        lu = new FieldLUDecomposition<Fraction>(new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
singular));
         Assert.assertFalse(lu.getSolver().isNonSingular());
-        lu = new FieldLUDecompositionImpl<Fraction>(new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
bigSingular));
+        lu = new FieldLUDecomposition<Fraction>(new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
bigSingular));
         Assert.assertFalse(lu.getSolver().isNonSingular());
     }
 
@@ -224,7 +224,7 @@ public class FieldLUDecompositionImplTes
     @Test
     public void testMatricesValues1() {
        FieldLUDecomposition<Fraction> lu =
-            new FieldLUDecompositionImpl<Fraction>(new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
testData));
+            new FieldLUDecomposition<Fraction>(new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
testData));
         FieldMatrix<Fraction> lRef = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
new Fraction[][] {
                 { new Fraction(1), new Fraction(0), new Fraction(0) },
                 { new Fraction(2), new Fraction(1), new Fraction(0) },
@@ -265,7 +265,7 @@ public class FieldLUDecompositionImplTes
     @Test
     public void testMatricesValues2() {
        FieldLUDecomposition<Fraction> lu =
-            new FieldLUDecompositionImpl<Fraction>(new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
luData));
+            new FieldLUDecomposition<Fraction>(new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
luData));
         FieldMatrix<Fraction> lRef = new Array2DRowFieldMatrix<Fraction>(FractionField.getInstance(),
new Fraction[][] {
                 { new Fraction(1), new Fraction(0), new Fraction(0) },
                 { new Fraction(3), new Fraction(1), new Fraction(0) },

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldLUSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldLUSolverTest.java?rev=1174537&r1=1174536&r2=1174537&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldLUSolverTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldLUSolverTest.java
Fri Sep 23 06:32:59 2011
@@ -65,13 +65,13 @@ public class FieldLUSolverTest {
     @Test
     public void testSingular() {
         FieldDecompositionSolver<Fraction> solver;
-        solver = new FieldLUDecompositionImpl<Fraction>(createFractionMatrix(testData))
+        solver = new FieldLUDecomposition<Fraction>(createFractionMatrix(testData))
             .getSolver();
         Assert.assertTrue(solver.isNonSingular());
-        solver = new FieldLUDecompositionImpl<Fraction>(createFractionMatrix(singular))
+        solver = new FieldLUDecomposition<Fraction>(createFractionMatrix(singular))
             .getSolver();
         Assert.assertFalse(solver.isNonSingular());
-        solver = new FieldLUDecompositionImpl<Fraction>(createFractionMatrix(bigSingular))
+        solver = new FieldLUDecomposition<Fraction>(createFractionMatrix(bigSingular))
             .getSolver();
         Assert.assertFalse(solver.isNonSingular());
     }
@@ -80,7 +80,7 @@ public class FieldLUSolverTest {
     @Test
     public void testSolveDimensionErrors() {
         FieldDecompositionSolver<Fraction> solver;
-        solver = new FieldLUDecompositionImpl<Fraction>(createFractionMatrix(testData))
+        solver = new FieldLUDecomposition<Fraction>(createFractionMatrix(testData))
             .getSolver();
         FieldMatrix<Fraction> b = createFractionMatrix(new int[2][2]);
         try {
@@ -101,7 +101,7 @@ public class FieldLUSolverTest {
     @Test
     public void testSolveSingularityErrors() {
         FieldDecompositionSolver solver;
-        solver = new FieldLUDecompositionImpl(createFractionMatrix(singular))
+        solver = new FieldLUDecomposition(createFractionMatrix(singular))
             .getSolver();
         FieldMatrix b = createFractionMatrix(new int[2][2]);
         try {
@@ -122,7 +122,7 @@ public class FieldLUSolverTest {
     @Test
     public void testSolve() {
         FieldDecompositionSolver solver;
-        solver = new FieldLUDecompositionImpl<Fraction>(createFractionMatrix(testData))
+        solver = new FieldLUDecomposition<Fraction>(createFractionMatrix(testData))
             .getSolver();
         FieldMatrix<Fraction> b = createFractionMatrix(new int[][] {
                 { 1, 0 }, { 2, -5 }, { 3, 1 }
@@ -172,6 +172,6 @@ public class FieldLUSolverTest {
     }
 
     private double getDeterminant(final FieldMatrix<Fraction> m) {
-        return new FieldLUDecompositionImpl<Fraction>(m).getDeterminant().doubleValue();
+        return new FieldLUDecomposition<Fraction>(m).getDeterminant().doubleValue();
     }
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java?rev=1174537&r1=1174536&r2=1174537&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java
Fri Sep 23 06:32:59 2011
@@ -297,8 +297,8 @@ public final class FieldMatrixImplTest {
     @Test
     public void testTranspose() {
         FieldMatrix<Fraction> m = new Array2DRowFieldMatrix<Fraction>(testData);
-        FieldMatrix<Fraction> mIT = new FieldLUDecompositionImpl<Fraction>(m).getSolver().getInverse().transpose();
-        FieldMatrix<Fraction> mTI = new FieldLUDecompositionImpl<Fraction>(m.transpose()).getSolver().getInverse();
+        FieldMatrix<Fraction> mIT = new FieldLUDecomposition<Fraction>(m).getSolver().getInverse().transpose();
+        FieldMatrix<Fraction> mTI = new FieldLUDecomposition<Fraction>(m.transpose()).getSolver().getInverse();
         TestUtils.assertEquals(mIT, mTI);
         m = new Array2DRowFieldMatrix<Fraction>(testData2);
         FieldMatrix<Fraction> mt = new Array2DRowFieldMatrix<Fraction>(testData2T);
@@ -395,7 +395,7 @@ public final class FieldMatrixImplTest {
         Assert.assertEquals(2, p.getRowDimension());
         Assert.assertEquals(2, p.getColumnDimension());
         // Invert p
-        FieldMatrix<Fraction> pInverse = new FieldLUDecompositionImpl<Fraction>(p).getSolver().getInverse();
+        FieldMatrix<Fraction> pInverse = new FieldLUDecomposition<Fraction>(p).getSolver().getInverse();
         Assert.assertEquals(2, pInverse.getRowDimension());
         Assert.assertEquals(2, pInverse.getColumnDimension());
 
@@ -410,7 +410,7 @@ public final class FieldMatrixImplTest {
             new Fraction(1), new Fraction(-2), new Fraction(1)
         };
         Fraction[] solution;
-        solution = new FieldLUDecompositionImpl<Fraction>(coefficients)
+        solution = new FieldLUDecomposition<Fraction>(coefficients)
             .getSolver()
             .solve(new ArrayFieldVector<Fraction>(constants, false)).toArray();
         Assert.assertEquals(new Fraction(2).multiply(solution[0]).

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SparseFieldMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SparseFieldMatrixTest.java?rev=1174537&r1=1174536&r2=1174537&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SparseFieldMatrixTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SparseFieldMatrixTest.java
Fri Sep 23 06:32:59 2011
@@ -291,8 +291,8 @@ public class SparseFieldMatrixTest {
     @Test
     public void testTranspose() {
         FieldMatrix<Fraction> m = createSparseMatrix(testData);
-        FieldMatrix<Fraction> mIT = new FieldLUDecompositionImpl<Fraction>(m).getSolver().getInverse().transpose();
-        FieldMatrix<Fraction> mTI = new FieldLUDecompositionImpl<Fraction>(m.transpose()).getSolver().getInverse();
+        FieldMatrix<Fraction> mIT = new FieldLUDecomposition<Fraction>(m).getSolver().getInverse().transpose();
+        FieldMatrix<Fraction> mTI = new FieldLUDecomposition<Fraction>(m.transpose()).getSolver().getInverse();
         assertClose("inverse-transpose", mIT, mTI, normTolerance);
         m = createSparseMatrix(testData2);
         FieldMatrix<Fraction> mt = createSparseMatrix(testData2T);
@@ -387,7 +387,7 @@ public class SparseFieldMatrixTest {
         Assert.assertEquals(2, p.getRowDimension());
         Assert.assertEquals(2, p.getColumnDimension());
         // Invert p
-        FieldMatrix<Fraction> pInverse = new FieldLUDecompositionImpl<Fraction>(p).getSolver().getInverse();
+        FieldMatrix<Fraction> pInverse = new FieldLUDecomposition<Fraction>(p).getSolver().getInverse();
         Assert.assertEquals(2, pInverse.getRowDimension());
         Assert.assertEquals(2, pInverse.getColumnDimension());
 
@@ -397,7 +397,7 @@ public class SparseFieldMatrixTest {
         FieldMatrix<Fraction> coefficients = createSparseMatrix(coefficientsData);
         Fraction[] constants = { new Fraction(1), new Fraction(-2), new Fraction(1) };
         Fraction[] solution;
-        solution = new FieldLUDecompositionImpl<Fraction>(coefficients)
+        solution = new FieldLUDecomposition<Fraction>(coefficients)
             .getSolver()
             .solve(new ArrayFieldVector<Fraction>(constants, false)).toArray();
         Assert.assertEquals((new Fraction(2).multiply((solution[0])).add(new Fraction(3).multiply(solution[1])).subtract(new
Fraction(2).multiply(solution[2]))).doubleValue(),



Mime
View raw message