commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1001107 [1/2] - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/exception/ main/java/org/apache/commons/math/exception/util/ main/java/org/apache/commons/math/linear/ main/resources/META-INF/localization/ site/xdoc/ te...
Date Fri, 24 Sep 2010 23:12:35 GMT
Author: erans
Date: Fri Sep 24 23:12:34 2010
New Revision: 1001107

URL: http://svn.apache.org/viewvc?rev=1001107&view=rev
Log:
Introduced "MatrixDimensionMismatchException" to replace "InvalidMatrixException"
whenever it was used to signal a row or column dimension mismatch.
"MessageFactory": Fixed wrong order of appearance of general and specific messages.

Added:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MatrixDimensionMismatchException.java   (with props)
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java   (with props)
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/exception/MatrixDimensionMismatchExceptionTest.java   (with props)
Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/DimensionMismatchException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/MessageFactory.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockRealMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/InvalidMatrixException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrix.java
    commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
    commons/proper/math/trunk/src/site/xdoc/changes.xml
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.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/BlockRealMatrixTest.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/RealMatrixImplTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/DimensionMismatchException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/DimensionMismatchException.java?rev=1001107&r1=1001106&r2=1001107&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/DimensionMismatchException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/DimensionMismatchException.java Fri Sep 24 23:12:34 2010
@@ -40,7 +40,9 @@ public class DimensionMismatchException 
      */
     public DimensionMismatchException(int wrong,
                                       int expected) {
-        super(LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, wrong, expected);
+        super(LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE,
+              LocalizedFormats.DIMENSIONS_MISMATCH,
+              wrong, expected);
         dimension = expected;
     }
 

Added: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MatrixDimensionMismatchException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MatrixDimensionMismatchException.java?rev=1001107&view=auto
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MatrixDimensionMismatchException.java (added)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MatrixDimensionMismatchException.java Fri Sep 24 23:12:34 2010
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math.exception;
+
+import org.apache.commons.math.exception.util.LocalizedFormats;
+
+/**
+ * Exception to be thrown when either the number of rows or the number of
+ * columns of a matrix do not match the expected values.
+ *
+ * @since 3.0
+ * @version $Revision$ $Date$
+ */
+public class MatrixDimensionMismatchException extends MultiDimensionMismatchException {
+    /** Serializable version Id. */
+    private static final long serialVersionUID = -8415396756375798143L;
+
+    /**
+     * Construct an exception from the mismatched dimensions.
+     *
+     * @param wrongRowDim Wrong row dimension.
+     * @param wrongColDim Wrong column dimension.
+     * @param expectedRowDim Expected row dimension.
+     * @param expectedColDim Expected column dimension.
+     */
+    public MatrixDimensionMismatchException(int wrongRowDim,
+                                            int wrongColDim,
+                                            int expectedRowDim,
+                                            int expectedColDim) {
+        super(LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
+              new Integer[] { wrongRowDim, wrongColDim },
+              new Integer[] { expectedRowDim, expectedColDim });
+    }
+
+    /**
+     * @return the expected row dimension.
+     */
+    public int getWrongRowDimension() {
+        return getWrongDimensions()[0];
+    }
+    /**
+     * @return the expected row dimension.
+     */
+    public int getExpectedRowDimension() {
+        return getExpectedDimensions()[0];
+    }
+    /**
+     * @return the wrong column dimension.
+     */
+    public int getWrongColumnDimension() {
+        return getWrongDimensions()[1];
+    }
+    /**
+     * @return the expected column dimension.
+     */
+    public int getExpectedColumnDimension() {
+        return getExpectedDimensions()[1];
+    }
+}

Propchange: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MatrixDimensionMismatchException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java?rev=1001107&view=auto
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java (added)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java Fri Sep 24 23:12:34 2010
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math.exception;
+
+import org.apache.commons.math.exception.util.Localizable;
+import org.apache.commons.math.exception.util.LocalizedFormats;
+
+/**
+ * Exception to be thrown when two sets of dimensions differ.
+ *
+ * @since 3.0
+ * @version $Revision$ $Date$
+ */
+public class MultiDimensionMismatchException extends MathIllegalArgumentException {
+    /** Serializable version Id. */
+    private static final long serialVersionUID = -8415396756375798143L;
+
+    /** Wrong dimensions. */
+    private final Integer[] wrong;
+    /** Correct dimensions. */
+    private final Integer[] expected;
+
+    /**
+     * Construct an exception from the mismatched dimensions.
+     *
+     * @param wrong Wrong dimensionq.
+     * @param expected Expected dimensionq.
+     */
+    public MultiDimensionMismatchException(Integer[] wrong,
+                                           Integer[] expected) {
+        this(null, wrong, expected);
+    }
+
+    /**
+     * Construct an exception from the mismatched dimensions.
+     *
+     * @param specific Message pattern providing the specific context of
+     * the error.
+     * @param wrong Wrong dimensions.
+     * @param expected Expected dimensions.
+     */
+    public MultiDimensionMismatchException(Localizable specific,
+                                           Integer[] wrong,
+                                           Integer[] expected) {
+        super(specific, LocalizedFormats.DIMENSIONS_MISMATCH, wrong, expected);
+        this.wrong = wrong.clone();
+        this.expected = expected.clone();
+    }
+
+    /**
+     * @return a reference to the array containing the wrong dimensions.
+     */
+    public Integer[] getWrongDimensions() {
+        return wrong;
+    }
+    /**
+     * @return a reference to the array containing the expected dimensions.
+     */
+    public Integer[] getExpectedDimensions() {
+        return expected;
+    }
+}

Propchange: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MultiDimensionMismatchException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java?rev=1001107&r1=1001106&r2=1001107&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java Fri Sep 24 23:12:34 2010
@@ -79,8 +79,9 @@ public enum LocalizedFormats implements 
     CUMULATIVE_PROBABILITY_RETURNED_NAN("Cumulative probability function returned NaN for argument {0} p = {1}"),
     DIFFERENT_ROWS_LENGTHS("some rows have length {0} while others have length {1}"),
     DIGEST_NOT_INITIALIZED("digest not initialized"),
-    DIMENSIONS_MISMATCH_2x2("dimensions mismatch: got {0}x{1} but expected {2}x{3}"),
-    DIMENSIONS_MISMATCH_SIMPLE("dimensions mismatch {0} != {1}"), /* keep */
+    DIMENSIONS_MISMATCH_2x2("got {0}x{1} but expected {2}x{3}"), /* keep */
+    DIMENSIONS_MISMATCH_SIMPLE("{0} != {1}"), /* keep */
+    DIMENSIONS_MISMATCH("dimensions mismatch"), /* keep */
     DISCRETE_CUMULATIVE_PROBABILITY_RETURNED_NAN("Discrete cumulative probability function returned NaN for argument {0}"),
     DISTRIBUTION_NOT_LOADED("distribution not loaded"),
     DUPLICATED_ABSCISSA("Abscissa {0} is duplicated at both indices {1} and {2}"),

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/MessageFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/MessageFactory.java?rev=1001107&r1=1001106&r2=1001107&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/MessageFactory.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/MessageFactory.java Fri Sep 24 23:12:34 2010
@@ -63,13 +63,13 @@ public class MessageFactory {
                                       Object ... arguments) {
         final StringBuilder sb = new StringBuilder();
         MessageFormat fmt = null;
+        fmt = new MessageFormat(general.getLocalizedString(locale), locale);
+        sb.append(fmt.format(arguments));
         if (specific != null) {
+            sb.append(": ");
             fmt = new MessageFormat(specific.getLocalizedString(locale), locale);
             sb.append(fmt.format(arguments));
-            sb.append(": ");
         }
-        fmt = new MessageFormat(general.getLocalizedString(locale), locale);
-        sb.append(fmt.format(arguments));
 
         return sb.toString();
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java?rev=1001107&r1=1001106&r2=1001107&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractFieldMatrix.java Fri Sep 24 23:12:34 2010
@@ -23,6 +23,7 @@ import java.util.Arrays;
 import org.apache.commons.math.Field;
 import org.apache.commons.math.FieldElement;
 import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.MatrixDimensionMismatchException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 
 /**
@@ -445,16 +446,14 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public void setRowMatrix(final int row, final FieldMatrix<T> matrix)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setRowMatrix(final int row, final FieldMatrix<T> matrix) {
         checkRowIndex(row);
         final int nCols = getColumnDimension();
         if ((matrix.getRowDimension() != 1) ||
             (matrix.getColumnDimension() != nCols)) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    matrix.getRowDimension(), matrix.getColumnDimension(), 1, nCols);
+            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
+                                                       matrix.getColumnDimension(),
+                                                       1, nCols);
         }
         for (int i = 0; i < nCols; ++i) {
             setEntry(row, i, matrix.getEntry(0, i));
@@ -478,16 +477,14 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public void setColumnMatrix(final int column, final FieldMatrix<T> matrix)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setColumnMatrix(final int column, final FieldMatrix<T> matrix) {
         checkColumnIndex(column);
         final int nRows = getRowDimension();
         if ((matrix.getRowDimension() != nRows) ||
             (matrix.getColumnDimension() != 1)) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    matrix.getRowDimension(), matrix.getColumnDimension(), nRows, 1);
+            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
+                                                       matrix.getColumnDimension(),
+                                                       nRows, 1);
         }
         for (int i = 0; i < nRows; ++i) {
             setEntry(i, column, matrix.getEntry(i, 0));
@@ -502,15 +499,12 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public void setRowVector(final int row, final FieldVector<T> vector)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setRowVector(final int row, final FieldVector<T> vector) {
         checkRowIndex(row);
         final int nCols = getColumnDimension();
         if (vector.getDimension() != nCols) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    1, vector.getDimension(), 1, nCols);
+            throw new MatrixDimensionMismatchException(1, vector.getDimension(),
+                                                       1, nCols);
         }
         for (int i = 0; i < nCols; ++i) {
             setEntry(row, i, vector.getEntry(i));
@@ -525,15 +519,12 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public void setColumnVector(final int column, final FieldVector<T> vector)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setColumnVector(final int column, final FieldVector<T> vector) {
         checkColumnIndex(column);
         final int nRows = getRowDimension();
         if (vector.getDimension() != nRows) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    vector.getDimension(), 1, nRows, 1);
+            throw new MatrixDimensionMismatchException(vector.getDimension(), 1,
+                                                       nRows, 1);
         }
         for (int i = 0; i < nRows; ++i) {
             setEntry(i, column, vector.getEntry(i));
@@ -557,15 +548,11 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public void setRow(final int row, final T[] array)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setRow(final int row, final T[] array) {
         checkRowIndex(row);
         final int nCols = getColumnDimension();
         if (array.length != nCols) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    1, array.length, 1, nCols);
+            throw new MatrixDimensionMismatchException(1, array.length, 1, nCols);
         }
         for (int i = 0; i < nCols; ++i) {
             setEntry(row, i, array[i]);
@@ -589,20 +576,15 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public void setColumn(final int column, final T[] array)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setColumn(final int column, final T[] array) {
         checkColumnIndex(column);
         final int nRows = getRowDimension();
         if (array.length != nRows) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    array.length, 1, nRows, 1);
+            throw new MatrixDimensionMismatchException(array.length, 1, nRows, 1);
         }
         for (int i = 0; i < nRows; ++i) {
             setEntry(i, column, array[i]);
         }
-
     }
 
     /** {@inheritDoc} */
@@ -623,22 +605,18 @@ public abstract class AbstractFieldMatri
 
     /** {@inheritDoc} */
     public FieldMatrix<T> transpose() {
-
         final int nRows = getRowDimension();
         final int nCols = getColumnDimension();
         final FieldMatrix<T> out = createMatrix(nCols, nRows);
         walkInOptimizedOrder(new DefaultFieldMatrixPreservingVisitor<T>(field.getZero()) {
-
             /** {@inheritDoc} */
             @Override
             public void visit(final int row, final int column, final T value) {
                 out.setEntry(column, row, value);
             }
-
         });
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -689,7 +667,6 @@ public abstract class AbstractFieldMatri
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -741,7 +718,6 @@ public abstract class AbstractFieldMatri
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -769,7 +745,6 @@ public abstract class AbstractFieldMatri
             }
 
             return new ArrayFieldVector<T>(out);
-
         }
     }
 
@@ -958,7 +933,6 @@ public abstract class AbstractFieldMatri
 
         res.append("}");
         return res.toString();
-
     }
 
     /**
@@ -1063,8 +1037,6 @@ public abstract class AbstractFieldMatri
             throw new MatrixIndexException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN,
                                            startColumn, endColumn);
         }
-
-
     }
 
     /**
@@ -1134,5 +1106,4 @@ public abstract class AbstractFieldMatri
                     m.getRowDimension(), m.getColumnDimension());
         }
     }
-
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java?rev=1001107&r1=1001106&r2=1001107&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealMatrix.java Fri Sep 24 23:12:34 2010
@@ -17,7 +17,10 @@
 
 package org.apache.commons.math.linear;
 
-import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.NoDataException;
+import org.apache.commons.math.exception.NotStrictlyPositiveException;
+import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.MatrixDimensionMismatchException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
 import org.apache.commons.math.util.FastMath;
@@ -51,17 +54,14 @@ public abstract class AbstractRealMatrix
      *
      * @param rowDimension  the number of rows in the new matrix
      * @param columnDimension  the number of columns in the new matrix
-     * @throws IllegalArgumentException if row or column dimension is not positive
+     * @throws NotStrictlyPositiveException if row or column dimension is not positive
      */
-    protected AbstractRealMatrix(final int rowDimension, final int columnDimension)
-        throws IllegalArgumentException {
-        if (rowDimension < 1 ) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.INSUFFICIENT_DIMENSION, rowDimension, 1);
-        }
-        if (columnDimension <= 0) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.INSUFFICIENT_DIMENSION, columnDimension, 1);
+    protected AbstractRealMatrix(final int rowDimension, final int columnDimension) {
+        if (rowDimension < 1) {
+            throw new NotStrictlyPositiveException(rowDimension);
+        }
+        if (columnDimension < 1) {
+            throw new NotStrictlyPositiveException(columnDimension);
         }
         lu = null;
     }
@@ -89,7 +89,6 @@ public abstract class AbstractRealMatrix
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -108,7 +107,6 @@ public abstract class AbstractRealMatrix
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -124,7 +122,6 @@ public abstract class AbstractRealMatrix
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -140,7 +137,6 @@ public abstract class AbstractRealMatrix
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -165,7 +161,6 @@ public abstract class AbstractRealMatrix
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -187,7 +182,6 @@ public abstract class AbstractRealMatrix
         }
 
         return data;
-
     }
 
     /** {@inheritDoc} */
@@ -225,7 +219,6 @@ public abstract class AbstractRealMatrix
             public double end() {
                 return maxColSum;
             }
-
         });
     }
 
@@ -252,7 +245,6 @@ public abstract class AbstractRealMatrix
             public double end() {
                 return FastMath.sqrt(sum);
             }
-
         });
     }
 
@@ -272,7 +264,6 @@ public abstract class AbstractRealMatrix
         }
 
         return subMatrix;
-
     }
 
     /** {@inheritDoc} */
@@ -296,7 +287,6 @@ public abstract class AbstractRealMatrix
         });
 
         return subMatrix;
-
     }
 
     /** {@inheritDoc} */
@@ -310,10 +300,8 @@ public abstract class AbstractRealMatrix
         final int rowsCount    = endRow + 1 - startRow;
         final int columnsCount = endColumn + 1 - startColumn;
         if ((destination.length < rowsCount) || (destination[0].length < columnsCount)) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    destination.length, destination[0].length,
-                    rowsCount, columnsCount);
+            throw new MatrixDimensionMismatchException(destination.length, destination[0].length,
+                                                       rowsCount, columnsCount);
         }
 
         // copy entries
@@ -341,21 +329,17 @@ public abstract class AbstractRealMatrix
             }
 
         }, startRow, endRow, startColumn, endColumn);
-
     }
 
     /** {@inheritDoc} */
-    public void copySubMatrix(int[] selectedRows, int[] selectedColumns, double[][] destination)
-        throws MatrixIndexException, IllegalArgumentException {
+    public void copySubMatrix(int[] selectedRows, int[] selectedColumns, double[][] destination) {
 
         // safety checks
         MatrixUtils.checkSubMatrixIndex(this, selectedRows, selectedColumns);
         if ((destination.length < selectedRows.length) ||
             (destination[0].length < selectedColumns.length)) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    destination.length, destination[0].length,
-                    selectedRows.length, selectedColumns.length);
+            throw new MatrixDimensionMismatchException(destination.length, destination[0].length,
+                                                       selectedRows.length, selectedColumns.length);
         }
 
         // copy entries
@@ -365,7 +349,6 @@ public abstract class AbstractRealMatrix
                 destinationI[j] = getEntry(selectedRows[i], selectedColumns[j]);
             }
         }
-
     }
 
     /** {@inheritDoc} */
@@ -374,19 +357,17 @@ public abstract class AbstractRealMatrix
 
         final int nRows = subMatrix.length;
         if (nRows == 0) {
-            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
+            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
         }
 
         final int nCols = subMatrix[0].length;
         if (nCols == 0) {
-            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
+            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
         }
 
         for (int r = 1; r < nRows; ++r) {
             if (subMatrix[r].length != nCols) {
-                throw MathRuntimeException.createIllegalArgumentException(
-                        LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
-                        nCols, subMatrix[r].length);
+                throw new DimensionMismatchException(nCols, subMatrix[r].length);
             }
         }
 
@@ -402,7 +383,6 @@ public abstract class AbstractRealMatrix
         }
 
         lu = null;
-
     }
 
     /** {@inheritDoc} */
@@ -417,25 +397,21 @@ public abstract class AbstractRealMatrix
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
-    public void setRowMatrix(final int row, final RealMatrix matrix)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setRowMatrix(final int row, final RealMatrix matrix) {
         MatrixUtils.checkRowIndex(this, row);
         final int nCols = getColumnDimension();
         if ((matrix.getRowDimension() != 1) ||
             (matrix.getColumnDimension() != nCols)) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    matrix.getRowDimension(), matrix.getColumnDimension(), 1, nCols);
+            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
+                                                       matrix.getColumnDimension(),
+                                                       1, nCols);
         }
         for (int i = 0; i < nCols; ++i) {
             setEntry(row, i, matrix.getEntry(0, i));
         }
-
     }
 
     /** {@inheritDoc} */
@@ -450,25 +426,21 @@ public abstract class AbstractRealMatrix
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
-    public void setColumnMatrix(final int column, final RealMatrix matrix)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setColumnMatrix(final int column, final RealMatrix matrix) {
         MatrixUtils.checkColumnIndex(this, column);
         final int nRows = getRowDimension();
         if ((matrix.getRowDimension() != nRows) ||
             (matrix.getColumnDimension() != 1)) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    matrix.getRowDimension(), matrix.getColumnDimension(), nRows, 1);
+            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
+                                                       matrix.getColumnDimension(),
+                                                       nRows, 1);
         }
         for (int i = 0; i < nRows; ++i) {
             setEntry(i, column, matrix.getEntry(i, 0));
         }
-
     }
 
     /** {@inheritDoc} */
@@ -478,20 +450,16 @@ public abstract class AbstractRealMatrix
     }
 
     /** {@inheritDoc} */
-    public void setRowVector(final int row, final RealVector vector)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setRowVector(final int row, final RealVector vector) {
         MatrixUtils.checkRowIndex(this, row);
         final int nCols = getColumnDimension();
         if (vector.getDimension() != nCols) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    1, vector.getDimension(), 1, nCols);
+            throw new MatrixDimensionMismatchException(1, vector.getDimension(),
+                                                       1, nCols);
         }
         for (int i = 0; i < nCols; ++i) {
             setEntry(row, i, vector.getEntry(i));
         }
-
     }
 
     /** {@inheritDoc} */
@@ -501,20 +469,16 @@ public abstract class AbstractRealMatrix
     }
 
     /** {@inheritDoc} */
-    public void setColumnVector(final int column, final RealVector vector)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setColumnVector(final int column, final RealVector vector) {
         MatrixUtils.checkColumnIndex(this, column);
         final int nRows = getRowDimension();
         if (vector.getDimension() != nRows) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    vector.getDimension(), 1, nRows, 1);
+            throw new MatrixDimensionMismatchException(vector.getDimension(), 1,
+                                                       nRows, 1);
         }
         for (int i = 0; i < nRows; ++i) {
             setEntry(i, column, vector.getEntry(i));
         }
-
     }
 
     /** {@inheritDoc} */
@@ -529,24 +493,18 @@ public abstract class AbstractRealMatrix
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
-    public void setRow(final int row, final double[] array)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setRow(final int row, final double[] array) {
         MatrixUtils.checkRowIndex(this, row);
         final int nCols = getColumnDimension();
         if (array.length != nCols) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    1, array.length, 1, nCols);
+            throw new MatrixDimensionMismatchException(1, array.length, 1, nCols);
         }
         for (int i = 0; i < nCols; ++i) {
             setEntry(row, i, array[i]);
         }
-
     }
 
     /** {@inheritDoc} */
@@ -561,24 +519,18 @@ public abstract class AbstractRealMatrix
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
-    public void setColumn(final int column, final double[] array)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setColumn(final int column, final double[] array) {
         MatrixUtils.checkColumnIndex(this, column);
         final int nRows = getRowDimension();
         if (array.length != nRows) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    array.length, 1, nRows, 1);
+            throw new MatrixDimensionMismatchException(array.length, 1, nRows, 1);
         }
         for (int i = 0; i < nRows; ++i) {
             setEntry(i, column, array[i]);
         }
-
     }
 
     /** {@inheritDoc} */
@@ -614,7 +566,6 @@ public abstract class AbstractRealMatrix
         });
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -676,9 +627,7 @@ public abstract class AbstractRealMatrix
         final int nRows = getRowDimension();
         final int nCols = getColumnDimension();
         if (v.length != nCols) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
-                    v.length, nCols);
+            throw new DimensionMismatchException(v.length, nCols);
         }
 
         final double[] out = new double[nRows];
@@ -691,7 +640,6 @@ public abstract class AbstractRealMatrix
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -703,9 +651,7 @@ public abstract class AbstractRealMatrix
             final int nRows = getRowDimension();
             final int nCols = getColumnDimension();
             if (v.getDimension() != nCols) {
-                throw MathRuntimeException.createIllegalArgumentException(
-                        LocalizedFormats.VECTOR_LENGTH_MISMATCH,
-                        v.getDimension(), nCols);
+                throw new DimensionMismatchException(v.getDimension(), nCols);
             }
 
             final double[] out = new double[nRows];
@@ -728,9 +674,7 @@ public abstract class AbstractRealMatrix
         final int nRows = getRowDimension();
         final int nCols = getColumnDimension();
         if (v.length != nRows) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
-                    v.length, nRows);
+            throw new DimensionMismatchException(v.length, nRows);
         }
 
         final double[] out = new double[nCols];
@@ -743,7 +687,6 @@ public abstract class AbstractRealMatrix
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -756,9 +699,7 @@ public abstract class AbstractRealMatrix
             final int nRows = getRowDimension();
             final int nCols = getColumnDimension();
             if (v.getDimension() != nRows) {
-                throw MathRuntimeException.createIllegalArgumentException(
-                        LocalizedFormats.VECTOR_LENGTH_MISMATCH,
-                        v.getDimension(), nRows);
+                throw new DimensionMismatchException(v.getDimension(), nRows);
             }
 
             final double[] out = new double[nCols];
@@ -771,7 +712,6 @@ public abstract class AbstractRealMatrix
             }
 
             return new ArrayRealVector(out);
-
         }
     }
 
@@ -1011,7 +951,6 @@ public abstract class AbstractRealMatrix
 
         res.append("}");
         return res.toString();
-
     }
 
     /**
@@ -1066,5 +1005,4 @@ public abstract class AbstractRealMatrix
         }
         return ret;
     }
-
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java?rev=1001107&r1=1001106&r2=1001107&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockFieldMatrix.java Fri Sep 24 23:12:34 2010
@@ -21,7 +21,9 @@ import java.io.Serializable;
 
 import org.apache.commons.math.Field;
 import org.apache.commons.math.FieldElement;
-import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.NoDataException;
+import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.MatrixDimensionMismatchException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.FastMath;
 
@@ -171,9 +173,8 @@ public class BlockFieldMatrix<T extends 
             final int iHeight = blockHeight(iBlock);
             for (int jBlock = 0; jBlock < blockColumns; ++jBlock, ++index) {
                 if (blockData[index].length != iHeight * blockWidth(jBlock)) {
-                    throw MathRuntimeException.createIllegalArgumentException(
-                            LocalizedFormats.WRONG_BLOCK_LENGTH,
-                            blockData[index].length, iHeight * blockWidth(jBlock));
+                    throw new DimensionMismatchException(blockData[index].length,
+                                                         iHeight * blockWidth(jBlock));
                 }
                 if (copyArray) {
                     blocks[index] = blockData[index].clone();
@@ -219,9 +220,7 @@ public class BlockFieldMatrix<T extends 
         for (int i = 0; i < rawData.length; ++i) {
             final int length = rawData[i].length;
             if (length != columns) {
-                throw MathRuntimeException.createIllegalArgumentException(
-                        LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
-                        columns, length);
+                throw new DimensionMismatchException(columns, length);
             }
         }
 
@@ -810,17 +809,15 @@ public class BlockFieldMatrix<T extends 
 
         // safety checks
         final int refLength = subMatrix[0].length;
-        if (refLength < 1) {
-            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
+        if (refLength == 0) {
+            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
         }
         final int endRow    = row + subMatrix.length - 1;
         final int endColumn = column + refLength - 1;
         checkSubMatrixIndex(row, endRow, column, endColumn);
         for (final T[] subRow : subMatrix) {
             if (subRow.length != refLength) {
-                throw MathRuntimeException.createIllegalArgumentException(
-                        LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
-                        refLength, subRow.length);
+                throw new DimensionMismatchException(refLength, subRow.length);
             }
         }
 
@@ -891,8 +888,7 @@ public class BlockFieldMatrix<T extends 
 
     /** {@inheritDoc} */
     @Override
-    public void setRowMatrix(final int row, final FieldMatrix<T> matrix)
-        throws MatrixIndexException, InvalidMatrixException {
+    public void setRowMatrix(final int row, final FieldMatrix<T> matrix) {
         try {
             setRowMatrix(row, (BlockFieldMatrix<T>) matrix);
         } catch (ClassCastException cce) {
@@ -908,20 +904,17 @@ public class BlockFieldMatrix<T extends 
      * @param matrix row matrix (must have one row and the same number of columns
      * as the instance)
      * @throws MatrixIndexException if the specified row index is invalid
-     * @throws InvalidMatrixException if the matrix dimensions do not match one
+     * @throws MatrixDimensionMismatchException if the matrix dimensions do not match one
      * instance row
      */
-    public void setRowMatrix(final int row, final BlockFieldMatrix<T> matrix)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setRowMatrix(final int row, final BlockFieldMatrix<T> matrix) {
         checkRowIndex(row);
         final int nCols = getColumnDimension();
         if ((matrix.getRowDimension() != 1) ||
             (matrix.getColumnDimension() != nCols)) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    matrix.getRowDimension(), matrix.getColumnDimension(),
-                    1, nCols);
+            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
+                                                       matrix.getColumnDimension(),
+                                                       1, nCols);
         }
 
         // perform copy block-wise, to ensure good cache behavior
@@ -980,8 +973,7 @@ public class BlockFieldMatrix<T extends 
 
     /** {@inheritDoc} */
     @Override
-    public void setColumnMatrix(final int column, final FieldMatrix<T> matrix)
-        throws MatrixIndexException, InvalidMatrixException {
+    public void setColumnMatrix(final int column, final FieldMatrix<T> matrix) {
         try {
             setColumnMatrix(column, (BlockFieldMatrix<T>) matrix);
         } catch (ClassCastException cce) {
@@ -997,20 +989,17 @@ public class BlockFieldMatrix<T extends 
      * @param matrix column matrix (must have one column and the same number of rows
      * as the instance)
      * @throws MatrixIndexException if the specified column index is invalid
-     * @throws InvalidMatrixException if the matrix dimensions do not match one
+     * @throws MatrixDimensionMismatchException if the matrix dimensions do not match one
      * instance column
      */
-    void setColumnMatrix(final int column, final BlockFieldMatrix<T> matrix)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    void setColumnMatrix(final int column, final BlockFieldMatrix<T> matrix) {
         checkColumnIndex(column);
         final int nRows = getRowDimension();
         if ((matrix.getRowDimension() != nRows) ||
             (matrix.getColumnDimension() != 1)) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    matrix.getRowDimension(), matrix.getColumnDimension(),
-                    nRows, 1);
+            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
+                                                       matrix.getColumnDimension(),
+                                                       nRows, 1);
         }
 
         // perform copy block-wise, to ensure good cache behavior
@@ -1031,7 +1020,6 @@ public class BlockFieldMatrix<T extends 
                 block[i * jWidth + jColumn] = mBlock[mIndex++];
             }
         }
-
     }
 
     /** {@inheritDoc} */
@@ -1059,8 +1047,7 @@ public class BlockFieldMatrix<T extends 
 
     /** {@inheritDoc} */
     @Override
-    public void setRowVector(final int row, final FieldVector<T> vector)
-        throws MatrixIndexException, InvalidMatrixException {
+    public void setRowVector(final int row, final FieldVector<T> vector) {
         try {
             setRow(row, ((ArrayFieldVector<T>) vector).getDataRef());
         } catch (ClassCastException cce) {
@@ -1095,8 +1082,7 @@ public class BlockFieldMatrix<T extends 
 
     /** {@inheritDoc} */
     @Override
-    public void setColumnVector(final int column, final FieldVector<T> vector)
-        throws MatrixIndexException, InvalidMatrixException {
+    public void setColumnVector(final int column, final FieldVector<T> vector) {
         try {
             setColumn(column, ((ArrayFieldVector<T>) vector).getDataRef());
         } catch (ClassCastException cce) {
@@ -1129,15 +1115,11 @@ public class BlockFieldMatrix<T extends 
 
     /** {@inheritDoc} */
     @Override
-    public void setRow(final int row, final T[] array)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setRow(final int row, final T[] array) {
         checkRowIndex(row);
         final int nCols = getColumnDimension();
         if (array.length != nCols) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    1, array.length, 1, nCols);
+            throw new MatrixDimensionMismatchException(1, array.length, 1, nCols);
         }
 
         // perform copy block-wise, to ensure good cache behavior
@@ -1150,7 +1132,6 @@ public class BlockFieldMatrix<T extends 
             System.arraycopy(array, outIndex, block, iRow * jWidth, jWidth);
             outIndex += jWidth;
         }
-
     }
 
     /** {@inheritDoc} */
@@ -1175,20 +1156,15 @@ public class BlockFieldMatrix<T extends 
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
     @Override
-    public void setColumn(final int column, final T[] array)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setColumn(final int column, final T[] array) {
         checkColumnIndex(column);
         final int nRows = getRowDimension();
         if (array.length != nRows) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    array.length, 1, nRows, 1);
+            throw new MatrixDimensionMismatchException(array.length, 1, nRows, 1);
         }
 
         // perform copy block-wise, to ensure good cache behavior
@@ -1203,7 +1179,6 @@ public class BlockFieldMatrix<T extends 
                 block[i * jWidth + jColumn] = array[outIndex++];
             }
         }
-
     }
 
     /** {@inheritDoc} */
@@ -1314,7 +1289,6 @@ public class BlockFieldMatrix<T extends 
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -1335,9 +1309,7 @@ public class BlockFieldMatrix<T extends 
         throws IllegalArgumentException {
 
         if (v.length != columns) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
-                    v.length, columns);
+            throw new DimensionMismatchException(v.length, columns);
         }
         final T[] out = buildArray(getField(), rows);
         final T zero = getField().getZero();
@@ -1372,7 +1344,6 @@ public class BlockFieldMatrix<T extends 
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -1381,9 +1352,7 @@ public class BlockFieldMatrix<T extends 
         throws IllegalArgumentException {
 
         if (v.length != rows) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
-                    v.length, rows);
+            throw new DimensionMismatchException(v.length, rows);
         }
         final T[] out = buildArray(getField(), columns);
         final T zero = getField().getZero();
@@ -1423,7 +1392,6 @@ public class BlockFieldMatrix<T extends 
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -1665,5 +1633,4 @@ public class BlockFieldMatrix<T extends 
     private int blockWidth(final int blockColumn) {
         return (blockColumn == blockColumns - 1) ? columns - blockColumn * BLOCK_SIZE : BLOCK_SIZE;
     }
-
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockRealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockRealMatrix.java?rev=1001107&r1=1001106&r2=1001107&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockRealMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/BlockRealMatrix.java Fri Sep 24 23:12:34 2010
@@ -20,7 +20,9 @@ package org.apache.commons.math.linear;
 import java.io.Serializable;
 import java.util.Arrays;
 
-import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.exception.MatrixDimensionMismatchException;
+import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.NoDataException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.FastMath;
 
@@ -168,16 +170,14 @@ public class BlockRealMatrix extends Abs
             final int iHeight = blockHeight(iBlock);
             for (int jBlock = 0; jBlock < blockColumns; ++jBlock, ++index) {
                 if (blockData[index].length != iHeight * blockWidth(jBlock)) {
-                    throw MathRuntimeException.createIllegalArgumentException(
-                            LocalizedFormats.WRONG_BLOCK_LENGTH,
-                            blockData[index].length, iHeight * blockWidth(jBlock));
+                    throw new DimensionMismatchException(blockData[index].length,
+                                                         iHeight * blockWidth(jBlock));
                 }
                 if (copyArray) {
                     blocks[index] = blockData[index].clone();
                 }
             }
         }
-
     }
 
     /**
@@ -214,9 +214,7 @@ public class BlockRealMatrix extends Abs
         for (int i = 0; i < rawData.length; ++i) {
             final int length = rawData[i].length;
             if (length != columns) {
-                throw MathRuntimeException.createIllegalArgumentException(
-                        LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
-                        columns, length);
+                throw new DimensionMismatchException(columns, length);
             }
         }
 
@@ -249,7 +247,6 @@ public class BlockRealMatrix extends Abs
         }
 
         return blocks;
-
     }
 
     /**
@@ -285,7 +282,6 @@ public class BlockRealMatrix extends Abs
         }
 
         return blocks;
-
     }
 
     /** {@inheritDoc} */
@@ -308,7 +304,6 @@ public class BlockRealMatrix extends Abs
         }
 
         return copied;
-
     }
 
     /** {@inheritDoc} */
@@ -351,7 +346,6 @@ public class BlockRealMatrix extends Abs
             }
 
             return out;
-
         }
     }
 
@@ -381,7 +375,6 @@ public class BlockRealMatrix extends Abs
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -424,7 +417,6 @@ public class BlockRealMatrix extends Abs
             }
 
             return out;
-
         }
     }
 
@@ -454,7 +446,6 @@ public class BlockRealMatrix extends Abs
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -474,7 +465,6 @@ public class BlockRealMatrix extends Abs
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -494,7 +484,6 @@ public class BlockRealMatrix extends Abs
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -554,7 +543,6 @@ public class BlockRealMatrix extends Abs
             }
 
             return out;
-
         }
     }
 
@@ -627,7 +615,6 @@ public class BlockRealMatrix extends Abs
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -657,7 +644,6 @@ public class BlockRealMatrix extends Abs
         }
 
         return data;
-
     }
 
     /** {@inheritDoc} */
@@ -796,7 +782,6 @@ public class BlockRealMatrix extends Abs
         }
 
         return out;
-
     }
 
     /**
@@ -836,17 +821,15 @@ public class BlockRealMatrix extends Abs
 
         // safety checks
         final int refLength = subMatrix[0].length;
-        if (refLength < 1) {
-            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
+        if (refLength == 0) {
+            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
         }
         final int endRow    = row + subMatrix.length - 1;
         final int endColumn = column + refLength - 1;
         MatrixUtils.checkSubMatrixIndex(this, row, endRow, column, endColumn);
         for (final double[] subRow : subMatrix) {
             if (subRow.length != refLength) {
-                throw MathRuntimeException.createIllegalArgumentException(
-                        LocalizedFormats.DIFFERENT_ROWS_LENGTHS,
-                        refLength, subRow.length);
+                throw new DimensionMismatchException(refLength, subRow.length);
             }
         }
 
@@ -912,13 +895,11 @@ public class BlockRealMatrix extends Abs
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
     @Override
-    public void setRowMatrix(final int row, final RealMatrix matrix)
-        throws MatrixIndexException, InvalidMatrixException {
+    public void setRowMatrix(final int row, final RealMatrix matrix) {
         try {
             setRowMatrix(row, (BlockRealMatrix) matrix);
         } catch (ClassCastException cce) {
@@ -934,20 +915,17 @@ public class BlockRealMatrix extends Abs
      * @param matrix row matrix (must have one row and the same number of columns
      * as the instance)
      * @throws MatrixIndexException if the specified row index is invalid
-     * @throws InvalidMatrixException if the matrix dimensions do not match one
+     * @throws MatrixDimensionMismatchException if the matrix dimensions do not match one
      * instance row
      */
-    public void setRowMatrix(final int row, final BlockRealMatrix matrix)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setRowMatrix(final int row, final BlockRealMatrix matrix) {
         MatrixUtils.checkRowIndex(this, row);
         final int nCols = getColumnDimension();
         if ((matrix.getRowDimension() != 1) ||
             (matrix.getColumnDimension() != nCols)) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    matrix.getRowDimension(), matrix.getColumnDimension(),
-                    1, nCols);
+            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
+                                                       matrix.getColumnDimension(),
+                                                       1, nCols);
         }
 
         // perform copy block-wise, to ensure good cache behavior
@@ -970,7 +948,6 @@ public class BlockRealMatrix extends Abs
                 mIndex += jWidth;
            }
         }
-
     }
 
     /** {@inheritDoc} */
@@ -1001,13 +978,11 @@ public class BlockRealMatrix extends Abs
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
     @Override
-    public void setColumnMatrix(final int column, final RealMatrix matrix)
-        throws MatrixIndexException, InvalidMatrixException {
+    public void setColumnMatrix(final int column, final RealMatrix matrix) {
         try {
             setColumnMatrix(column, (BlockRealMatrix) matrix);
         } catch (ClassCastException cce) {
@@ -1023,20 +998,17 @@ public class BlockRealMatrix extends Abs
      * @param matrix column matrix (must have one column and the same number of rows
      * as the instance)
      * @throws MatrixIndexException if the specified column index is invalid
-     * @throws InvalidMatrixException if the matrix dimensions do not match one
+     * @throws MatrixDimensionMismatchException if the matrix dimensions do not match one
      * instance column
      */
-    void setColumnMatrix(final int column, final BlockRealMatrix matrix)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    void setColumnMatrix(final int column, final BlockRealMatrix matrix) {
         MatrixUtils.checkColumnIndex(this, column);
         final int nRows = getRowDimension();
         if ((matrix.getRowDimension() != nRows) ||
             (matrix.getColumnDimension() != 1)) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    matrix.getRowDimension(), matrix.getColumnDimension(),
-                    nRows, 1);
+            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
+                                                       matrix.getColumnDimension(),
+                                                       nRows, 1);
         }
 
         // perform copy block-wise, to ensure good cache behavior
@@ -1057,7 +1029,6 @@ public class BlockRealMatrix extends Abs
                 block[i * jWidth + jColumn] = mBlock[mIndex++];
             }
         }
-
     }
 
     /** {@inheritDoc} */
@@ -1080,13 +1051,11 @@ public class BlockRealMatrix extends Abs
         }
 
         return new ArrayRealVector(outData, false);
-
     }
 
     /** {@inheritDoc} */
     @Override
-    public void setRowVector(final int row, final RealVector vector)
-        throws MatrixIndexException, InvalidMatrixException {
+    public void setRowVector(final int row, final RealVector vector) {
         try {
             setRow(row, ((ArrayRealVector) vector).getDataRef());
         } catch (ClassCastException cce) {
@@ -1116,13 +1085,11 @@ public class BlockRealMatrix extends Abs
         }
 
         return new ArrayRealVector(outData, false);
-
     }
 
     /** {@inheritDoc} */
     @Override
-    public void setColumnVector(final int column, final RealVector vector)
-        throws MatrixIndexException, InvalidMatrixException {
+    public void setColumnVector(final int column, final RealVector vector) {
         try {
             setColumn(column, ((ArrayRealVector) vector).getDataRef());
         } catch (ClassCastException cce) {
@@ -1150,20 +1117,15 @@ public class BlockRealMatrix extends Abs
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
     @Override
-    public void setRow(final int row, final double[] array)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setRow(final int row, final double[] array) {
         MatrixUtils.checkRowIndex(this, row);
         final int nCols = getColumnDimension();
         if (array.length != nCols) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    1, array.length, 1, nCols);
+            throw new MatrixDimensionMismatchException(1, array.length, 1, nCols);
         }
 
         // perform copy block-wise, to ensure good cache behavior
@@ -1176,7 +1138,6 @@ public class BlockRealMatrix extends Abs
             System.arraycopy(array, outIndex, block, iRow * jWidth, jWidth);
             outIndex += jWidth;
         }
-
     }
 
     /** {@inheritDoc} */
@@ -1201,20 +1162,15 @@ public class BlockRealMatrix extends Abs
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
     @Override
-    public void setColumn(final int column, final double[] array)
-        throws MatrixIndexException, InvalidMatrixException {
-
+    public void setColumn(final int column, final double[] array) {
         MatrixUtils.checkColumnIndex(this, column);
         final int nRows = getRowDimension();
         if (array.length != nRows) {
-            throw new InvalidMatrixException(
-                    LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-                    array.length, 1, nRows, 1);
+            throw new MatrixDimensionMismatchException(array.length, 1, nRows, 1);
         }
 
         // perform copy block-wise, to ensure good cache behavior
@@ -1229,7 +1185,6 @@ public class BlockRealMatrix extends Abs
                 block[i * jWidth + jColumn] = array[outIndex++];
             }
         }
-
     }
 
     /** {@inheritDoc} */
@@ -1338,7 +1293,6 @@ public class BlockRealMatrix extends Abs
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -1359,9 +1313,7 @@ public class BlockRealMatrix extends Abs
         throws IllegalArgumentException {
 
         if (v.length != columns) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
-                    v.length, columns);
+            throw new DimensionMismatchException(v.length, columns);
         }
         final double[] out = new double[rows];
 
@@ -1394,7 +1346,6 @@ public class BlockRealMatrix extends Abs
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -1403,9 +1354,7 @@ public class BlockRealMatrix extends Abs
         throws IllegalArgumentException {
 
         if (v.length != rows) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
-                    v.length, rows);
+            throw new DimensionMismatchException(v.length, rows);
         }
         final double[] out = new double[columns];
 
@@ -1443,7 +1392,6 @@ public class BlockRealMatrix extends Abs
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -1685,5 +1633,4 @@ public class BlockRealMatrix extends Abs
     private int blockWidth(final int blockColumn) {
         return (blockColumn == blockColumns - 1) ? columns - blockColumn * BLOCK_SIZE : BLOCK_SIZE;
     }
-
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrix.java?rev=1001107&r1=1001106&r2=1001107&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrix.java Fri Sep 24 23:12:34 2010
@@ -64,7 +64,7 @@ public interface FieldMatrix<T extends F
      * @return     this + m
      * @throws  IllegalArgumentException if m is not the same size as this
      */
-    FieldMatrix<T> add(FieldMatrix<T> m) throws IllegalArgumentException;
+    FieldMatrix<T> add(FieldMatrix<T> m);
 
     /**
      * Compute this minus m.
@@ -73,7 +73,7 @@ public interface FieldMatrix<T extends F
      * @return     this + m
      * @throws  IllegalArgumentException if m is not the same size as this
      */
-    FieldMatrix<T> subtract(FieldMatrix<T> m) throws IllegalArgumentException;
+    FieldMatrix<T> subtract(FieldMatrix<T> m);
 
      /**
      * Returns the result of adding d to each entry of this.
@@ -99,7 +99,7 @@ public interface FieldMatrix<T extends F
      * @throws     IllegalArgumentException
      *             if columnDimension(this) != rowDimension(m)
      */
-    FieldMatrix<T> multiply(FieldMatrix<T> m) throws IllegalArgumentException;
+    FieldMatrix<T> multiply(FieldMatrix<T> m);
 
     /**
      * Returns the result premultiplying this by <code>m</code>.
@@ -108,7 +108,7 @@ public interface FieldMatrix<T extends F
      * @throws     IllegalArgumentException
      *             if rowDimension(this) != columnDimension(m)
      */
-    FieldMatrix<T> preMultiply(FieldMatrix<T> m) throws IllegalArgumentException;
+    FieldMatrix<T> preMultiply(FieldMatrix<T> m);
 
     /**
      * Returns matrix entries as a two-dimensional array.
@@ -129,8 +129,7 @@ public interface FieldMatrix<T extends F
      *         specified rows and columns
      * @exception MatrixIndexException  if the indices are not valid
      */
-   FieldMatrix<T> getSubMatrix(int startRow, int endRow, int startColumn, int endColumn)
-       throws MatrixIndexException;
+   FieldMatrix<T> getSubMatrix(int startRow, int endRow, int startColumn, int endColumn);
 
    /**
     * Gets a submatrix. Rows and columns are indicated
@@ -142,8 +141,7 @@ public interface FieldMatrix<T extends F
     *         specified rows and columns
     * @exception MatrixIndexException if row or column selections are not valid
     */
-   FieldMatrix<T> getSubMatrix(int[] selectedRows, int[] selectedColumns)
-       throws MatrixIndexException;
+   FieldMatrix<T> getSubMatrix(int[] selectedRows, int[] selectedColumns);
 
    /**
     * Copy a submatrix. Rows and columns are indicated
@@ -159,8 +157,7 @@ public interface FieldMatrix<T extends F
     * @exception IllegalArgumentException if the destination array is too small
     */
   void copySubMatrix(int startRow, int endRow, int startColumn, int endColumn,
-                     T[][] destination)
-      throws MatrixIndexException, IllegalArgumentException;
+                     T[][] destination);
 
   /**
    * Copy a submatrix. Rows and columns are indicated
@@ -173,8 +170,7 @@ public interface FieldMatrix<T extends F
    * @exception MatrixIndexException if the indices are not valid
    * @exception IllegalArgumentException if the destination array is too small
    */
-  void copySubMatrix(int[] selectedRows, int[] selectedColumns, T[][] destination)
-      throws MatrixIndexException, IllegalArgumentException;
+  void copySubMatrix(int[] selectedRows, int[] selectedColumns, T[][] destination);
 
    /**
     * Replace the submatrix starting at <code>row, column</code> using data in
@@ -203,8 +199,7 @@ public interface FieldMatrix<T extends F
     * @throws NullPointerException if <code>subMatrix</code> is null
     * @since 2.0
     */
-   void setSubMatrix(T[][] subMatrix, int row, int column)
-       throws MatrixIndexException;
+  void setSubMatrix(T[][] subMatrix, int row, int column);
 
    /**
     * Returns the entries in row number <code>row</code>
@@ -214,7 +209,7 @@ public interface FieldMatrix<T extends F
     * @return row matrix
     * @throws MatrixIndexException if the specified row index is invalid
     */
-   FieldMatrix<T> getRowMatrix(int row) throws MatrixIndexException;
+   FieldMatrix<T> getRowMatrix(int row);
 
    /**
     * Sets the entries in row number <code>row</code>
@@ -224,11 +219,10 @@ public interface FieldMatrix<T extends F
     * @param matrix row matrix (must have one row and the same number of columns
     * as the instance)
     * @throws MatrixIndexException if the specified row index is invalid
-    * @throws InvalidMatrixException if the matrix dimensions do not match one
-    * instance row
+    * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+    * if the matrix dimensions do not match one instance row.
     */
-   void setRowMatrix(int row, FieldMatrix<T> matrix)
-       throws MatrixIndexException, InvalidMatrixException;
+   void setRowMatrix(int row, FieldMatrix<T> matrix);
 
    /**
     * Returns the entries in column number <code>column</code>
@@ -238,7 +232,7 @@ public interface FieldMatrix<T extends F
     * @return column matrix
     * @throws MatrixIndexException if the specified column index is invalid
     */
-   FieldMatrix<T> getColumnMatrix(int column) throws MatrixIndexException;
+   FieldMatrix<T> getColumnMatrix(int column);
 
    /**
     * Sets the entries in column number <code>column</code>
@@ -248,11 +242,10 @@ public interface FieldMatrix<T extends F
     * @param matrix column matrix (must have one column and the same number of rows
     * as the instance)
     * @throws MatrixIndexException if the specified column index is invalid
-    * @throws InvalidMatrixException if the matrix dimensions do not match one
-    * instance column
+    * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+    * if the matrix dimensions do not match one instance column.
     */
-   void setColumnMatrix(int column, FieldMatrix<T> matrix)
-       throws MatrixIndexException, InvalidMatrixException;
+   void setColumnMatrix(int column, FieldMatrix<T> matrix);
 
    /**
     * Returns the entries in row number <code>row</code>
@@ -262,7 +255,7 @@ public interface FieldMatrix<T extends F
     * @return row vector
     * @throws MatrixIndexException if the specified row index is invalid
     */
-   FieldVector<T> getRowVector(int row) throws MatrixIndexException;
+   FieldVector<T> getRowVector(int row);
 
    /**
     * Sets the entries in row number <code>row</code>
@@ -272,11 +265,10 @@ public interface FieldMatrix<T extends F
     * @param vector row vector (must have the same number of columns
     * as the instance)
     * @throws MatrixIndexException if the specified row index is invalid
-    * @throws InvalidMatrixException if the vector dimension does not match one
-    * instance row
+    * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+    * if the vector dimension does not match one instance row.
     */
-   void setRowVector(int row, FieldVector<T> vector)
-       throws MatrixIndexException, InvalidMatrixException;
+   void setRowVector(int row, FieldVector<T> vector);
 
    /**
     * Returns the entries in column number <code>column</code>
@@ -286,7 +278,7 @@ public interface FieldMatrix<T extends F
     * @return column vector
     * @throws MatrixIndexException if the specified column index is invalid
     */
-   FieldVector<T> getColumnVector(int column) throws MatrixIndexException;
+   FieldVector<T> getColumnVector(int column);
 
    /**
     * Sets the entries in column number <code>column</code>
@@ -295,23 +287,22 @@ public interface FieldMatrix<T extends F
     * @param column the column to be set
     * @param vector column vector (must have the same number of rows as the instance)
     * @throws MatrixIndexException if the specified column index is invalid
-    * @throws InvalidMatrixException if the vector dimension does not match one
-    * instance column
+    * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+    * if the vector dimension does not match one instance column.
     */
-   void setColumnVector(int column, FieldVector<T> vector)
-       throws MatrixIndexException, InvalidMatrixException;
+   void setColumnVector(int column, FieldVector<T> vector);
 
     /**
      * Returns the entries in row number <code>row</code> as an array.
      * <p>
      * Row indices start at 0.  A <code>MatrixIndexException</code> is thrown
-     * unless <code>0 <= row < rowDimension.</code></p>
+     * unless {@code 0 <= row < rowDimension}.</p>
      *
      * @param row the row to be fetched
      * @return array of entries in the row
      * @throws MatrixIndexException if the specified row index is not valid
      */
-    T[] getRow(int row) throws MatrixIndexException;
+    T[] getRow(int row);
 
     /**
      * Sets the entries in row number <code>row</code>
@@ -320,23 +311,22 @@ public interface FieldMatrix<T extends F
      * @param row the row to be set
      * @param array row matrix (must have the same number of columns as the instance)
      * @throws MatrixIndexException if the specified row index is invalid
-     * @throws InvalidMatrixException if the array size does not match one
-     * instance row
+     * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+     * if the array size does not match one instance row.
      */
-    void setRow(int row, T[] array)
-        throws MatrixIndexException, InvalidMatrixException;
+    void setRow(int row, T[] array);
 
     /**
      * Returns the entries in column number <code>col</code> as an array.
      * <p>
      * Column indices start at 0.  A <code>MatrixIndexException</code> is thrown
-     * unless <code>0 <= column < columnDimension.</code></p>
+     * unless {@code 0 <= column < columnDimension}.</p>
      *
      * @param column the column to be fetched
      * @return array of entries in the column
      * @throws MatrixIndexException if the specified column index is not valid
      */
-    T[] getColumn(int column) throws MatrixIndexException;
+    T[] getColumn(int column);
 
     /**
      * Sets the entries in column number <code>column</code>
@@ -345,19 +335,18 @@ public interface FieldMatrix<T extends F
      * @param column the column to be set
      * @param array column array (must have the same number of rows as the instance)
      * @throws MatrixIndexException if the specified column index is invalid
-     * @throws InvalidMatrixException if the array size does not match one
-     * instance column
+     * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+     * if the array size does not match one instance column.
      */
-    void setColumn(int column, T[] array)
-        throws MatrixIndexException, InvalidMatrixException;
+    void setColumn(int column, T[] array);
 
     /**
      * Returns the entry in the specified row and column.
      * <p>
      * Row and column indices start at 0 and must satisfy
      * <ul>
-     * <li><code>0 <= row < rowDimension</code></li>
-     * <li><code> 0 <= column < columnDimension</code></li>
+     * <li>{@code 0 <= row < rowDimension}</li>
+     * <li>{@code 0 <= column < columnDimension}</li>
      * </ul>
      * otherwise a <code>MatrixIndexException</code> is thrown.</p>
      *
@@ -366,15 +355,15 @@ public interface FieldMatrix<T extends F
      * @return matrix entry in row,column
      * @throws MatrixIndexException if the row or column index is not valid
      */
-    T getEntry(int row, int column) throws MatrixIndexException;
+    T getEntry(int row, int column);
 
     /**
      * Set the entry in the specified row and column.
      * <p>
      * Row and column indices start at 0 and must satisfy
      * <ul>
-     * <li><code>0 <= row < rowDimension</code></li>
-     * <li><code> 0 <= column < columnDimension</code></li>
+     * <li>{@code 0 <= row < rowDimension}</li>
+     * <li>{@code 0 <= column < columnDimension}</li>
      * </ul>
      * otherwise a <code>MatrixIndexException</code> is thrown.</p>
      *
@@ -384,15 +373,15 @@ public interface FieldMatrix<T extends F
      * @throws MatrixIndexException if the row or column index is not valid
      * @since 2.0
      */
-    void setEntry(int row, int column, T value) throws MatrixIndexException;
+    void setEntry(int row, int column, T value);
 
     /**
      * Change an entry in the specified row and column.
      * <p>
      * Row and column indices start at 0 and must satisfy
      * <ul>
-     * <li><code>0 <= row < rowDimension</code></li>
-     * <li><code> 0 <= column < columnDimension</code></li>
+     * <li>{@code 0 <= row < rowDimension}</li>
+     * <li>{@code 0 <= column < columnDimension}</li>
      * </ul>
      * otherwise a <code>MatrixIndexException</code> is thrown.</p>
      *
@@ -409,8 +398,8 @@ public interface FieldMatrix<T extends F
      * <p>
      * Row and column indices start at 0 and must satisfy
      * <ul>
-     * <li><code>0 <= row < rowDimension</code></li>
-     * <li><code> 0 <= column < columnDimension</code></li>
+     * <li>{@code 0 <= row < rowDimension}</li>
+     * <li>{@code 0 <= column < columnDimension}</li>
      * </ul>
      * otherwise a <code>MatrixIndexException</code> is thrown.</p>
      *
@@ -420,7 +409,7 @@ public interface FieldMatrix<T extends F
      * @throws MatrixIndexException if the row or column index is not valid
      * @since 2.0
      */
-    void multiplyEntry(int row, int column, T factor) throws MatrixIndexException;
+    void multiplyEntry(int row, int column, T factor);
 
     /**
      * Returns the transpose of this matrix.
@@ -436,7 +425,7 @@ public interface FieldMatrix<T extends F
      * @return trace
      * @throws NonSquareMatrixException if the matrix is not square
      */
-    T getTrace() throws NonSquareMatrixException;
+    T getTrace();
 
     /**
      * Returns the result of multiplying this by the vector <code>v</code>.
@@ -445,7 +434,7 @@ public interface FieldMatrix<T extends F
      * @return this*v
      * @throws IllegalArgumentException if columnDimension != v.size()
      */
-    T[] operate(T[] v) throws IllegalArgumentException;
+    T[] operate(T[] v);
 
     /**
      * Returns the result of multiplying this by the vector <code>v</code>.
@@ -454,7 +443,7 @@ public interface FieldMatrix<T extends F
      * @return this*v
      * @throws IllegalArgumentException if columnDimension != v.size()
      */
-    FieldVector<T> operate(FieldVector<T> v) throws IllegalArgumentException;
+    FieldVector<T> operate(FieldVector<T> v);
 
     /**
      * Returns the (row) vector result of premultiplying this by the vector <code>v</code>.
@@ -463,7 +452,7 @@ public interface FieldMatrix<T extends F
      * @return v*this
      * @throws IllegalArgumentException if rowDimension != v.size()
      */
-    T[] preMultiply(T[] v) throws IllegalArgumentException;
+    T[] preMultiply(T[] v);
 
     /**
      * Returns the (row) vector result of premultiplying this by the vector <code>v</code>.
@@ -472,7 +461,7 @@ public interface FieldMatrix<T extends F
      * @return v*this
      * @throws IllegalArgumentException if rowDimension != v.size()
      */
-    FieldVector<T> preMultiply(FieldVector<T> v) throws IllegalArgumentException;
+    FieldVector<T> preMultiply(FieldVector<T> v);
 
     /**
      * Visit (and possibly change) all matrix entries in row order.
@@ -495,8 +484,7 @@ public interface FieldMatrix<T extends F
      * @return the value returned by {@link FieldMatrixChangingVisitor#end()} at the end
      * of the walk
      */
-    T walkInRowOrder(FieldMatrixChangingVisitor<T> visitor)
-        throws MatrixVisitorException;
+    T walkInRowOrder(FieldMatrixChangingVisitor<T> visitor);
 
     /**
      * Visit (but don't change) all matrix entries in row order.
@@ -519,8 +507,7 @@ public interface FieldMatrix<T extends F
      * @return the value returned by {@link FieldMatrixPreservingVisitor#end()} at the end
      * of the walk
      */
-    T walkInRowOrder(FieldMatrixPreservingVisitor<T> visitor)
-        throws MatrixVisitorException;
+    T walkInRowOrder(FieldMatrixPreservingVisitor<T> visitor);
 
     /**
      * Visit (and possibly change) some matrix entries in row order.
@@ -549,8 +536,7 @@ public interface FieldMatrix<T extends F
      * of the walk
      */
     T walkInRowOrder(FieldMatrixChangingVisitor<T> visitor,
-                          int startRow, int endRow, int startColumn, int endColumn)
-        throws MatrixIndexException, MatrixVisitorException;
+                     int startRow, int endRow, int startColumn, int endColumn);
 
     /**
      * Visit (but don't change) some matrix entries in row order.
@@ -579,8 +565,7 @@ public interface FieldMatrix<T extends F
      * of the walk
      */
     T walkInRowOrder(FieldMatrixPreservingVisitor<T> visitor,
-                          int startRow, int endRow, int startColumn, int endColumn)
-        throws MatrixIndexException, MatrixVisitorException;
+                     int startRow, int endRow, int startColumn, int endColumn);
 
     /**
      * Visit (and possibly change) all matrix entries in column order.
@@ -603,8 +588,7 @@ public interface FieldMatrix<T extends F
      * @return the value returned by {@link FieldMatrixChangingVisitor#end()} at the end
      * of the walk
      */
-    T walkInColumnOrder(FieldMatrixChangingVisitor<T> visitor)
-        throws MatrixVisitorException;
+    T walkInColumnOrder(FieldMatrixChangingVisitor<T> visitor);
 
     /**
      * Visit (but don't change) all matrix entries in column order.
@@ -627,8 +611,7 @@ public interface FieldMatrix<T extends F
      * @return the value returned by {@link FieldMatrixPreservingVisitor#end()} at the end
      * of the walk
      */
-    T walkInColumnOrder(FieldMatrixPreservingVisitor<T> visitor)
-        throws MatrixVisitorException;
+    T walkInColumnOrder(FieldMatrixPreservingVisitor<T> visitor);
 
     /**
      * Visit (and possibly change) some matrix entries in column order.
@@ -657,8 +640,7 @@ public interface FieldMatrix<T extends F
      * of the walk
      */
     T walkInColumnOrder(FieldMatrixChangingVisitor<T> visitor,
-                             int startRow, int endRow, int startColumn, int endColumn)
-        throws MatrixIndexException, MatrixVisitorException;
+                        int startRow, int endRow, int startColumn, int endColumn);
 
     /**
      * Visit (but don't change) some matrix entries in column order.
@@ -687,8 +669,7 @@ public interface FieldMatrix<T extends F
      * of the walk
      */
     T walkInColumnOrder(FieldMatrixPreservingVisitor<T> visitor,
-                             int startRow, int endRow, int startColumn, int endColumn)
-        throws MatrixIndexException, MatrixVisitorException;
+                        int startRow, int endRow, int startColumn, int endColumn);
 
     /**
      * Visit (and possibly change) all matrix entries using the fastest possible order.
@@ -710,8 +691,7 @@ public interface FieldMatrix<T extends F
      * @return the value returned by {@link FieldMatrixChangingVisitor#end()} at the end
      * of the walk
      */
-    T walkInOptimizedOrder(FieldMatrixChangingVisitor<T> visitor)
-        throws MatrixVisitorException;
+    T walkInOptimizedOrder(FieldMatrixChangingVisitor<T> visitor);
 
     /**
      * Visit (but don't change) all matrix entries using the fastest possible order.
@@ -733,8 +713,7 @@ public interface FieldMatrix<T extends F
      * @return the value returned by {@link FieldMatrixPreservingVisitor#end()} at the end
      * of the walk
      */
-    T walkInOptimizedOrder(FieldMatrixPreservingVisitor<T> visitor)
-        throws MatrixVisitorException;
+    T walkInOptimizedOrder(FieldMatrixPreservingVisitor<T> visitor);
 
     /**
      * Visit (and possibly change) some matrix entries using the fastest possible order.
@@ -762,8 +741,7 @@ public interface FieldMatrix<T extends F
      * of the walk
      */
     T walkInOptimizedOrder(FieldMatrixChangingVisitor<T> visitor,
-                                int startRow, int endRow, int startColumn, int endColumn)
-        throws MatrixIndexException, MatrixVisitorException;
+                           int startRow, int endRow, int startColumn, int endColumn);
 
     /**
      * Visit (but don't change) some matrix entries using the fastest possible order.
@@ -791,7 +769,5 @@ public interface FieldMatrix<T extends F
      * of the walk
      */
     T walkInOptimizedOrder(FieldMatrixPreservingVisitor<T> visitor,
-                                int startRow, int endRow, int startColumn, int endColumn)
-        throws MatrixIndexException, MatrixVisitorException;
-
+                           int startRow, int endRow, int startColumn, int endColumn);
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/InvalidMatrixException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/InvalidMatrixException.java?rev=1001107&r1=1001106&r2=1001107&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/InvalidMatrixException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/InvalidMatrixException.java Fri Sep 24 23:12:34 2010
@@ -26,6 +26,8 @@ import org.apache.commons.math.exception
  * that matrix does not satisfy the preconditions for the
  * aforementioned operation.
  * @version $Revision$ $Date$
+ * @deprecated since 2.2. Please use the classes in the
+ * {@link org.apache.commons.math.exception} package.
  */
 public class InvalidMatrixException extends MathRuntimeException {
 



Mime
View raw message