commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r783678 [1/2] - in /commons/proper/math/trunk: ./ src/java/org/apache/commons/math/ src/java/org/apache/commons/math/linear/ src/java/org/apache/commons/math/optimization/general/ src/java/org/apache/commons/math/stat/correlation/ src/site/...
Date Thu, 11 Jun 2009 08:05:25 GMT
Author: luc
Date: Thu Jun 11 08:05:24 2009
New Revision: 783678

URL: http://svn.apache.org/viewvc?rev=783678&view=rev
Log:
renamed Dense{Real/Field}Matrix into Block{Real/Field}Matrix
as suggested by Phil in http://markmail.org/message/iibgiz4bsv6hjjvh

Added:
    commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockFieldMatrix.java
      - copied, changed from r783662, commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseFieldMatrix.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockRealMatrix.java
      - copied, changed from r783662, commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java
Removed:
    commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseFieldMatrix.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java
Modified:
    commons/proper/math/trunk/findbugs-exclude-filter.xml
    commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/linear/OpenMapRealMatrix.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/linear/QRDecompositionImpl.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/Covariance.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/PearsonsCorrelation.java
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/SpearmansCorrelation.java
    commons/proper/math/trunk/src/site/xdoc/changes.xml
    commons/proper/math/trunk/src/site/xdoc/userguide/linear.xml
    commons/proper/math/trunk/src/test/org/apache/commons/math/linear/DenseFieldMatrixTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/linear/DenseRealMatrixTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/linear/MatrixUtilsTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/linear/QRDecompositionImplTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/linear/QRSolverTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/linear/SparseRealMatrixTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/GaussNewtonOptimizerTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/stat/correlation/PearsonsCorrelationTest.java
    commons/proper/math/trunk/src/test/org/apache/commons/math/stat/correlation/SpearmansRankCorrelationTest.java

Modified: commons/proper/math/trunk/findbugs-exclude-filter.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/findbugs-exclude-filter.xml?rev=783678&r1=783677&r2=783678&view=diff
==============================================================================
--- commons/proper/math/trunk/findbugs-exclude-filter.xml (original)
+++ commons/proper/math/trunk/findbugs-exclude-filter.xml Thu Jun 11 08:05:24 2009
@@ -110,7 +110,7 @@
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math.linear.DenseFieldMatrix"/>
+    <Class name="org.apache.commons.math.linear.BlockFieldMatrix"/>
     <Method name="&lt;init>" params="int,int,org.apache.commons.math.FieldElement[][],boolean" returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
   </Match>
@@ -125,7 +125,7 @@
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math.linear.DenseRealMatrix"/>
+    <Class name="org.apache.commons.math.linear.BlockRealMatrix"/>
     <Method name="&lt;init>" params="int,int,double[][],boolean" returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
   </Match>

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java?rev=783678&r1=783677&r2=783678&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/MessagesResources_fr.java Thu Jun 11 08:05:24 2009
@@ -421,7 +421,7 @@
     { "{0}x{1} and {2}x{3} matrices are not multiplication compatible",
       "les dimensions {0}x{1} et {2}x{3} sont incompatibles pour la multiplication matricielle" },
 
-    // org.apache.commons.math.linear.DenseRealMatrix
+    // org.apache.commons.math.linear.BlockRealMatrix
     { "wrong array shape (block length = {0}, expected {1})",
       "forme de tableau erron\u00e9e (bloc de longueur {0} au lieu des {1} attendus)" },
 

Copied: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockFieldMatrix.java (from r783662, commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseFieldMatrix.java)
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockFieldMatrix.java?p2=commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockFieldMatrix.java&p1=commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseFieldMatrix.java&r1=783662&r2=783678&rev=783678&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseFieldMatrix.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockFieldMatrix.java Thu Jun 11 08:05:24 2009
@@ -63,7 +63,7 @@
  * @version $Revision$ $Date$
  * @since 2.0
  */
-public class DenseFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMatrix<T> implements Serializable {
+public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMatrix<T> implements Serializable {
     
     /** Serializable version identifier */
     private static final long serialVersionUID = -4602336630143123183L;
@@ -95,7 +95,7 @@
      * @throws IllegalArgumentException if row or column dimension is not
      *  positive
      */
-    public DenseFieldMatrix(final Field<T> field, final int rows, final int columns)
+    public BlockFieldMatrix(final Field<T> field, final int rows, final int columns)
         throws IllegalArgumentException {
 
         super(field, rows, columns);
@@ -115,16 +115,16 @@
      * Create a new dense matrix copying entries from raw layout data.
      * <p>The input array <em>must</em> already be in raw layout.</p>
      * <p>Calling this constructor is equivalent to call:
-     * <pre>matrix = new DenseFieldMatrix<T>(getField(), rawData.length, rawData[0].length,
+     * <pre>matrix = new BlockFieldMatrix<T>(getField(), rawData.length, rawData[0].length,
      *                                   toBlocksLayout(rawData), false);</pre>
      * </p>
      * @param rawData data for new matrix, in raw layout
      *
      * @exception IllegalArgumentException if <code>blockData</code> shape is
      * inconsistent with block layout
-     * @see #DenseFieldMatrix(int, int, FieldElement[][], boolean)
+     * @see #BlockFieldMatrix(int, int, FieldElement[][], boolean)
      */
-    public DenseFieldMatrix(final T[][] rawData)
+    public BlockFieldMatrix(final T[][] rawData)
         throws IllegalArgumentException {
         this(rawData.length, rawData[0].length, toBlocksLayout(rawData), false);
     }
@@ -142,9 +142,9 @@
      * inconsistent with block layout
      * @see #createBlocksLayout(Field, int, int)
      * @see #toBlocksLayout(FieldElement[][])
-     * @see #DenseFieldMatrix(FieldElement[][])
+     * @see #BlockFieldMatrix(FieldElement[][])
      */
-    public DenseFieldMatrix(final int rows, final int columns,
+    public BlockFieldMatrix(final int rows, final int columns,
                             final T[][] blockData, final boolean copyArray)
         throws IllegalArgumentException {
 
@@ -186,7 +186,7 @@
      * <p>
      * Raw layout is the straightforward layout where element at row i and
      * column j is in array element <code>rawData[i][j]</code>. Blocks layout
-     * is the layout used in {@link DenseFieldMatrix} instances, where the matrix
+     * is the layout used in {@link BlockFieldMatrix} instances, where the matrix
      * is split in square blocks (except at right and bottom side where blocks may
      * be rectangular to fit matrix size) and each block is stored in a flattened
      * one-dimensional array.
@@ -194,7 +194,7 @@
      * <p>
      * This method creates an array in blocks layout from an input array in raw layout.
      * It can be used to provide the array argument of the {@link
-     * DenseFieldMatrix#DenseFieldMatrix(int, int, FieldElement[][], boolean)}
+     * BlockFieldMatrix#DenseFieldMatrix(int, int, FieldElement[][], boolean)}
      * constructor.
      * </p>
      * @param <T> the type of the field elements
@@ -203,7 +203,7 @@
      * @exception IllegalArgumentException if <code>rawData</code> is not rectangular
      *  (not all rows have the same length)
      * @see #createBlocksLayout(Field, int, int)
-     * @see #DenseFieldMatrix(int, int, FieldElement[][], boolean)
+     * @see #BlockFieldMatrix(int, int, FieldElement[][], boolean)
      */
     public static <T extends FieldElement<T>> T[][] toBlocksLayout(final T[][] rawData)
         throws IllegalArgumentException {
@@ -255,7 +255,7 @@
      * Create a data array in blocks layout.
      * <p>
      * This method can be used to create the array argument of the {@link
-     * DenseFieldMatrix#DenseFieldMatrix(int, int, FieldElement[][], boolean)}
+     * BlockFieldMatrix#DenseFieldMatrix(int, int, FieldElement[][], boolean)}
      * constructor.
      * </p>
      * @param <T> the type of the field elements
@@ -264,7 +264,7 @@
      * @param columns  the number of columns in the new matrix
      * @return a new data array in blocks layout
      * @see #toBlocksLayout(FieldElement[][])
-     * @see #DenseFieldMatrix(int, int, FieldElement[][], boolean)
+     * @see #BlockFieldMatrix(int, int, FieldElement[][], boolean)
      */
     public static <T extends FieldElement<T>> T[][] createBlocksLayout(final Field<T> field,
                                                                        final int rows, final int columns) {
@@ -293,7 +293,7 @@
     @Override
     public FieldMatrix<T> createMatrix(final int rowDimension, final int columnDimension)
         throws IllegalArgumentException {
-        return new DenseFieldMatrix<T>(getField(), rowDimension, columnDimension);
+        return new BlockFieldMatrix<T>(getField(), rowDimension, columnDimension);
     }
 
     /** {@inheritDoc} */
@@ -301,7 +301,7 @@
     public FieldMatrix<T> copy() {
 
         // create an empty matrix
-        DenseFieldMatrix<T> copied = new DenseFieldMatrix<T>(getField(), rows, columns);
+        BlockFieldMatrix<T> copied = new BlockFieldMatrix<T>(getField(), rows, columns);
 
         // copy the blocks
         for (int i = 0; i < blocks.length; ++i) {
@@ -317,13 +317,13 @@
     public FieldMatrix<T> add(final FieldMatrix<T> m)
         throws IllegalArgumentException {
         try {
-            return add((DenseFieldMatrix<T>) m);
+            return add((BlockFieldMatrix<T>) m);
         } catch (ClassCastException cce) {
 
             // safety check
             checkAdditionCompatible(m);
 
-            final DenseFieldMatrix<T> out = new DenseFieldMatrix<T>(getField(), rows, columns);
+            final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
 
             // perform addition block-wise, to ensure good cache behavior
             int blockIndex = 0;
@@ -361,13 +361,13 @@
      * @return     this + m
      * @throws  IllegalArgumentException if m is not the same size as this
      */
-    public DenseFieldMatrix<T> add(final DenseFieldMatrix<T> m)
+    public BlockFieldMatrix<T> add(final BlockFieldMatrix<T> m)
         throws IllegalArgumentException {
 
         // safety check
         checkAdditionCompatible(m);
 
-        final DenseFieldMatrix<T> out = new DenseFieldMatrix<T>(getField(), rows, columns);
+        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
 
         // perform addition block-wise, to ensure good cache behavior
         for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
@@ -388,13 +388,13 @@
     public FieldMatrix<T> subtract(final FieldMatrix<T> m)
         throws IllegalArgumentException {
         try {
-            return subtract((DenseFieldMatrix<T>) m);
+            return subtract((BlockFieldMatrix<T>) m);
         } catch (ClassCastException cce) {
 
             // safety check
             checkSubtractionCompatible(m);
 
-            final DenseFieldMatrix<T> out = new DenseFieldMatrix<T>(getField(), rows, columns);
+            final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
 
             // perform subtraction block-wise, to ensure good cache behavior
             int blockIndex = 0;
@@ -432,13 +432,13 @@
      * @return     this - m
      * @throws  IllegalArgumentException if m is not the same size as this
      */
-    public DenseFieldMatrix<T> subtract(final DenseFieldMatrix<T> m)
+    public BlockFieldMatrix<T> subtract(final BlockFieldMatrix<T> m)
         throws IllegalArgumentException {
 
         // safety check
         checkSubtractionCompatible(m);
 
-        final DenseFieldMatrix<T> out = new DenseFieldMatrix<T>(getField(), rows, columns);
+        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
 
         // perform subtraction block-wise, to ensure good cache behavior
         for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
@@ -459,7 +459,7 @@
     public FieldMatrix<T> scalarAdd(final T d)
         throws IllegalArgumentException {
 
-        final DenseFieldMatrix<T> out = new DenseFieldMatrix<T>(getField(), rows, columns);
+        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
 
         // perform subtraction block-wise, to ensure good cache behavior
         for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
@@ -479,7 +479,7 @@
     public FieldMatrix<T> scalarMultiply(final T d)
         throws IllegalArgumentException {
 
-        final DenseFieldMatrix<T> out = new DenseFieldMatrix<T>(getField(), rows, columns);
+        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
 
         // perform subtraction block-wise, to ensure good cache behavior
         for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
@@ -499,13 +499,13 @@
     public FieldMatrix<T> multiply(final FieldMatrix<T> m)
         throws IllegalArgumentException {
         try {
-            return multiply((DenseFieldMatrix<T>) m);
+            return multiply((BlockFieldMatrix<T>) m);
         } catch (ClassCastException cce) {
 
             // safety check
             checkMultiplicationCompatible(m);
 
-            final DenseFieldMatrix<T> out = new DenseFieldMatrix<T>(getField(), rows, m.getColumnDimension());
+            final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, m.getColumnDimension());
             final T zero = getField().getZero();
 
             // perform multiplication block-wise, to ensure good cache behavior
@@ -561,12 +561,12 @@
      * @throws     IllegalArgumentException
      *             if columnDimension(this) != rowDimension(m)
      */
-    public DenseFieldMatrix<T> multiply(DenseFieldMatrix<T> m) throws IllegalArgumentException {
+    public BlockFieldMatrix<T> multiply(BlockFieldMatrix<T> m) throws IllegalArgumentException {
 
         // safety check
         checkMultiplicationCompatible(m);
 
-        final DenseFieldMatrix<T> out = new DenseFieldMatrix<T>(getField(), rows, m.columns);
+        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, m.columns);
         final T zero = getField().getZero();
 
         // perform multiplication block-wise, to ensure good cache behavior
@@ -666,8 +666,8 @@
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
 
         // create the output matrix
-        final DenseFieldMatrix<T> out =
-            new DenseFieldMatrix<T>(getField(), endRow - startRow + 1, endColumn - startColumn + 1);
+        final BlockFieldMatrix<T> out =
+            new BlockFieldMatrix<T>(getField(), endRow - startRow + 1, endColumn - startColumn + 1);
 
         // compute blocks shifts
         final int blockStartRow    = startRow    / BLOCK_SIZE;
@@ -839,7 +839,7 @@
         throws MatrixIndexException {
 
         checkRowIndex(row);
-        final DenseFieldMatrix<T> out = new DenseFieldMatrix<T>(getField(), 1, columns);
+        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), 1, columns);
 
         // perform copy block-wise, to ensure good cache behavior
         final int iBlock  = row / BLOCK_SIZE;
@@ -871,7 +871,7 @@
     public void setRowMatrix(final int row, final FieldMatrix<T> matrix)
         throws MatrixIndexException, InvalidMatrixException {
         try {
-            setRowMatrix(row, (DenseFieldMatrix<T>) matrix);
+            setRowMatrix(row, (BlockFieldMatrix<T>) matrix);
         } catch (ClassCastException cce) {
             super.setRowMatrix(row, matrix);
         }
@@ -888,7 +888,7 @@
      * @throws InvalidMatrixException if the matrix dimensions do not match one
      * instance row
      */
-    public void setRowMatrix(final int row, final DenseFieldMatrix<T> matrix)
+    public void setRowMatrix(final int row, final BlockFieldMatrix<T> matrix)
         throws MatrixIndexException, InvalidMatrixException {
 
         checkRowIndex(row);
@@ -930,7 +930,7 @@
         throws MatrixIndexException {
 
         checkColumnIndex(column);
-        final DenseFieldMatrix<T> out = new DenseFieldMatrix<T>(getField(), rows, 1);
+        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, 1);
 
         // perform copy block-wise, to ensure good cache behavior
         final int jBlock  = column / BLOCK_SIZE;
@@ -960,7 +960,7 @@
     public void setColumnMatrix(final int column, final FieldMatrix<T> matrix)
         throws MatrixIndexException, InvalidMatrixException {
         try {
-            setColumnMatrix(column, (DenseFieldMatrix<T>) matrix);
+            setColumnMatrix(column, (BlockFieldMatrix<T>) matrix);
         } catch (ClassCastException cce) {
             super.setColumnMatrix(column, matrix);
         }
@@ -977,7 +977,7 @@
      * @throws InvalidMatrixException if the matrix dimensions do not match one
      * instance column
      */
-    void setColumnMatrix(final int column, final DenseFieldMatrix<T> matrix)
+    void setColumnMatrix(final int column, final BlockFieldMatrix<T> matrix)
         throws MatrixIndexException, InvalidMatrixException {
 
         checkColumnIndex(column);
@@ -1259,7 +1259,7 @@
 
         final int nRows = getRowDimension();
         final int nCols = getColumnDimension();
-        final DenseFieldMatrix<T> out = new DenseFieldMatrix<T>(getField(), nCols, nRows);
+        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), nCols, nRows);
 
         // perform transpose block-wise, to ensure good cache behavior
         int blockIndex = 0;

Copied: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockRealMatrix.java (from r783662, commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java)
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockRealMatrix.java?p2=commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockRealMatrix.java&p1=commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java&r1=783662&r2=783678&rev=783678&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DenseRealMatrix.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/BlockRealMatrix.java Thu Jun 11 08:05:24 2009
@@ -61,7 +61,7 @@
  * @version $Revision$ $Date$
  * @since 2.0
  */
-public class DenseRealMatrix extends AbstractRealMatrix implements Serializable {
+public class BlockRealMatrix extends AbstractRealMatrix implements Serializable {
     
     /** Serializable version identifier */
     private static final long serialVersionUID = 4991895511313664478L;
@@ -92,7 +92,7 @@
      * @throws IllegalArgumentException if row or column dimension is not
      *  positive
      */
-    public DenseRealMatrix(final int rows, final int columns)
+    public BlockRealMatrix(final int rows, final int columns)
         throws IllegalArgumentException {
 
         super(rows, columns);
@@ -112,16 +112,16 @@
      * Create a new dense matrix copying entries from raw layout data.
      * <p>The input array <em>must</em> already be in raw layout.</p>
      * <p>Calling this constructor is equivalent to call:
-     * <pre>matrix = new DenseRealMatrix(rawData.length, rawData[0].length,
+     * <pre>matrix = new BlockRealMatrix(rawData.length, rawData[0].length,
      *                                   toBlocksLayout(rawData), false);</pre>
      * </p>
      * @param rawData data for new matrix, in raw layout
      *
      * @exception IllegalArgumentException if <code>blockData</code> shape is
      * inconsistent with block layout
-     * @see #DenseRealMatrix(int, int, double[][], boolean)
+     * @see #BlockRealMatrix(int, int, double[][], boolean)
      */
-    public DenseRealMatrix(final double[][] rawData)
+    public BlockRealMatrix(final double[][] rawData)
         throws IllegalArgumentException {
         this(rawData.length, rawData[0].length, toBlocksLayout(rawData), false);
     }
@@ -139,9 +139,9 @@
      * inconsistent with block layout
      * @see #createBlocksLayout(int, int)
      * @see #toBlocksLayout(double[][])
-     * @see #DenseRealMatrix(double[][])
+     * @see #BlockRealMatrix(double[][])
      */
-    public DenseRealMatrix(final int rows, final int columns,
+    public BlockRealMatrix(final int rows, final int columns,
                            final double[][] blockData, final boolean copyArray)
         throws IllegalArgumentException {
 
@@ -183,7 +183,7 @@
      * <p>
      * Raw layout is the straightforward layout where element at row i and
      * column j is in array element <code>rawData[i][j]</code>. Blocks layout
-     * is the layout used in {@link DenseRealMatrix} instances, where the matrix
+     * is the layout used in {@link BlockRealMatrix} instances, where the matrix
      * is split in square blocks (except at right and bottom side where blocks may
      * be rectangular to fit matrix size) and each block is stored in a flattened
      * one-dimensional array.
@@ -191,14 +191,14 @@
      * <p>
      * This method creates an array in blocks layout from an input array in raw layout.
      * It can be used to provide the array argument of the {@link
-     * DenseRealMatrix#DenseRealMatrix(int, int, double[][], boolean)} constructor.
+     * BlockRealMatrix#DenseRealMatrix(int, int, double[][], boolean)} constructor.
      * </p>
      * @param rawData data array in raw layout
      * @return a new data array containing the same entries but in blocks layout
      * @exception IllegalArgumentException if <code>rawData</code> is not rectangular
      *  (not all rows have the same length)
      * @see #createBlocksLayout(int, int)
-     * @see #DenseRealMatrix(int, int, double[][], boolean)
+     * @see #BlockRealMatrix(int, int, double[][], boolean)
      */
     public static double[][] toBlocksLayout(final double[][] rawData)
         throws IllegalArgumentException {
@@ -249,13 +249,13 @@
      * Create a data array in blocks layout.
      * <p>
      * This method can be used to create the array argument of the {@link
-     * DenseRealMatrix#DenseRealMatrix(int, int, double[][], boolean)} constructor.
+     * BlockRealMatrix#DenseRealMatrix(int, int, double[][], boolean)} constructor.
      * </p>
      * @param rows  the number of rows in the new matrix
      * @param columns  the number of columns in the new matrix
      * @return a new data array in blocks layout
      * @see #toBlocksLayout(double[][])
-     * @see #DenseRealMatrix(int, int, double[][], boolean)
+     * @see #BlockRealMatrix(int, int, double[][], boolean)
      */
     public static double[][] createBlocksLayout(final int rows, final int columns) {
 
@@ -281,17 +281,17 @@
 
     /** {@inheritDoc} */
     @Override
-    public DenseRealMatrix createMatrix(final int rowDimension, final int columnDimension)
+    public BlockRealMatrix createMatrix(final int rowDimension, final int columnDimension)
         throws IllegalArgumentException {
-        return new DenseRealMatrix(rowDimension, columnDimension);
+        return new BlockRealMatrix(rowDimension, columnDimension);
     }
 
     /** {@inheritDoc} */
     @Override
-    public DenseRealMatrix copy() {
+    public BlockRealMatrix copy() {
 
         // create an empty matrix
-        DenseRealMatrix copied = new DenseRealMatrix(rows, columns);
+        BlockRealMatrix copied = new BlockRealMatrix(rows, columns);
 
         // copy the blocks
         for (int i = 0; i < blocks.length; ++i) {
@@ -304,16 +304,16 @@
 
     /** {@inheritDoc} */
     @Override
-    public DenseRealMatrix add(final RealMatrix m)
+    public BlockRealMatrix add(final RealMatrix m)
         throws IllegalArgumentException {
         try {
-            return add((DenseRealMatrix) m);
+            return add((BlockRealMatrix) m);
         } catch (ClassCastException cce) {
 
             // safety check
             MatrixUtils.checkAdditionCompatible(this, m);
 
-            final DenseRealMatrix out = new DenseRealMatrix(rows, columns);
+            final BlockRealMatrix out = new BlockRealMatrix(rows, columns);
 
             // perform addition block-wise, to ensure good cache behavior
             int blockIndex = 0;
@@ -351,13 +351,13 @@
      * @return     this + m
      * @throws  IllegalArgumentException if m is not the same size as this
      */
-    public DenseRealMatrix add(final DenseRealMatrix m)
+    public BlockRealMatrix add(final BlockRealMatrix m)
         throws IllegalArgumentException {
 
         // safety check
         MatrixUtils.checkAdditionCompatible(this, m);
 
-        final DenseRealMatrix out = new DenseRealMatrix(rows, columns);
+        final BlockRealMatrix out = new BlockRealMatrix(rows, columns);
 
         // perform addition block-wise, to ensure good cache behavior
         for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
@@ -375,16 +375,16 @@
 
     /** {@inheritDoc} */
     @Override
-    public DenseRealMatrix subtract(final RealMatrix m)
+    public BlockRealMatrix subtract(final RealMatrix m)
         throws IllegalArgumentException {
         try {
-            return subtract((DenseRealMatrix) m);
+            return subtract((BlockRealMatrix) m);
         } catch (ClassCastException cce) {
 
             // safety check
             MatrixUtils.checkSubtractionCompatible(this, m);
 
-            final DenseRealMatrix out = new DenseRealMatrix(rows, columns);
+            final BlockRealMatrix out = new BlockRealMatrix(rows, columns);
 
             // perform subtraction block-wise, to ensure good cache behavior
             int blockIndex = 0;
@@ -422,13 +422,13 @@
      * @return     this - m
      * @throws  IllegalArgumentException if m is not the same size as this
      */
-    public DenseRealMatrix subtract(final DenseRealMatrix m)
+    public BlockRealMatrix subtract(final BlockRealMatrix m)
         throws IllegalArgumentException {
 
         // safety check
         MatrixUtils.checkSubtractionCompatible(this, m);
 
-        final DenseRealMatrix out = new DenseRealMatrix(rows, columns);
+        final BlockRealMatrix out = new BlockRealMatrix(rows, columns);
 
         // perform subtraction block-wise, to ensure good cache behavior
         for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
@@ -446,10 +446,10 @@
 
     /** {@inheritDoc} */
     @Override
-    public DenseRealMatrix scalarAdd(final double d)
+    public BlockRealMatrix scalarAdd(final double d)
         throws IllegalArgumentException {
 
-        final DenseRealMatrix out = new DenseRealMatrix(rows, columns);
+        final BlockRealMatrix out = new BlockRealMatrix(rows, columns);
 
         // perform subtraction block-wise, to ensure good cache behavior
         for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
@@ -469,7 +469,7 @@
     public RealMatrix scalarMultiply(final double d)
         throws IllegalArgumentException {
 
-        final DenseRealMatrix out = new DenseRealMatrix(rows, columns);
+        final BlockRealMatrix out = new BlockRealMatrix(rows, columns);
 
         // perform subtraction block-wise, to ensure good cache behavior
         for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
@@ -486,16 +486,16 @@
 
     /** {@inheritDoc} */
     @Override
-    public DenseRealMatrix multiply(final RealMatrix m)
+    public BlockRealMatrix multiply(final RealMatrix m)
         throws IllegalArgumentException {
         try {
-            return multiply((DenseRealMatrix) m);
+            return multiply((BlockRealMatrix) m);
         } catch (ClassCastException cce) {
 
             // safety check
             MatrixUtils.checkMultiplicationCompatible(this, m);
 
-            final DenseRealMatrix out = new DenseRealMatrix(rows, m.getColumnDimension());
+            final BlockRealMatrix out = new BlockRealMatrix(rows, m.getColumnDimension());
 
             // perform multiplication block-wise, to ensure good cache behavior
             int blockIndex = 0;
@@ -549,12 +549,12 @@
      * @throws     IllegalArgumentException
      *             if columnDimension(this) != rowDimension(m)
      */
-    public DenseRealMatrix multiply(DenseRealMatrix m) throws IllegalArgumentException {
+    public BlockRealMatrix multiply(BlockRealMatrix m) throws IllegalArgumentException {
 
         // safety check
         MatrixUtils.checkMultiplicationCompatible(this, m);
 
-        final DenseRealMatrix out = new DenseRealMatrix(rows, m.columns);
+        final BlockRealMatrix out = new BlockRealMatrix(rows, m.columns);
 
         // perform multiplication block-wise, to ensure good cache behavior
         int blockIndex = 0;
@@ -681,7 +681,7 @@
 
     /** {@inheritDoc} */
     @Override
-    public DenseRealMatrix getSubMatrix(final int startRow, final int endRow,
+    public BlockRealMatrix getSubMatrix(final int startRow, final int endRow,
                                    final int startColumn, final int endColumn)
         throws MatrixIndexException {
 
@@ -689,8 +689,8 @@
         MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
 
         // create the output matrix
-        final DenseRealMatrix out =
-            new DenseRealMatrix(endRow - startRow + 1, endColumn - startColumn + 1);
+        final BlockRealMatrix out =
+            new BlockRealMatrix(endRow - startRow + 1, endColumn - startColumn + 1);
 
         // compute blocks shifts
         final int blockStartRow    = startRow    / BLOCK_SIZE;
@@ -858,11 +858,11 @@
 
     /** {@inheritDoc} */
     @Override
-    public DenseRealMatrix getRowMatrix(final int row)
+    public BlockRealMatrix getRowMatrix(final int row)
         throws MatrixIndexException {
 
         MatrixUtils.checkRowIndex(this, row);
-        final DenseRealMatrix out = new DenseRealMatrix(1, columns);
+        final BlockRealMatrix out = new BlockRealMatrix(1, columns);
 
         // perform copy block-wise, to ensure good cache behavior
         final int iBlock  = row / BLOCK_SIZE;
@@ -894,7 +894,7 @@
     public void setRowMatrix(final int row, final RealMatrix matrix)
         throws MatrixIndexException, InvalidMatrixException {
         try {
-            setRowMatrix(row, (DenseRealMatrix) matrix);
+            setRowMatrix(row, (BlockRealMatrix) matrix);
         } catch (ClassCastException cce) {
             super.setRowMatrix(row, matrix);
         }
@@ -911,7 +911,7 @@
      * @throws InvalidMatrixException if the matrix dimensions do not match one
      * instance row
      */
-    public void setRowMatrix(final int row, final DenseRealMatrix matrix)
+    public void setRowMatrix(final int row, final BlockRealMatrix matrix)
         throws MatrixIndexException, InvalidMatrixException {
 
         MatrixUtils.checkRowIndex(this, row);
@@ -949,11 +949,11 @@
     
     /** {@inheritDoc} */
     @Override
-    public DenseRealMatrix getColumnMatrix(final int column)
+    public BlockRealMatrix getColumnMatrix(final int column)
         throws MatrixIndexException {
 
         MatrixUtils.checkColumnIndex(this, column);
-        final DenseRealMatrix out = new DenseRealMatrix(rows, 1);
+        final BlockRealMatrix out = new BlockRealMatrix(rows, 1);
 
         // perform copy block-wise, to ensure good cache behavior
         final int jBlock  = column / BLOCK_SIZE;
@@ -983,7 +983,7 @@
     public void setColumnMatrix(final int column, final RealMatrix matrix)
         throws MatrixIndexException, InvalidMatrixException {
         try {
-            setColumnMatrix(column, (DenseRealMatrix) matrix);
+            setColumnMatrix(column, (BlockRealMatrix) matrix);
         } catch (ClassCastException cce) {
             super.setColumnMatrix(column, matrix);
         }
@@ -1000,7 +1000,7 @@
      * @throws InvalidMatrixException if the matrix dimensions do not match one
      * instance column
      */
-    void setColumnMatrix(final int column, final DenseRealMatrix matrix)
+    void setColumnMatrix(final int column, final BlockRealMatrix matrix)
         throws MatrixIndexException, InvalidMatrixException {
 
         MatrixUtils.checkColumnIndex(this, column);
@@ -1276,11 +1276,11 @@
 
     /** {@inheritDoc} */
     @Override
-    public DenseRealMatrix transpose() {
+    public BlockRealMatrix transpose() {
 
         final int nRows = getRowDimension();
         final int nCols = getColumnDimension();
-        final DenseRealMatrix out = new DenseRealMatrix(nCols, nRows);
+        final BlockRealMatrix out = new BlockRealMatrix(nCols, nRows);
 
         // perform transpose block-wise, to ensure good cache behavior
         int blockIndex = 0;

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/OpenMapRealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/OpenMapRealMatrix.java?rev=783678&r1=783677&r2=783678&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/OpenMapRealMatrix.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/OpenMapRealMatrix.java Thu Jun 11 08:05:24 2009
@@ -164,7 +164,7 @@
             MatrixUtils.checkMultiplicationCompatible(this, m);
 
             final int outCols = m.getColumnDimension();
-            final DenseRealMatrix out = new DenseRealMatrix(rowDimension, outCols);
+            final BlockRealMatrix out = new BlockRealMatrix(rowDimension, outCols);
             for (OpenIntToDoubleHashMap.Iterator iterator = entries.iterator(); iterator.hasNext();) {
                 iterator.advance();
                 final double value = iterator.value();

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/linear/QRDecompositionImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/QRDecompositionImpl.java?rev=783678&r1=783677&r2=783678&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/linear/QRDecompositionImpl.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/linear/QRDecompositionImpl.java Thu Jun 11 08:05:24 2009
@@ -369,9 +369,9 @@
             }
 
             final int columns        = b.getColumnDimension();
-            final int blockSize      = DenseRealMatrix.BLOCK_SIZE;
+            final int blockSize      = BlockRealMatrix.BLOCK_SIZE;
             final int cBlocks        = (columns + blockSize - 1) / blockSize;
-            final double[][] xBlocks = DenseRealMatrix.createBlocksLayout(n, columns);
+            final double[][] xBlocks = BlockRealMatrix.createBlocksLayout(n, columns);
             final double[][] y       = new double[b.getRowDimension()][blockSize];
             final double[]   alpha   = new double[blockSize];
 
@@ -435,7 +435,7 @@
 
             }
 
-            return new DenseRealMatrix(n, columns, xBlocks, false);
+            return new BlockRealMatrix(n, columns, xBlocks, false);
 
         }
 

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java?rev=783678&r1=783677&r2=783678&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java Thu Jun 11 08:05:24 2009
@@ -21,7 +21,7 @@
 
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.linear.DecompositionSolver;
-import org.apache.commons.math.linear.DenseRealMatrix;
+import org.apache.commons.math.linear.BlockRealMatrix;
 import org.apache.commons.math.linear.InvalidMatrixException;
 import org.apache.commons.math.linear.LUDecompositionImpl;
 import org.apache.commons.math.linear.QRDecompositionImpl;
@@ -109,7 +109,7 @@
             try {
 
                 // solve the linearized least squares problem
-                RealMatrix mA = new DenseRealMatrix(a);
+                RealMatrix mA = new BlockRealMatrix(a);
                 DecompositionSolver solver = useLU ?
                         new LUDecompositionImpl(mA).getSolver() :
                         new QRDecompositionImpl(mA).getSolver();

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/Covariance.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/Covariance.java?rev=783678&r1=783677&r2=783678&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/Covariance.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/Covariance.java Thu Jun 11 08:05:24 2009
@@ -18,7 +18,7 @@
 
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.linear.RealMatrix;
-import org.apache.commons.math.linear.DenseRealMatrix;
+import org.apache.commons.math.linear.BlockRealMatrix;
 import org.apache.commons.math.stat.descriptive.moment.Mean;
 import org.apache.commons.math.stat.descriptive.moment.Variance;
 
@@ -78,7 +78,7 @@
      * rectangular with at least two rows and two columns.
      */
     public Covariance(double[][] data, boolean biasCorrected) {
-        this(new DenseRealMatrix(data), biasCorrected);
+        this(new BlockRealMatrix(data), biasCorrected);
     }
     
     /**
@@ -159,7 +159,7 @@
     protected RealMatrix computeCovarianceMatrix(RealMatrix matrix, boolean biasCorrected) {
         int dimension = matrix.getColumnDimension();
         Variance variance = new Variance(biasCorrected);
-        RealMatrix outMatrix = new DenseRealMatrix(dimension, dimension);
+        RealMatrix outMatrix = new BlockRealMatrix(dimension, dimension);
         for (int i = 0; i < dimension; i++) {
             for (int j = 0; j < i; j++) {
               double cov = covariance(matrix.getColumn(i), matrix.getColumn(j), biasCorrected);
@@ -190,7 +190,7 @@
      * @return covariance matrix
      */
     protected RealMatrix computeCovarianceMatrix(double[][] data, boolean biasCorrected) {
-        return computeCovarianceMatrix(new DenseRealMatrix(data), biasCorrected);
+        return computeCovarianceMatrix(new BlockRealMatrix(data), biasCorrected);
     }
     
     /**

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/PearsonsCorrelation.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/PearsonsCorrelation.java?rev=783678&r1=783677&r2=783678&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/PearsonsCorrelation.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/PearsonsCorrelation.java Thu Jun 11 08:05:24 2009
@@ -21,7 +21,7 @@
 import org.apache.commons.math.distribution.TDistribution;
 import org.apache.commons.math.distribution.TDistributionImpl;
 import org.apache.commons.math.linear.RealMatrix;
-import org.apache.commons.math.linear.DenseRealMatrix;
+import org.apache.commons.math.linear.BlockRealMatrix;
 import org.apache.commons.math.stat.regression.SimpleRegression;
 
 /**
@@ -65,7 +65,7 @@
      * rectangular with at least two rows and two columns.
      */
     public PearsonsCorrelation(double[][] data) {
-        this(new DenseRealMatrix(data));
+        this(new BlockRealMatrix(data));
     }
     
     /**
@@ -141,7 +141,7 @@
                 out[i][j] = Math.sqrt((1 - r * r) /(nObs - 2));
             }
         }
-        return new DenseRealMatrix(out);
+        return new BlockRealMatrix(out);
     }
 
     /**
@@ -172,7 +172,7 @@
                 }
             }
         }
-        return new DenseRealMatrix(out);
+        return new BlockRealMatrix(out);
     }
     
     
@@ -185,7 +185,7 @@
      */
     public RealMatrix computeCorrelationMatrix(RealMatrix matrix) {
         int nVars = matrix.getColumnDimension();
-        RealMatrix outMatrix = new DenseRealMatrix(nVars, nVars);
+        RealMatrix outMatrix = new BlockRealMatrix(nVars, nVars);
         for (int i = 0; i < nVars; i++) {
             for (int j = 0; j < i; j++) {
               double corr = correlation(matrix.getColumn(i), matrix.getColumn(j));
@@ -206,7 +206,7 @@
      * @return correlation matrix
      */
     public RealMatrix computeCorrelationMatrix(double[][] data) {
-       return computeCorrelationMatrix(new DenseRealMatrix(data));
+       return computeCorrelationMatrix(new BlockRealMatrix(data));
     }
     
     /**
@@ -249,7 +249,7 @@
      */
     public RealMatrix covarianceToCorrelation(RealMatrix covarianceMatrix) {
         int nVars = covarianceMatrix.getColumnDimension();
-        RealMatrix outMatrix = new DenseRealMatrix(nVars, nVars);
+        RealMatrix outMatrix = new BlockRealMatrix(nVars, nVars);
         for (int i = 0; i < nVars; i++) {
             double sigma = Math.sqrt(covarianceMatrix.getEntry(i, i));
             outMatrix.setEntry(i, i, 1d);

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/SpearmansCorrelation.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/SpearmansCorrelation.java?rev=783678&r1=783677&r2=783678&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/SpearmansCorrelation.java (original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/SpearmansCorrelation.java Thu Jun 11 08:05:24 2009
@@ -18,7 +18,7 @@
 package org.apache.commons.math.stat.correlation;
 
 import org.apache.commons.math.MathRuntimeException;
-import org.apache.commons.math.linear.DenseRealMatrix;
+import org.apache.commons.math.linear.BlockRealMatrix;
 import org.apache.commons.math.linear.RealMatrix;
 import org.apache.commons.math.stat.ranking.NaturalRanking;
 import org.apache.commons.math.stat.ranking.RankingAlgorithm;
@@ -128,7 +128,7 @@
      * @return correlation matrix
      */
     public RealMatrix computeCorrelationMatrix(double[][] data) {
-       return computeCorrelationMatrix(new DenseRealMatrix(data));
+       return computeCorrelationMatrix(new BlockRealMatrix(data));
     }
     
     /**

Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=783678&r1=783677&r2=783678&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Thu Jun 11 08:05:24 2009
@@ -83,6 +83,9 @@
         Added support for any type of field in linear algebra (FielxMatrix, FieldVector,
         FieldLUDecomposition)
       </action>
+      <action dev="luc" type="add" >
+        Added a block-based storage type for dense matrices improving speed for large dimensions
+      </action>
       <action dev="psteitz" type="add" due-to="John Bollinger">
         Added AggregateSummaryStatistics class to support aggregation of SummaryStatistics.
       </action>

Modified: commons/proper/math/trunk/src/site/xdoc/userguide/linear.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/userguide/linear.xml?rev=783678&r1=783677&r2=783678&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/userguide/linear.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/userguide/linear.xml Thu Jun 11 08:05:24 2009
@@ -71,9 +71,12 @@
          </source>
         </p>
         <p>
-        The two main implementations of the interface are <a
+        The three main implementations of the interface are <a
         href="../apidocs/org/apache/commons/math/linear/RealMatrixImpl.html">
-        RealMatrixImpl</a> for dense matrices and <a
+        RealMatrixImpl</a> and <a
+        href="../apidocs/org/apache/commons/math/linear/BlockRealMatrix.html">
+        BlockRealMatrix</a> for dense matrices (the second one being more suited to
+        dimensions above 50 or 100) and <a
         href="../apidocs/org/apache/commons/math/linear/SparseRealMatrix.html">
         SparseRealMatrix</a> for sparse matrices.
         </p>

Modified: commons/proper/math/trunk/src/test/org/apache/commons/math/linear/DenseFieldMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/org/apache/commons/math/linear/DenseFieldMatrixTest.java?rev=783678&r1=783677&r2=783678&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/org/apache/commons/math/linear/DenseFieldMatrixTest.java (original)
+++ commons/proper/math/trunk/src/test/org/apache/commons/math/linear/DenseFieldMatrixTest.java Thu Jun 11 08:05:24 2009
@@ -28,7 +28,7 @@
 import org.apache.commons.math.fraction.FractionField;
 
 /**
- * Test cases for the {@link DenseFieldMatrix} class.
+ * Test cases for the {@link BlockFieldMatrix} class.
  *
  * @version $Revision$ $Date$
  */
@@ -158,14 +158,14 @@
     
     public static Test suite() {
         TestSuite suite = new TestSuite(DenseFieldMatrixTest.class);
-        suite.setName("DenseFieldMatrix<Fraction> Tests");
+        suite.setName("BlockFieldMatrix<Fraction> Tests");
         return suite;
     }
     
     /** test dimensions */
     public void testDimensions() {
-        DenseFieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(testData);
-        DenseFieldMatrix<Fraction> m2 = new DenseFieldMatrix<Fraction>(testData2);
+        BlockFieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(testData);
+        BlockFieldMatrix<Fraction> m2 = new BlockFieldMatrix<Fraction>(testData2);
         assertEquals("testData row dimension",3,m.getRowDimension());
         assertEquals("testData column dimension",3,m.getColumnDimension());
         assertTrue("testData is square",m.isSquare());
@@ -177,18 +177,18 @@
     /** test copy functions */
     public void testCopyFunctions() {
         Random r = new Random(66636328996002l);
-        DenseFieldMatrix<Fraction> m1 = createRandomMatrix(r, 47, 83);
-        DenseFieldMatrix<Fraction> m2 = new DenseFieldMatrix<Fraction>(m1.getData());
+        BlockFieldMatrix<Fraction> m1 = createRandomMatrix(r, 47, 83);
+        BlockFieldMatrix<Fraction> m2 = new BlockFieldMatrix<Fraction>(m1.getData());
         assertEquals(m1, m2);
-        DenseFieldMatrix<Fraction> m3 = new DenseFieldMatrix<Fraction>(testData);
-        DenseFieldMatrix<Fraction> m4 = new DenseFieldMatrix<Fraction>(m3.getData());
+        BlockFieldMatrix<Fraction> m3 = new BlockFieldMatrix<Fraction>(testData);
+        BlockFieldMatrix<Fraction> m4 = new BlockFieldMatrix<Fraction>(m3.getData());
         assertEquals(m3, m4);
     }           
     
     /** test add */
     public void testAdd() {
-        DenseFieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(testData);
-        DenseFieldMatrix<Fraction> mInv = new DenseFieldMatrix<Fraction>(testDataInv);
+        BlockFieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(testData);
+        BlockFieldMatrix<Fraction> mInv = new BlockFieldMatrix<Fraction>(testDataInv);
         FieldMatrix<Fraction> mPlusMInv = m.add(mInv);
         Fraction[][] sumEntries = mPlusMInv.getData();
         for (int row = 0; row < m.getRowDimension(); row++) {
@@ -200,8 +200,8 @@
     
     /** test add failure */
     public void testAddFail() {
-        DenseFieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(testData);
-        DenseFieldMatrix<Fraction> m2 = new DenseFieldMatrix<Fraction>(testData2);
+        BlockFieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(testData);
+        BlockFieldMatrix<Fraction> m2 = new BlockFieldMatrix<Fraction>(testData2);
         try {
             m.add(m2);
             fail("IllegalArgumentException expected");
@@ -212,11 +212,11 @@
     
      /** test m-n = m + -n */
     public void testPlusMinus() {
-        DenseFieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(testData);
-        DenseFieldMatrix<Fraction> m2 = new DenseFieldMatrix<Fraction>(testDataInv);
+        BlockFieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(testData);
+        BlockFieldMatrix<Fraction> m2 = new BlockFieldMatrix<Fraction>(testDataInv);
         TestUtils.assertEquals(m.subtract(m2), m2.scalarMultiply(new Fraction(-1)).add(m));        
         try {
-            m.subtract(new DenseFieldMatrix<Fraction>(testData2));
+            m.subtract(new BlockFieldMatrix<Fraction>(testData2));
             fail("Expecting illegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // ignored
@@ -225,17 +225,17 @@
    
     /** test multiply */
      public void testMultiply() {
-        DenseFieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(testData);
-        DenseFieldMatrix<Fraction> mInv = new DenseFieldMatrix<Fraction>(testDataInv);
-        DenseFieldMatrix<Fraction> identity = new DenseFieldMatrix<Fraction>(id);
-        DenseFieldMatrix<Fraction> m2 = new DenseFieldMatrix<Fraction>(testData2);
+        BlockFieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(testData);
+        BlockFieldMatrix<Fraction> mInv = new BlockFieldMatrix<Fraction>(testDataInv);
+        BlockFieldMatrix<Fraction> identity = new BlockFieldMatrix<Fraction>(id);
+        BlockFieldMatrix<Fraction> m2 = new BlockFieldMatrix<Fraction>(testData2);
         TestUtils.assertEquals(m.multiply(mInv), identity);
         TestUtils.assertEquals(mInv.multiply(m), identity);
         TestUtils.assertEquals(m.multiply(identity), m);
         TestUtils.assertEquals(identity.multiply(mInv), mInv);
         TestUtils.assertEquals(m2.multiply(identity), m2); 
         try {
-            m.multiply(new DenseFieldMatrix<Fraction>(bigSingular));
+            m.multiply(new BlockFieldMatrix<Fraction>(bigSingular));
             fail("Expecting illegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // expected
@@ -245,7 +245,7 @@
     public void testSeveralBlocks() {
 
         FieldMatrix<Fraction> m =
-            new DenseFieldMatrix<Fraction>(FractionField.getInstance(), 37, 41);
+            new BlockFieldMatrix<Fraction>(FractionField.getInstance(), 37, 41);
         for (int i = 0; i < m.getRowDimension(); ++i) {
             for (int j = 0; j < m.getColumnDimension(); ++j) {
                 m.setEntry(i, j, new Fraction(i * 11 + j, 11));
@@ -327,7 +327,7 @@
 
     }
 
-    //Additional Test for DenseFieldMatrix<Fraction>Test.testMultiply
+    //Additional Test for BlockFieldMatrix<Fraction>Test.testMultiply
 
     private Fraction[][] d3 = new Fraction[][] {
             {new Fraction(1),new Fraction(2),new Fraction(3),new Fraction(4)},
@@ -342,17 +342,17 @@
     private Fraction[][] d5 = new Fraction[][] {{new Fraction(30)},{new Fraction(70)}};
      
     public void testMultiply2() { 
-       FieldMatrix<Fraction> m3 = new DenseFieldMatrix<Fraction>(d3);   
-       FieldMatrix<Fraction> m4 = new DenseFieldMatrix<Fraction>(d4);
-       FieldMatrix<Fraction> m5 = new DenseFieldMatrix<Fraction>(d5);
+       FieldMatrix<Fraction> m3 = new BlockFieldMatrix<Fraction>(d3);   
+       FieldMatrix<Fraction> m4 = new BlockFieldMatrix<Fraction>(d4);
+       FieldMatrix<Fraction> m5 = new BlockFieldMatrix<Fraction>(d5);
        TestUtils.assertEquals(m3.multiply(m4), m5);
    }  
         
     /** test trace */
     public void testTrace() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(id);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(id);
         assertEquals(new Fraction(3),m.getTrace());
-        m = new DenseFieldMatrix<Fraction>(testData2);
+        m = new BlockFieldMatrix<Fraction>(testData2);
         try {
             m.getTrace();
             fail("Expecting NonSquareMatrixException");
@@ -363,17 +363,17 @@
     
     /** test scalarAdd */
     public void testScalarAdd() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(testData);
-        TestUtils.assertEquals(new DenseFieldMatrix<Fraction>(testDataPlus2),
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(testData);
+        TestUtils.assertEquals(new BlockFieldMatrix<Fraction>(testDataPlus2),
                                m.scalarAdd(new Fraction(2)));
     }
                     
     /** test operate */
     public void testOperate() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(id);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(id);
         TestUtils.assertEquals(testVector, m.operate(testVector));
         TestUtils.assertEquals(testVector, m.operate(new FieldVectorImpl<Fraction>(testVector)).getData());
-        m = new DenseFieldMatrix<Fraction>(bigSingular);
+        m = new BlockFieldMatrix<Fraction>(bigSingular);
         try {
             m.operate(testVector);
             fail("Expecting illegalArgumentException");
@@ -383,9 +383,9 @@
     }
 
     public void testOperateLarge() {
-        int p = (11 * DenseFieldMatrix.BLOCK_SIZE) / 10;
-        int q = (11 * DenseFieldMatrix.BLOCK_SIZE) / 10;
-        int r =  DenseFieldMatrix.BLOCK_SIZE / 2;
+        int p = (11 * BlockFieldMatrix.BLOCK_SIZE) / 10;
+        int q = (11 * BlockFieldMatrix.BLOCK_SIZE) / 10;
+        int r =  BlockFieldMatrix.BLOCK_SIZE / 2;
         Random random = new Random(111007463902334l);
         FieldMatrix<Fraction> m1 = createRandomMatrix(random, p, q);
         FieldMatrix<Fraction> m2 = createRandomMatrix(random, q, r);
@@ -396,9 +396,9 @@
     }
 
     public void testOperatePremultiplyLarge() {
-        int p = (11 * DenseFieldMatrix.BLOCK_SIZE) / 10;
-        int q = (11 * DenseFieldMatrix.BLOCK_SIZE) / 10;
-        int r =  DenseFieldMatrix.BLOCK_SIZE / 2;
+        int p = (11 * BlockFieldMatrix.BLOCK_SIZE) / 10;
+        int q = (11 * BlockFieldMatrix.BLOCK_SIZE) / 10;
+        int r =  BlockFieldMatrix.BLOCK_SIZE / 2;
         Random random = new Random(111007463902334l);
         FieldMatrix<Fraction> m1 = createRandomMatrix(random, p, q);
         FieldMatrix<Fraction> m2 = createRandomMatrix(random, q, r);
@@ -410,7 +410,7 @@
 
     /** test issue MATH-209 */
     public void testMath209() {
-        FieldMatrix<Fraction> a = new DenseFieldMatrix<Fraction>(new Fraction[][] {
+        FieldMatrix<Fraction> a = new BlockFieldMatrix<Fraction>(new Fraction[][] {
                 { new Fraction(1), new Fraction(2) },
                 { new Fraction(3), new Fraction(4) },
                 { new Fraction(5), new Fraction(6) }
@@ -424,22 +424,22 @@
     
     /** test transpose */
     public void testTranspose() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(testData); 
+        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();
         TestUtils.assertEquals(mIT, mTI);
-        m = new DenseFieldMatrix<Fraction>(testData2);
-        FieldMatrix<Fraction> mt = new DenseFieldMatrix<Fraction>(testData2T);
+        m = new BlockFieldMatrix<Fraction>(testData2);
+        FieldMatrix<Fraction> mt = new BlockFieldMatrix<Fraction>(testData2T);
         TestUtils.assertEquals(mt, m.transpose());
     }
     
     /** test preMultiply by vector */
     public void testPremultiplyVector() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(testData);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(testData);
         TestUtils.assertEquals(m.preMultiply(testVector), preMultTest);
         TestUtils.assertEquals(m.preMultiply(new FieldVectorImpl<Fraction>(testVector).getData()),
                                preMultTest);
-        m = new DenseFieldMatrix<Fraction>(bigSingular);
+        m = new BlockFieldMatrix<Fraction>(bigSingular);
         try {
             m.preMultiply(testVector);
             fail("expecting IllegalArgumentException");
@@ -449,20 +449,20 @@
     }
     
     public void testPremultiply() {
-        FieldMatrix<Fraction> m3 = new DenseFieldMatrix<Fraction>(d3);   
-        FieldMatrix<Fraction> m4 = new DenseFieldMatrix<Fraction>(d4);
-        FieldMatrix<Fraction> m5 = new DenseFieldMatrix<Fraction>(d5);
+        FieldMatrix<Fraction> m3 = new BlockFieldMatrix<Fraction>(d3);   
+        FieldMatrix<Fraction> m4 = new BlockFieldMatrix<Fraction>(d4);
+        FieldMatrix<Fraction> m5 = new BlockFieldMatrix<Fraction>(d5);
         TestUtils.assertEquals(m4.preMultiply(m3), m5);
         
-        DenseFieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(testData);
-        DenseFieldMatrix<Fraction> mInv = new DenseFieldMatrix<Fraction>(testDataInv);
-        DenseFieldMatrix<Fraction> identity = new DenseFieldMatrix<Fraction>(id);
+        BlockFieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(testData);
+        BlockFieldMatrix<Fraction> mInv = new BlockFieldMatrix<Fraction>(testDataInv);
+        BlockFieldMatrix<Fraction> identity = new BlockFieldMatrix<Fraction>(id);
         TestUtils.assertEquals(m.preMultiply(mInv), identity);
         TestUtils.assertEquals(mInv.preMultiply(m), identity);
         TestUtils.assertEquals(m.preMultiply(identity), m);
         TestUtils.assertEquals(identity.preMultiply(mInv), mInv);
         try {
-            m.preMultiply(new DenseFieldMatrix<Fraction>(bigSingular));
+            m.preMultiply(new BlockFieldMatrix<Fraction>(bigSingular));
             fail("Expecting illegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // ignored
@@ -470,7 +470,7 @@
     }
     
     public void testGetVectors() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(testData);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(testData);
         TestUtils.assertEquals(m.getRow(0), testDataRow1);
         TestUtils.assertEquals(m.getColumn(2), testDataCol3);
         try {
@@ -488,7 +488,7 @@
     }
     
     public void testGetEntry() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(testData);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(testData);
         assertEquals(m.getEntry(0,1),new Fraction(2));
         try {
             m.getEntry(10, 4);
@@ -505,14 +505,14 @@
                 {new Fraction(1),new Fraction(2),new Fraction(3)},
                 {new Fraction(2),new Fraction(5),new Fraction(3)}
         };
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(matrixData);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(matrixData);
         // One more with three rows, two columns
         Fraction[][] matrixData2 = {
                 {new Fraction(1),new Fraction(2)},
                 {new Fraction(2),new Fraction(5)},
                 {new Fraction(1), new Fraction(7)}
         };
-        FieldMatrix<Fraction> n = new DenseFieldMatrix<Fraction>(matrixData2);
+        FieldMatrix<Fraction> n = new BlockFieldMatrix<Fraction>(matrixData2);
         // Now multiply m by n
         FieldMatrix<Fraction> p = m.multiply(n);
         assertEquals(2, p.getRowDimension());
@@ -528,7 +528,7 @@
                 {new Fraction(-1), new Fraction(7), new Fraction(6)},
                 {new Fraction(4), new Fraction(-3), new Fraction(-5)}
         };
-        FieldMatrix<Fraction> coefficients = new DenseFieldMatrix<Fraction>(coefficientsData);
+        FieldMatrix<Fraction> coefficients = new BlockFieldMatrix<Fraction>(coefficientsData);
         Fraction[] constants = {new Fraction(1), new Fraction(-2), new Fraction(1)};
         Fraction[] solution = new FieldLUDecompositionImpl<Fraction>(coefficients).getSolver().solve(constants);
         assertEquals(new Fraction(2).multiply(solution[0]).
@@ -548,7 +548,7 @@
     
     // test submatrix accessors
     public void testGetSubMatrix() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(subTestData);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(subTestData);
         checkGetSubMatrix(m, subRows23Cols00,  2 , 3 , 0, 0, false);
         checkGetSubMatrix(m, subRows00Cols33,  0 , 0 , 3, 3, false);
         checkGetSubMatrix(m, subRows01Cols23,  0 , 1 , 2, 3, false);   
@@ -571,7 +571,7 @@
                                    boolean mustFail) {
         try {
             FieldMatrix<Fraction> sub = m.getSubMatrix(startRow, endRow, startColumn, endColumn);
-            assertEquals(new DenseFieldMatrix<Fraction>(reference), sub);
+            assertEquals(new BlockFieldMatrix<Fraction>(reference), sub);
             if (mustFail) {
                 fail("Expecting MatrixIndexException");
             }
@@ -587,7 +587,7 @@
                                    boolean mustFail) {
         try {
             FieldMatrix<Fraction> sub = m.getSubMatrix(selectedRows, selectedColumns);
-            assertEquals(new DenseFieldMatrix<Fraction>(reference), sub);
+            assertEquals(new BlockFieldMatrix<Fraction>(reference), sub);
             if (mustFail) {
                 fail("Expecting MatrixIndexException");
             }
@@ -599,11 +599,11 @@
     }
 
     public void testGetSetMatrixLarge() {
-        int n = 3 * DenseFieldMatrix.BLOCK_SIZE;
+        int n = 3 * BlockFieldMatrix.BLOCK_SIZE;
         FieldMatrix<Fraction> m =
-            new DenseFieldMatrix<Fraction>(FractionField.getInstance(), n, n);
+            new BlockFieldMatrix<Fraction>(FractionField.getInstance(), n, n);
         FieldMatrix<Fraction> sub =
-            new DenseFieldMatrix<Fraction>(FractionField.getInstance(), n - 4, n - 4).scalarAdd(new Fraction(1));
+            new BlockFieldMatrix<Fraction>(FractionField.getInstance(), n - 4, n - 4).scalarAdd(new Fraction(1));
 
         m.setSubMatrix(sub.getData(), 2, 2);
         for (int i = 0; i < n; ++i) {
@@ -620,7 +620,7 @@
     }
 
     public void testCopySubMatrix() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(subTestData);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(subTestData);
         checkCopy(m, subRows23Cols00,  2 , 3 , 0, 0, false);
         checkCopy(m, subRows00Cols33,  0 , 0 , 3, 3, false);
         checkCopy(m, subRows01Cols23,  0 , 1 , 2, 3, false);   
@@ -647,7 +647,7 @@
                              new Fraction[1][1] :
                              new Fraction[reference.length][reference[0].length];
             m.copySubMatrix(startRow, endRow, startColumn, endColumn, sub);
-            assertEquals(new DenseFieldMatrix<Fraction>(reference), new DenseFieldMatrix<Fraction>(sub));
+            assertEquals(new BlockFieldMatrix<Fraction>(reference), new BlockFieldMatrix<Fraction>(sub));
             if (mustFail) {
                 fail("Expecting MatrixIndexException");
             }
@@ -666,7 +666,7 @@
                     new Fraction[1][1] :
                     new Fraction[reference.length][reference[0].length];
             m.copySubMatrix(selectedRows, selectedColumns, sub);
-            assertEquals(new DenseFieldMatrix<Fraction>(reference), new DenseFieldMatrix<Fraction>(sub));
+            assertEquals(new BlockFieldMatrix<Fraction>(reference), new BlockFieldMatrix<Fraction>(sub));
             if (mustFail) {
                 fail("Expecting MatrixIndexException");
             }
@@ -678,9 +678,9 @@
     }
 
     public void testGetRowMatrix() {
-        FieldMatrix<Fraction> m     = new DenseFieldMatrix<Fraction>(subTestData);
-        FieldMatrix<Fraction> mRow0 = new DenseFieldMatrix<Fraction>(subRow0);
-        FieldMatrix<Fraction> mRow3 = new DenseFieldMatrix<Fraction>(subRow3);
+        FieldMatrix<Fraction> m     = new BlockFieldMatrix<Fraction>(subTestData);
+        FieldMatrix<Fraction> mRow0 = new BlockFieldMatrix<Fraction>(subRow0);
+        FieldMatrix<Fraction> mRow3 = new BlockFieldMatrix<Fraction>(subRow3);
         assertEquals("Row0", mRow0, m.getRowMatrix(0));
         assertEquals("Row3", mRow3, m.getRowMatrix(3));
         try {
@@ -698,8 +698,8 @@
     }
 
     public void testSetRowMatrix() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(subTestData);
-        FieldMatrix<Fraction> mRow3 = new DenseFieldMatrix<Fraction>(subRow3);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(subTestData);
+        FieldMatrix<Fraction> mRow3 = new BlockFieldMatrix<Fraction>(subRow3);
         assertNotSame(mRow3, m.getRowMatrix(0));
         m.setRowMatrix(0, mRow3);
         assertEquals(mRow3, m.getRowMatrix(0));
@@ -718,11 +718,11 @@
     }
     
     public void testGetSetRowMatrixLarge() {
-        int n = 3 * DenseFieldMatrix.BLOCK_SIZE;
+        int n = 3 * BlockFieldMatrix.BLOCK_SIZE;
         FieldMatrix<Fraction> m =
-            new DenseFieldMatrix<Fraction>(FractionField.getInstance(), n, n);
+            new BlockFieldMatrix<Fraction>(FractionField.getInstance(), n, n);
         FieldMatrix<Fraction> sub =
-            new DenseFieldMatrix<Fraction>(FractionField.getInstance(), 1, n).scalarAdd(new Fraction(1));
+            new BlockFieldMatrix<Fraction>(FractionField.getInstance(), 1, n).scalarAdd(new Fraction(1));
 
         m.setRowMatrix(2, sub);
         for (int i = 0; i < n; ++i) {
@@ -739,9 +739,9 @@
     }
     
     public void testGetColumnMatrix() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(subTestData);
-        FieldMatrix<Fraction> mColumn1 = new DenseFieldMatrix<Fraction>(subColumn1);
-        FieldMatrix<Fraction> mColumn3 = new DenseFieldMatrix<Fraction>(subColumn3);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(subTestData);
+        FieldMatrix<Fraction> mColumn1 = new BlockFieldMatrix<Fraction>(subColumn1);
+        FieldMatrix<Fraction> mColumn3 = new BlockFieldMatrix<Fraction>(subColumn3);
         assertEquals(mColumn1, m.getColumnMatrix(1));
         assertEquals(mColumn3, m.getColumnMatrix(3));
         try {
@@ -759,8 +759,8 @@
     }
 
     public void testSetColumnMatrix() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(subTestData);
-        FieldMatrix<Fraction> mColumn3 = new DenseFieldMatrix<Fraction>(subColumn3);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(subTestData);
+        FieldMatrix<Fraction> mColumn3 = new BlockFieldMatrix<Fraction>(subColumn3);
         assertNotSame(mColumn3, m.getColumnMatrix(1));
         m.setColumnMatrix(1, mColumn3);
         assertEquals(mColumn3, m.getColumnMatrix(1));
@@ -779,11 +779,11 @@
     }
 
     public void testGetSetColumnMatrixLarge() {
-        int n = 3 * DenseFieldMatrix.BLOCK_SIZE;
+        int n = 3 * BlockFieldMatrix.BLOCK_SIZE;
         FieldMatrix<Fraction> m =
-            new DenseFieldMatrix<Fraction>(FractionField.getInstance(), n, n);
+            new BlockFieldMatrix<Fraction>(FractionField.getInstance(), n, n);
         FieldMatrix<Fraction> sub =
-            new DenseFieldMatrix<Fraction>(FractionField.getInstance(), n, 1).scalarAdd(new Fraction(1));
+            new BlockFieldMatrix<Fraction>(FractionField.getInstance(), n, 1).scalarAdd(new Fraction(1));
 
         m.setColumnMatrix(2, sub);
         for (int i = 0; i < n; ++i) {
@@ -800,7 +800,7 @@
     }
     
     public void testGetRowVector() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(subTestData);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(subTestData);
         FieldVector<Fraction> mRow0 = new FieldVectorImpl<Fraction>(subRow0[0]);
         FieldVector<Fraction> mRow3 = new FieldVectorImpl<Fraction>(subRow3[0]);
         assertEquals(mRow0, m.getRowVector(0));
@@ -820,7 +820,7 @@
     }
 
     public void testSetRowVector() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(subTestData);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(subTestData);
         FieldVector<Fraction> mRow3 = new FieldVectorImpl<Fraction>(subRow3[0]);
         assertNotSame(mRow3, m.getRowMatrix(0));
         m.setRowVector(0, mRow3);
@@ -840,8 +840,8 @@
     }
 
     public void testGetSetRowVectorLarge() {
-        int n = 3 * DenseFieldMatrix.BLOCK_SIZE;
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(FractionField.getInstance(), n, n);
+        int n = 3 * BlockFieldMatrix.BLOCK_SIZE;
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(FractionField.getInstance(), n, n);
         FieldVector<Fraction> sub = new FieldVectorImpl<Fraction>(n, new Fraction(1));
 
         m.setRowVector(2, sub);
@@ -859,7 +859,7 @@
     }
     
     public void testGetColumnVector() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(subTestData);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(subTestData);
         FieldVector<Fraction> mColumn1 = columnToVector(subColumn1);
         FieldVector<Fraction> mColumn3 = columnToVector(subColumn3);
         assertEquals(mColumn1, m.getColumnVector(1));
@@ -879,7 +879,7 @@
     }
 
     public void testSetColumnVector() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(subTestData);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(subTestData);
         FieldVector<Fraction> mColumn3 = columnToVector(subColumn3);
         assertNotSame(mColumn3, m.getColumnVector(1));
         m.setColumnVector(1, mColumn3);
@@ -899,8 +899,8 @@
     }
 
     public void testGetSetColumnVectorLarge() {
-        int n = 3 * DenseFieldMatrix.BLOCK_SIZE;
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(FractionField.getInstance(), n, n);
+        int n = 3 * BlockFieldMatrix.BLOCK_SIZE;
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(FractionField.getInstance(), n, n);
         FieldVector<Fraction> sub = new FieldVectorImpl<Fraction>(n, new Fraction(1));
 
         m.setColumnVector(2, sub);
@@ -926,7 +926,7 @@
     }
 
     public void testGetRow() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(subTestData);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(subTestData);
         checkArrays(subRow0[0], m.getRow(0));
         checkArrays(subRow3[0], m.getRow(3));
         try {
@@ -944,7 +944,7 @@
     }
 
     public void testSetRow() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(subTestData);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(subTestData);
         assertTrue(subRow3[0][0] != m.getRow(0)[0]);
         m.setRow(0, subRow3[0]);
         checkArrays(subRow3[0], m.getRow(0));
@@ -963,8 +963,8 @@
     }
 
     public void testGetSetRowLarge() {
-        int n = 3 * DenseFieldMatrix.BLOCK_SIZE;
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(FractionField.getInstance(), n, n);
+        int n = 3 * BlockFieldMatrix.BLOCK_SIZE;
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(FractionField.getInstance(), n, n);
         Fraction[] sub = new Fraction[n];
         Arrays.fill(sub, new Fraction(1));
 
@@ -983,7 +983,7 @@
     }
     
     public void testGetColumn() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(subTestData);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(subTestData);
         Fraction[] mColumn1 = columnToArray(subColumn1);
         Fraction[] mColumn3 = columnToArray(subColumn3);
         checkArrays(mColumn1, m.getColumn(1));
@@ -1003,7 +1003,7 @@
     }
 
     public void testSetColumn() {
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(subTestData);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(subTestData);
         Fraction[] mColumn3 = columnToArray(subColumn3);
         assertTrue(mColumn3[0] != m.getColumn(1)[0]);
         m.setColumn(1, mColumn3);
@@ -1023,8 +1023,8 @@
     }
 
     public void testGetSetColumnLarge() {
-        int n = 3 * DenseFieldMatrix.BLOCK_SIZE;
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(FractionField.getInstance(), n, n);
+        int n = 3 * BlockFieldMatrix.BLOCK_SIZE;
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(FractionField.getInstance(), n, n);
         Fraction[] sub = new Fraction[n];
         Arrays.fill(sub, new Fraction(1));
 
@@ -1058,43 +1058,43 @@
     }
     
     public void testEqualsAndHashCode() {
-        DenseFieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(testData);
-        DenseFieldMatrix<Fraction> m1 = (DenseFieldMatrix<Fraction>) m.copy();
-        DenseFieldMatrix<Fraction> mt = (DenseFieldMatrix<Fraction>) m.transpose();
+        BlockFieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(testData);
+        BlockFieldMatrix<Fraction> m1 = (BlockFieldMatrix<Fraction>) m.copy();
+        BlockFieldMatrix<Fraction> mt = (BlockFieldMatrix<Fraction>) m.transpose();
         assertTrue(m.hashCode() != mt.hashCode());
         assertEquals(m.hashCode(), m1.hashCode());
         assertEquals(m, m);
         assertEquals(m, m1);
         assertFalse(m.equals(null));
         assertFalse(m.equals(mt));
-        assertFalse(m.equals(new DenseFieldMatrix<Fraction>(bigSingular))); 
+        assertFalse(m.equals(new BlockFieldMatrix<Fraction>(bigSingular))); 
     }
     
     public void testToString() {
-        DenseFieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(testData);
-        assertEquals("DenseFieldMatrix{{1,2,3},{2,5,3},{1,0,8}}", m.toString());
+        BlockFieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(testData);
+        assertEquals("BlockFieldMatrix{{1,2,3},{2,5,3},{1,0,8}}", m.toString());
     }
     
     public void testSetSubMatrix() throws Exception {
-        DenseFieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(testData);
+        BlockFieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(testData);
         m.setSubMatrix(detData2,1,1);
-        FieldMatrix<Fraction> expected = new DenseFieldMatrix<Fraction>
+        FieldMatrix<Fraction> expected = new BlockFieldMatrix<Fraction>
             (new Fraction[][] {{new Fraction(1),new Fraction(2),new Fraction(3)},{new Fraction(2),new Fraction(1),new Fraction(3)},{new Fraction(1),new Fraction(2),new Fraction(4)}});
         assertEquals(expected, m);  
         
         m.setSubMatrix(detData2,0,0);
-        expected = new DenseFieldMatrix<Fraction>
+        expected = new BlockFieldMatrix<Fraction>
             (new Fraction[][] {{new Fraction(1),new Fraction(3),new Fraction(3)},{new Fraction(2),new Fraction(4),new Fraction(3)},{new Fraction(1),new Fraction(2),new Fraction(4)}});
         assertEquals(expected, m);  
         
         m.setSubMatrix(testDataPlus2,0,0);      
-        expected = new DenseFieldMatrix<Fraction>
+        expected = new BlockFieldMatrix<Fraction>
             (new Fraction[][] {{new Fraction(3),new Fraction(4),new Fraction(5)},{new Fraction(4),new Fraction(7),new Fraction(5)},{new Fraction(3),new Fraction(2),new Fraction(10)}});
         assertEquals(expected, m);   
         
         // javadoc example
-        DenseFieldMatrix<Fraction> matrix =
-            new DenseFieldMatrix<Fraction>(new Fraction[][] {
+        BlockFieldMatrix<Fraction> matrix =
+            new BlockFieldMatrix<Fraction>(new Fraction[][] {
                     {new Fraction(1), new Fraction(2), new Fraction(3), new Fraction(4)},
                     {new Fraction(5), new Fraction(6), new Fraction(7), new Fraction(8)},
                     {new Fraction(9), new Fraction(0), new Fraction(1) , new Fraction(2)}
@@ -1104,7 +1104,7 @@
                 {new Fraction(5), new Fraction(6)}
         }, 1, 1);
         expected =
-            new DenseFieldMatrix<Fraction>(new Fraction[][] {
+            new BlockFieldMatrix<Fraction>(new Fraction[][] {
                     {new Fraction(1), new Fraction(2), new Fraction(3),new Fraction(4)},
                     {new Fraction(5), new Fraction(3), new Fraction(4), new Fraction(8)},
                     {new Fraction(9), new Fraction(5) ,new Fraction(6), new Fraction(2)}
@@ -1162,13 +1162,13 @@
         int rows    = 150;
         int columns = 75;
 
-        FieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
+        FieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
         m.walkInRowOrder(new SetVisitor());
         GetVisitor getVisitor = new GetVisitor();
         m.walkInOptimizedOrder(getVisitor);
         assertEquals(rows * columns, getVisitor.getCount());
 
-        m = new DenseFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
+        m = new BlockFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
         m.walkInRowOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2);
         getVisitor = new GetVisitor();
         m.walkInOptimizedOrder(getVisitor, 1, rows - 2, 1, columns - 2);
@@ -1182,13 +1182,13 @@
             assertEquals(new Fraction(0), m.getEntry(rows - 1, j));
         }
 
-        m = new DenseFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
+        m = new BlockFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
         m.walkInColumnOrder(new SetVisitor());
         getVisitor = new GetVisitor();
         m.walkInOptimizedOrder(getVisitor);
         assertEquals(rows * columns, getVisitor.getCount());
 
-        m = new DenseFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
+        m = new BlockFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
         m.walkInColumnOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2);
         getVisitor = new GetVisitor();
         m.walkInOptimizedOrder(getVisitor, 1, rows - 2, 1, columns - 2);
@@ -1202,13 +1202,13 @@
             assertEquals(new Fraction(0), m.getEntry(rows - 1, j));
         }
 
-        m = new DenseFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
+        m = new BlockFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
         m.walkInOptimizedOrder(new SetVisitor());
         getVisitor = new GetVisitor();
         m.walkInRowOrder(getVisitor);
         assertEquals(rows * columns, getVisitor.getCount());
 
-        m = new DenseFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
+        m = new BlockFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
         m.walkInOptimizedOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2);
         getVisitor = new GetVisitor();
         m.walkInRowOrder(getVisitor, 1, rows - 2, 1, columns - 2);
@@ -1222,13 +1222,13 @@
             assertEquals(new Fraction(0), m.getEntry(rows - 1, j));
         }
 
-        m = new DenseFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
+        m = new BlockFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
         m.walkInOptimizedOrder(new SetVisitor());
         getVisitor = new GetVisitor();
         m.walkInColumnOrder(getVisitor);
         assertEquals(rows * columns, getVisitor.getCount());
 
-        m = new DenseFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
+        m = new BlockFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
         m.walkInOptimizedOrder(new SetVisitor(), 1, rows - 2, 1, columns - 2);
         getVisitor = new GetVisitor();
         m.walkInColumnOrder(getVisitor, 1, rows - 2, 1, columns - 2);
@@ -1245,7 +1245,7 @@
     }
 
     public void testSerial()  {
-        DenseFieldMatrix<Fraction> m = new DenseFieldMatrix<Fraction>(testData);
+        BlockFieldMatrix<Fraction> m = new BlockFieldMatrix<Fraction>(testData);
         assertEquals(m,TestUtils.serializeAndRecover(m));
     }
 
@@ -1275,9 +1275,9 @@
         }
     }
 
-    private DenseFieldMatrix<Fraction> createRandomMatrix(Random r, int rows, int columns) {
-        DenseFieldMatrix<Fraction> m =
-            new DenseFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
+    private BlockFieldMatrix<Fraction> createRandomMatrix(Random r, int rows, int columns) {
+        BlockFieldMatrix<Fraction> m =
+            new BlockFieldMatrix<Fraction>(FractionField.getInstance(), rows, columns);
         for (int i = 0; i < rows; ++i) {
             for (int j = 0; j < columns; ++j) {
                 int p = r.nextInt(20) - 10;



Mime
View raw message