commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1038403 [1/2] - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/linear/ test/java/org/apache/commons/math/linear/
Date Wed, 24 Nov 2010 00:42:13 GMT
Author: erans
Date: Wed Nov 24 00:42:12 2010
New Revision: 1038403

URL: http://svn.apache.org/viewvc?rev=1038403&view=rev
Log:
MATH-425
Removed redundant exception "throws" clauses.
Javadoc cleanup.
Throwing "NoDataException" instead of "ZeroException" when row or column
data is missing.

Modified:
    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/AbstractRealVector.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayRealVector.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/DefaultFieldMatrixChangingVisitor.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultFieldMatrixPreservingVisitor.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultRealMatrixChangingVisitor.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.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/FieldMatrixChangingVisitor.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrixPreservingVisitor.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixUtils.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/OpenMapRealMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrix.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixPreservingVisitor.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecomposition.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
    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/BlockRealMatrixTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SparseRealMatrixTest.java

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=1038403&r1=1038402&r2=1038403&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 Wed Nov 24 00:42:12 2010
@@ -37,11 +37,13 @@ import org.apache.commons.math.exception
  * <p>All the methods implemented here use {@link #getEntry(int, int)} to access
  * matrix elements. Derived class can provide faster implementations. </p>
  *
- * @param <T> the type of the field elements
+ * @param <T> Type of the field elements.
+ *
  * @version $Revision$ $Date$
  * @since 2.0
  */
-public abstract class AbstractFieldMatrix<T extends FieldElement<T>> implements FieldMatrix<T> {
+public abstract class AbstractFieldMatrix<T extends FieldElement<T>>
+    implements FieldMatrix<T> {
     /** Field to which the elements belong. */
     private final Field<T> field;
 
@@ -170,15 +172,13 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public abstract FieldMatrix<T> createMatrix(final int rowDimension, final int columnDimension)
-        throws IllegalArgumentException;
+    public abstract FieldMatrix<T> createMatrix(final int rowDimension, final int columnDimension);
 
     /** {@inheritDoc} */
     public abstract FieldMatrix<T> copy();
 
     /** {@inheritDoc} */
-    public FieldMatrix<T> add(FieldMatrix<T> m) throws IllegalArgumentException {
-
+    public FieldMatrix<T> add(FieldMatrix<T> m) {
         // safety check
         checkAdditionCompatible(m);
 
@@ -192,12 +192,10 @@ public abstract class AbstractFieldMatri
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
-    public FieldMatrix<T> subtract(final FieldMatrix<T> m) throws IllegalArgumentException {
-
+    public FieldMatrix<T> subtract(final FieldMatrix<T> m) {
         // safety check
         checkSubtractionCompatible(m);
 
@@ -211,7 +209,6 @@ public abstract class AbstractFieldMatri
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -227,12 +224,10 @@ public abstract class AbstractFieldMatri
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
     public FieldMatrix<T> scalarMultiply(final T d) {
-
         final int rowCount    = getRowDimension();
         final int columnCount = getColumnDimension();
         final FieldMatrix<T> out = createMatrix(rowCount, columnCount);
@@ -243,13 +238,10 @@ public abstract class AbstractFieldMatri
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
-    public FieldMatrix<T> multiply(final FieldMatrix<T> m)
-        throws IllegalArgumentException {
-
+    public FieldMatrix<T> multiply(final FieldMatrix<T> m) {
         // safety check
         checkMultiplicationCompatible(m);
 
@@ -268,18 +260,15 @@ public abstract class AbstractFieldMatri
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
-    public FieldMatrix<T> preMultiply(final FieldMatrix<T> m)
-        throws IllegalArgumentException {
+    public FieldMatrix<T> preMultiply(final FieldMatrix<T> m) {
         return m.multiply(this);
     }
 
     /** {@inheritDoc} */
     public T[][] getData() {
-
         final T[][] data = buildArray(field, getRowDimension(), getColumnDimension());
 
         for (int i = 0; i < data.length; ++i) {
@@ -290,13 +279,11 @@ public abstract class AbstractFieldMatri
         }
 
         return data;
-
     }
 
     /** {@inheritDoc} */
     public FieldMatrix<T> getSubMatrix(final int startRow, final int endRow,
                                        final int startColumn, final int endColumn) {
-
         checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
 
         final FieldMatrix<T> subMatrix =
@@ -635,8 +622,7 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public T[] operate(final T[] v)
-        throws IllegalArgumentException {
+    public T[] operate(final T[] v) {
 
         final int nRows = getRowDimension();
         final int nCols = getColumnDimension();
@@ -657,8 +643,7 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public FieldVector<T> operate(final FieldVector<T> v)
-        throws IllegalArgumentException {
+    public FieldVector<T> operate(final FieldVector<T> v) {
         try {
             return new ArrayFieldVector<T>(operate(((ArrayFieldVector<T>) v).getDataRef()), false);
         } catch (ClassCastException cce) {
@@ -682,8 +667,7 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public T[] preMultiply(final T[] v)
-        throws IllegalArgumentException {
+    public T[] preMultiply(final T[] v) {
 
         final int nRows = getRowDimension();
         final int nCols = getColumnDimension();
@@ -704,12 +688,10 @@ public abstract class AbstractFieldMatri
     }
 
     /** {@inheritDoc} */
-    public FieldVector<T> preMultiply(final FieldVector<T> v)
-        throws IllegalArgumentException {
+    public FieldVector<T> preMultiply(final FieldVector<T> v) {
         try {
             return new ArrayFieldVector<T>(preMultiply(((ArrayFieldVector<T>) v).getDataRef()), false);
         } catch (ClassCastException cce) {
-
             final int nRows = getRowDimension();
             final int nCols = getColumnDimension();
             if (v.getDimension() != nRows) {

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=1038403&r1=1038402&r2=1038403&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 Wed Nov 24 00:42:12 2010
@@ -57,8 +57,7 @@ public abstract class AbstractRealMatrix
     }
 
     /** {@inheritDoc} */
-    public abstract RealMatrix createMatrix(final int rowDimension, final int columnDimension)
-        throws IllegalArgumentException;
+    public abstract RealMatrix createMatrix(final int rowDimension, final int columnDimension);
 
     /** {@inheritDoc} */
     public abstract RealMatrix copy();
@@ -271,7 +270,6 @@ public abstract class AbstractRealMatrix
     public void copySubMatrix(final int startRow, final int endRow,
                               final int startColumn, final int endColumn,
                               final double[][] destination) {
-
         // safety checks
         MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
         final int rowsCount    = endRow + 1 - startRow;
@@ -310,7 +308,6 @@ public abstract class AbstractRealMatrix
 
     /** {@inheritDoc} */
     public void copySubMatrix(int[] selectedRows, int[] selectedColumns, double[][] destination) {
-
         // safety checks
         MatrixUtils.checkSubMatrixIndex(this, selectedRows, selectedColumns);
         if ((destination.length < selectedRows.length) ||
@@ -552,9 +549,7 @@ public abstract class AbstractRealMatrix
     }
 
     /** {@inheritDoc} */
-    public double[] operate(final double[] v)
-        throws IllegalArgumentException {
-
+    public double[] operate(final double[] v) {
         final int nRows = getRowDimension();
         final int nCols = getColumnDimension();
         if (v.length != nCols) {
@@ -574,8 +569,7 @@ public abstract class AbstractRealMatrix
     }
 
     /** {@inheritDoc} */
-    public RealVector operate(final RealVector v)
-        throws IllegalArgumentException {
+    public RealVector operate(final RealVector v) {
         try {
             return new ArrayRealVector(operate(((ArrayRealVector) v).getDataRef()), false);
         } catch (ClassCastException cce) {
@@ -599,8 +593,7 @@ public abstract class AbstractRealMatrix
     }
 
     /** {@inheritDoc} */
-    public double[] preMultiply(final double[] v)
-        throws IllegalArgumentException {
+    public double[] preMultiply(final double[] v) {
 
         final int nRows = getRowDimension();
         final int nCols = getColumnDimension();
@@ -621,8 +614,7 @@ public abstract class AbstractRealMatrix
     }
 
     /** {@inheritDoc} */
-    public RealVector preMultiply(final RealVector v)
-        throws IllegalArgumentException {
+    public RealVector preMultiply(final RealVector v) {
         try {
             return new ArrayRealVector(preMultiply(((ArrayRealVector) v).getDataRef()), false);
         } catch (ClassCastException cce) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java Wed Nov 24 00:42:12 2010
@@ -39,9 +39,10 @@ public abstract class AbstractRealVector
 
     /**
      * Check if instance and specified vectors have the same dimension.
-     * @param v vector to compare instance with
-     * @exception IllegalArgumentException if the vectors do not
-     * have the same dimension
+     *
+     * @param v Vector to compare instance with.
+     * @throws DimensionMismatchException if the vectors do not
+     * have the same dimension.
      */
     protected void checkVectorDimensions(RealVector v) {
         checkVectorDimensions(v.getDimension());
@@ -50,12 +51,11 @@ public abstract class AbstractRealVector
     /**
      * Check if instance dimension is equal to some expected value.
      *
-     * @param n expected dimension.
+     * @param n Expected dimension.
      * @throws DimensionMismatchException if the dimension is
-     * inconsistent with vector size
+     * inconsistent with the vector size.
      */
-    protected void checkVectorDimensions(int n)
-        throws DimensionMismatchException {
+    protected void checkVectorDimensions(int n) {
         int d = getDimension();
         if (d != n) {
             throw new DimensionMismatchException(d, n);
@@ -823,5 +823,4 @@ public abstract class AbstractRealVector
             throw new MathUnsupportedOperationException();
         }
     }
-
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowFieldMatrix.java Wed Nov 24 00:42:12 2010
@@ -21,8 +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.MathUserException;
+import org.apache.commons.math.exception.NoDataException;
+import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 
 /**
@@ -36,11 +37,11 @@ import org.apache.commons.math.exception
  * @param <T> the type of the field elements
  * @version $Revision$ $Date$
  */
-public class Array2DRowFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMatrix<T> implements Serializable {
-
+public class Array2DRowFieldMatrix<T extends FieldElement<T>>
+    extends AbstractFieldMatrix<T>
+    implements Serializable {
     /** Serializable version identifier */
     private static final long serialVersionUID = 7260756672015356458L;
-
     /** Entries of the matrix */
     protected T[][] data;
 
@@ -53,57 +54,57 @@ public class Array2DRowFieldMatrix<T ext
     }
 
     /**
-     * Create a new FieldMatrix<T> with the supplied row and column dimensions.
+     * Create a new {@code FieldMatrix<T>} with the supplied row and column dimensions.
      *
-     * @param field field to which the elements belong
-     * @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
+     * @param field Field to which the elements belong.
+     * @param rowDimension Number of rows in the new matrix.
+     * @param columnDimension Number of columns in the new matrix.
+     * @throws org.apache.commons.math.exception.NotStrictlyPositiveException
+     * if row or column dimension is not positive.
      */
     public Array2DRowFieldMatrix(final Field<T> field,
-                           final int rowDimension, final int columnDimension)
-        throws IllegalArgumentException {
+                                 final int rowDimension,
+                                 final int columnDimension) {
         super(field, rowDimension, columnDimension);
         data = buildArray(field, rowDimension, columnDimension);
     }
 
     /**
-     * Create a new FieldMatrix<T> using the input array as the underlying
+     * Create a new {@code FieldMatrix<T>} using the input array as the underlying
      * data array.
      * <p>The input array is copied, not referenced. This constructor has
      * the same effect as calling {@link #Array2DRowFieldMatrix(FieldElement[][], boolean)}
-     * with the second argument set to <code>true</code>.</p>
+     * with the second argument set to {@code true}.</p>
      *
-     * @param d data for new matrix
-     * @throws IllegalArgumentException if <code>d</code> is not rectangular
-     *  (not all rows have the same length) or empty
-     * @throws NullPointerException if <code>d</code> is null
+     * @param d Data for the new matrix.
+     * @throws DimensionMismatchException if {@code d} is not rectangular.
+     * @throws org.apache.commons.math.exception.NullArgumentException if
+     * {@code d} is {@code null}.
+     * @throws NoDataException if there are not at least one row and one column.
      * @see #Array2DRowFieldMatrix(FieldElement[][], boolean)
      */
-    public Array2DRowFieldMatrix(final T[][] d)
-        throws IllegalArgumentException, NullPointerException {
+    public Array2DRowFieldMatrix(final T[][] d) {
         super(extractField(d));
         copyIn(d);
     }
 
     /**
-     * Create a new FieldMatrix<T> using the input array as the underlying
+     * Create a new {@code FieldMatrix<T>} using the input array as the underlying
      * data array.
      * <p>If an array is built specially in order to be embedded in a
-     * FieldMatrix<T> and not used directly, the <code>copyArray</code> may be
-     * set to <code>false</code. This will prevent the copying and improve
+     * {@code FieldMatrix<T>} and not used directly, the {@code copyArray} may be
+     * set to {@code false}. This will prevent the copying and improve
      * performance as no new array will be built and no data will be copied.</p>
-     * @param d data for new matrix
-     * @param copyArray if true, the input array will be copied, otherwise
-     * it will be referenced
-     * @throws IllegalArgumentException if <code>d</code> is not rectangular
-     *  (not all rows have the same length) or empty
-     * @throws NullPointerException if <code>d</code> is null
+     *
+     * @param d Data for the new matrix.
+     * @param copyArray Whether to copy or reference the input array.
+     * @throws DimensionMismatchException if {@code d} is not rectangular.
+     * @throws NoDataException if there are not at least one row and one column.
+     * @throws org.apache.commons.math.exception.NullArgumentException
+     * if {@code d} is {@code null}.
      * @see #Array2DRowFieldMatrix(FieldElement[][])
      */
-    public Array2DRowFieldMatrix(final T[][] d, final boolean copyArray)
-        throws IllegalArgumentException, NullPointerException {
+    public Array2DRowFieldMatrix(final T[][] d, final boolean copyArray) {
         super(extractField(d));
         if (copyArray) {
             copyIn(d);
@@ -113,18 +114,15 @@ public class Array2DRowFieldMatrix<T ext
             }
             final int nRows = d.length;
             if (nRows == 0) {
-                throw MathRuntimeException.createIllegalArgumentException(
-                      LocalizedFormats.AT_LEAST_ONE_ROW);
+                throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
             }
             final int nCols = d[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 (d[r].length != nCols) {
-                    throw MathRuntimeException.createIllegalArgumentException(
-                          LocalizedFormats.DIFFERENT_ROWS_LENGTHS, nCols, d[r].length);
+                    throw new DimensionMismatchException(nCols, d[r].length);
                 }
             }
             data = d;
@@ -132,12 +130,11 @@ public class Array2DRowFieldMatrix<T ext
     }
 
     /**
-     * Create a new (column) FieldMatrix<T> using <code>v</code> as the
-     * data for the unique column of the <code>v.length x 1</code> matrix
-     * created.
-     * <p>The input array is copied, not referenced.</p>
+     * Create a new (column) {@code FieldMatrix<T>} using {@code v} as the
+     * data for the unique column of the created matrix.
+     * The input array is copied.
      *
-     * @param v column vector holding data for new matrix
+     * @param v Column vector holding data for new matrix.
      */
     public Array2DRowFieldMatrix(final T[] v) {
         super(extractField(v));
@@ -150,8 +147,7 @@ public class Array2DRowFieldMatrix<T ext
 
     /** {@inheritDoc} */
     @Override
-    public FieldMatrix<T> createMatrix(final int rowDimension, final int columnDimension)
-        throws IllegalArgumentException {
+    public FieldMatrix<T> createMatrix(final int rowDimension, final int columnDimension) {
         return new Array2DRowFieldMatrix<T>(getField(), rowDimension, columnDimension);
     }
 
@@ -161,27 +157,15 @@ public class Array2DRowFieldMatrix<T ext
         return new Array2DRowFieldMatrix<T>(copyOut(), false);
     }
 
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> add(final FieldMatrix<T> m)
-        throws IllegalArgumentException {
-        try {
-            return add((Array2DRowFieldMatrix<T>) m);
-        } catch (ClassCastException cce) {
-            return super.add(m);
-        }
-    }
-
     /**
-     * Compute the sum of this and <code>m</code>.
+     * Add {@code m} to this matrix.
      *
-     * @param m    matrix to be added
-     * @return     this + m
-     * @throws  IllegalArgumentException if m is not the same size as this
+     * @param m Matrix to be added.
+     * @return {@code this} + m.
+     * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+     * if {@code m} is not the same size as this matrix.
      */
-    public Array2DRowFieldMatrix<T> add(final Array2DRowFieldMatrix<T> m)
-        throws IllegalArgumentException {
-
+    public Array2DRowFieldMatrix<T> add(final Array2DRowFieldMatrix<T> m) {
         // safety check
         checkAdditionCompatible(m);
 
@@ -198,30 +182,17 @@ public class Array2DRowFieldMatrix<T ext
         }
 
         return new Array2DRowFieldMatrix<T>(outData, false);
-
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> subtract(final FieldMatrix<T> m)
-        throws IllegalArgumentException {
-        try {
-            return subtract((Array2DRowFieldMatrix<T>) m);
-        } catch (ClassCastException cce) {
-            return super.subtract(m);
-        }
     }
 
     /**
-     * Compute  this minus <code>m</code>.
+     * Subtract {@code m} from this matrix.
      *
-     * @param m    matrix to be subtracted
-     * @return     this + m
-     * @throws  IllegalArgumentException if m is not the same size as this
+     * @param m Matrix to be subtracted.
+     * @return {@code this} + m.
+     * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+     * if {@code m} is not the same size as this matrix.
      */
-    public Array2DRowFieldMatrix<T> subtract(final Array2DRowFieldMatrix<T> m)
-        throws IllegalArgumentException {
-
+    public Array2DRowFieldMatrix<T> subtract(final Array2DRowFieldMatrix<T> m) {
         // safety check
         checkSubtractionCompatible(m);
 
@@ -241,27 +212,15 @@ public class Array2DRowFieldMatrix<T ext
 
     }
 
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> multiply(final FieldMatrix<T> m)
-        throws IllegalArgumentException {
-        try {
-            return multiply((Array2DRowFieldMatrix<T>) m);
-        } catch (ClassCastException cce) {
-            return super.multiply(m);
-        }
-    }
-
     /**
-     * Returns the result of postmultiplying this by <code>m</code>.
-     * @param m    matrix to postmultiply by
-     * @return     this*m
-     * @throws     IllegalArgumentException
-     *             if columnDimension(this) != rowDimension(m)
+     * Postmultiplying this matrix by {@code m}.
+     *
+     * @param m Matrix to postmultiply by.
+     * @return {@code this} * m.
+     * @throws DimensionMismatchException if the number of columns of this
+     * matrix is not equal to the number of rows of {@code m}.
      */
-    public Array2DRowFieldMatrix<T> multiply(final Array2DRowFieldMatrix<T> m)
-        throws IllegalArgumentException {
-
+    public Array2DRowFieldMatrix<T> multiply(final Array2DRowFieldMatrix<T> m) {
         // safety check
         checkMultiplicationCompatible(m);
 
@@ -292,11 +251,10 @@ public class Array2DRowFieldMatrix<T ext
     }
 
     /**
-     * Returns a reference to the underlying data array.
-     * <p>
-     * Does <strong>not</strong> make a fresh copy of the underlying data.</p>
+     * Get a reference to the underlying data array.
+     * This methods returns internal data, <strong>not</strong> fresh copy of it.
      *
-     * @return 2-dimensional array of entries
+     * @return the 2-dimensional array of entries.
      */
     public T[][] getDataRef() {
         return data;
@@ -307,29 +265,24 @@ public class Array2DRowFieldMatrix<T ext
     public void setSubMatrix(final T[][] subMatrix, final int row, final int column) {
         if (data == null) {
             if (row > 0) {
-                throw MathRuntimeException.createIllegalStateException(
-                      LocalizedFormats.FIRST_ROWS_NOT_INITIALIZED_YET, row);
+                throw new MathIllegalStateException(LocalizedFormats.FIRST_ROWS_NOT_INITIALIZED_YET, row);
             }
             if (column > 0) {
-                throw MathRuntimeException.createIllegalStateException(
-                      LocalizedFormats.FIRST_COLUMNS_NOT_INITIALIZED_YET, column);
+                throw new MathIllegalStateException(LocalizedFormats.FIRST_COLUMNS_NOT_INITIALIZED_YET, column);
             }
             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);
             }
             data = buildArray(getField(), subMatrix.length, nCols);
             for (int i = 0; i < data.length; ++i) {
                 if (subMatrix[i].length != nCols) {
-                    throw MathRuntimeException.createIllegalArgumentException(
-                          LocalizedFormats.DIFFERENT_ROWS_LENGTHS, nCols, subMatrix[i].length);
+                    throw new DimensionMismatchException(nCols, subMatrix[i].length);
                 }
                 System.arraycopy(subMatrix[i], 0, data[i + row], column, nCols);
             }
@@ -389,13 +342,11 @@ public class Array2DRowFieldMatrix<T ext
 
     /** {@inheritDoc} */
     @Override
-    public T[] operate(final T[] v)
-        throws IllegalArgumentException {
+    public T[] operate(final T[] v) {
         final int nRows = this.getRowDimension();
         final int nCols = this.getColumnDimension();
         if (v.length != nCols) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.VECTOR_LENGTH_MISMATCH, v.length, nCols);
+            throw new DimensionMismatchException(v.length, nCols);
         }
         final T[] out = buildArray(getField(), nRows);
         for (int row = 0; row < nRows; row++) {
@@ -411,14 +362,11 @@ public class Array2DRowFieldMatrix<T ext
 
     /** {@inheritDoc} */
     @Override
-    public T[] preMultiply(final T[] v)
-        throws IllegalArgumentException {
-
+    public T[] preMultiply(final T[] v) {
         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 T[] out = buildArray(getField(), nCols);
@@ -431,7 +379,6 @@ public class Array2DRowFieldMatrix<T ext
         }
 
         return out;
-
     }
 
     /** {@inheritDoc} */
@@ -561,7 +508,7 @@ public class Array2DRowFieldMatrix<T ext
     }
 
     /**
-     * Returns a fresh copy of the underlying data array.
+     * Get a fresh copy of the underlying data array.
      *
      * @return a copy of the underlying data array.
      */
@@ -576,17 +523,15 @@ public class Array2DRowFieldMatrix<T ext
     }
 
     /**
-     * Replaces data with a fresh copy of the input array.
-     * <p>
-     * Verifies that the input array is rectangular and non-empty.</p>
+     * Replace data with a fresh copy of the input array.
      *
-     * @param in data to copy in
-     * @throws IllegalArgumentException if input array is empty or not
-     *    rectangular
-     * @throws NullPointerException if input array is null
+     * @param in Data to copy.
+     * @throws NoDataException if the input array is empty.
+     * @throws DimensionMismatchException if the input array is not rectangular.
+     * @throws org.apache.commons.math.exception.NullArgumentException if
+     * the input array is {@code null}.
      */
     private void copyIn(final T[][] in) {
         setSubMatrix(in, 0, 0);
     }
-
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/Array2DRowRealMatrix.java Wed Nov 24 00:42:12 2010
@@ -21,7 +21,7 @@ import java.io.Serializable;
 
 import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.NullArgumentException;
-import org.apache.commons.math.exception.ZeroException;
+import org.apache.commons.math.exception.NoDataException;
 import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 
@@ -67,32 +67,30 @@ public class Array2DRowRealMatrix extend
     /**
      * Create a new RealMatrix with the supplied row and column dimensions.
      *
-     * @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
+     * @param rowDimension Number of rows in the new matrix.
+     * @param columnDimension Number of columns in the new matrix.
+     * @throws org.apache.commons.math.exception.NotStrictlyPositiveException
+     * if the row or column dimension is not positive.
      */
-    public Array2DRowRealMatrix(final int rowDimension, final int columnDimension)
-        throws IllegalArgumentException {
+    public Array2DRowRealMatrix(final int rowDimension, final int columnDimension) {
         super(rowDimension, columnDimension);
         data = new double[rowDimension][columnDimension];
     }
 
     /**
-     * Create a new RealMatrix using the input array as the underlying
+     * Create a new {@code RealMatrix} using the input array as the underlying
      * data array.
      * <p>The input array is copied, not referenced. This constructor has
      * the same effect as calling {@link #Array2DRowRealMatrix(double[][], boolean)}
-     * with the second argument set to <code>true</code>.</p>
+     * with the second argument set to {@code true}.</p>
      *
-     * @param d data for new matrix
-     * @throws IllegalArgumentException if <code>d</code> is not rectangular
-     *  (not all rows have the same length) or empty
-     * @throws NullPointerException if <code>d</code> is null
+     * @param d Data for the new matrix.
+     * @throws DimensionMismatchException if {@code d} is not rectangular.
+     * @throws NoDataException if {@code d} row or colum dimension is zero.
+     * @throws NullPointerException if {@code d} is {@code null}.
      * @see #Array2DRowRealMatrix(double[][], boolean)
      */
-    public Array2DRowRealMatrix(final double[][] d)
-        throws IllegalArgumentException, NullPointerException {
+    public Array2DRowRealMatrix(final double[][] d) {
         copyIn(d);
     }
 
@@ -110,7 +108,7 @@ public class Array2DRowRealMatrix extend
      * @throws DimensionMismatchException if {@code d} is not rectangular
      * (not all rows have the same length) or empty.
      * @throws NullArgumentException if {@code d} is {@code null}.
-     * @throws ZeroException if there are not at least one row and one column.
+     * @throws NoDataException if there are not at least one row and one column.
      * @see #Array2DRowRealMatrix(double[][])
      */
     public Array2DRowRealMatrix(final double[][] d, final boolean copyArray) {
@@ -122,11 +120,11 @@ public class Array2DRowRealMatrix extend
             }
             final int nRows = d.length;
             if (nRows == 0) {
-                throw new ZeroException(LocalizedFormats.AT_LEAST_ONE_ROW);
+                throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
             }
             final int nCols = d[0].length;
             if (nCols == 0) {
-                throw new ZeroException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
+                throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
             }
             for (int r = 1; r < nRows; r++) {
                 if (d[r].length != nCols) {
@@ -139,9 +137,8 @@ public class Array2DRowRealMatrix extend
 
     /**
      * Create a new (column) RealMatrix using {@code v} as the
-     * data for the unique column of the {@code v.length x 1} matrix
-     * created.
-     * The input array is copied, not referenced.
+     * data for the unique column of the created matrix.
+     * The input array is copied.
      *
      * @param v Column vector holding data for new matrix.
      */
@@ -221,13 +218,12 @@ public class Array2DRowRealMatrix extend
     }
 
     /**
-     * Returns the result of postmultiplying this matrix with {@code m}.
+     * Postmultiplying this matrix by {@code m}.
      *
      * @param m Matrix to postmultiply by.
      * @return {@code this} * m.
-     * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
-     * if the column dimension of this matrix is different from the row
-     * dimension of {@code m}.
+     * @throws DimensionMismatchException if the number of columns of this
+     * matrix is not equal to the number of rows of {@code m}.
      */
     public Array2DRowRealMatrix multiply(final Array2DRowRealMatrix m) {
         // Safety check.
@@ -260,7 +256,7 @@ public class Array2DRowRealMatrix extend
     }
 
     /**
-     * Return a reference to the underlying data array.
+     * Get a reference to the underlying data array.
      *
      * @return 2-dimensional array of entries.
      */
@@ -281,12 +277,12 @@ public class Array2DRowRealMatrix extend
             }
             final int nRows = subMatrix.length;
             if (nRows == 0) {
-                throw new ZeroException(LocalizedFormats.AT_LEAST_ONE_ROW);
+                throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
             }
 
             final int nCols = subMatrix[0].length;
             if (nCols == 0) {
-                throw new ZeroException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
+                throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
             }
             data = new double[subMatrix.length][nCols];
             for (int i = 0; i < data.length; ++i) {
@@ -510,7 +506,7 @@ public class Array2DRowRealMatrix extend
     }
 
     /**
-     * Returns a fresh copy of the underlying data array.
+     * Get a fresh copy of the underlying data array.
      *
      * @return a copy of the underlying data array.
      */
@@ -525,17 +521,15 @@ public class Array2DRowRealMatrix extend
     }
 
     /**
-     * Replaces data with a fresh copy of the input array.
-     * <p>
-     * Verifies that the input array is rectangular and non-empty.</p>
+     * Replace data with a fresh copy of the input array.
      *
-     * @param in data to copy in
-     * @throws IllegalArgumentException if input array is empty or not
-     *    rectangular
-     * @throws NullPointerException if input array is null
+     * @param in Data to copy.
+     * @throws NoDataException if the input array is empty.
+     * @throws DimensionMismatchException if the input array is not rectangular.
+     * @throws org.apache.commons.math.exception.NullArgumentException if
+     * the input array is {@code null}.
      */
     private void copyIn(final double[][] in) {
         setSubMatrix(in, 0, 0);
     }
-
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/ArrayRealVector.java Wed Nov 24 00:42:12 2010
@@ -200,8 +200,8 @@ public class ArrayRealVector extends Abs
 
     /**
      * Construct a vector by appending one vector to another vector.
-     * @param v1 first vector (will be put in front of the new vector)
-     * @param v2 second vector (will be put at back of the new vector)
+     * @param v1 First vector (will be put in front of the new vector).
+     * @param v2 Second vector (will be put at back of the new vector).
      */
     public ArrayRealVector(ArrayRealVector v1, ArrayRealVector v2) {
         data = new double[v1.data.length + v2.data.length];
@@ -211,8 +211,8 @@ public class ArrayRealVector extends Abs
 
     /**
      * Construct a vector by appending one vector to another vector.
-     * @param v1 first vector (will be put in front of the new vector)
-     * @param v2 second vector (will be put at back of the new vector)
+     * @param v1 First vector (will be put in front of the new vector).
+     * @param v2 Second vector (will be put at back of the new vector).
      */
     public ArrayRealVector(ArrayRealVector v1, RealVector v2) {
         final int l1 = v1.data.length;
@@ -226,8 +226,8 @@ public class ArrayRealVector extends Abs
 
     /**
      * Construct a vector by appending one vector to another vector.
-     * @param v1 first vector (will be put in front of the new vector)
-     * @param v2 second vector (will be put at back of the new vector)
+     * @param v1 First vector (will be put in front of the new vector).
+     * @param v2 Second vector (will be put at back of the new vector).
      */
     public ArrayRealVector(RealVector v1, ArrayRealVector v2) {
         final int l1 = v1.getDimension();
@@ -241,8 +241,8 @@ public class ArrayRealVector extends Abs
 
     /**
      * Construct a vector by appending one vector to another vector.
-     * @param v1 first vector (will be put in front of the new vector)
-     * @param v2 second vector (will be put at back of the new vector)
+     * @param v1 First vector (will be put in front of the new vector).
+     * @param v2 Second vector (will be put at back of the new vector).
      */
     public ArrayRealVector(ArrayRealVector v1, double[] v2) {
         final int l1 = v1.getDimension();
@@ -254,8 +254,8 @@ public class ArrayRealVector extends Abs
 
     /**
      * Construct a vector by appending one vector to another vector.
-     * @param v1 first vector (will be put in front of the new vector)
-     * @param v2 second vector (will be put at back of the new vector)
+     * @param v1 First vector (will be put in front of the new vector).
+     * @param v2 Second vector (will be put at back of the new vector).
      */
     public ArrayRealVector(double[] v1, ArrayRealVector v2) {
         final int l1 = v1.length;
@@ -286,8 +286,7 @@ public class ArrayRealVector extends Abs
 
     /** {@inheritDoc} */
     @Override
-    public RealVector add(RealVector v)
-        throws IllegalArgumentException {
+    public RealVector add(RealVector v) {
         if (v instanceof ArrayRealVector) {
             return add((ArrayRealVector) v);
         } else {
@@ -304,8 +303,7 @@ public class ArrayRealVector extends Abs
 
     /** {@inheritDoc} */
     @Override
-    public RealVector add(double[] v)
-        throws IllegalArgumentException {
+    public RealVector add(double[] v) {
         checkVectorDimensions(v.length);
         double[] out = data.clone();
         for (int i = 0; i < data.length; i++) {
@@ -315,20 +313,20 @@ public class ArrayRealVector extends Abs
     }
 
     /**
-     * Compute the sum of this and v.
-     * @param v vector to be added
-     * @return this + v
-     * @throws IllegalArgumentException if v is not the same size as this
+     * Add {@code v} to this vector.
+     *
+     * @param v Vector to be added
+     * @return {@code this} + v.
+     * @throws DimensionMismatchException if {@code v} is not the same
+     * size as this vector.
      */
-    public ArrayRealVector add(ArrayRealVector v)
-        throws IllegalArgumentException {
+    public ArrayRealVector add(ArrayRealVector v) {
         return (ArrayRealVector) add(v.data);
     }
 
     /** {@inheritDoc} */
     @Override
-    public RealVector subtract(RealVector v)
-        throws IllegalArgumentException {
+    public RealVector subtract(RealVector v) {
         if (v instanceof ArrayRealVector) {
             return subtract((ArrayRealVector) v);
         } else {
@@ -345,8 +343,7 @@ public class ArrayRealVector extends Abs
 
     /** {@inheritDoc} */
     @Override
-    public RealVector subtract(double[] v)
-        throws IllegalArgumentException {
+    public RealVector subtract(double[] v) {
         checkVectorDimensions(v.length);
         double[] out = data.clone();
         for (int i = 0; i < data.length; i++) {
@@ -356,13 +353,14 @@ public class ArrayRealVector extends Abs
     }
 
     /**
-     * Compute this minus v.
-     * @param v vector to be subtracted
-     * @return this + v
-     * @throws IllegalArgumentException if v is not the same size as this
+     * Subtract {@code v} from this vector.
+     *
+     * @param v Vector to be subtracted.
+     * @return {@code this} - v.
+     * @throws DimensionMismatchException if {@code v} is not the
+     * same size as this vector.
      */
-    public ArrayRealVector subtract(ArrayRealVector v)
-        throws IllegalArgumentException {
+    public ArrayRealVector subtract(ArrayRealVector v) {
         return (ArrayRealVector) subtract(v.data);
     }
 
@@ -619,8 +617,7 @@ public class ArrayRealVector extends Abs
     }
 
     /** {@inheritDoc} */
-    public RealVector ebeMultiply(RealVector v)
-        throws IllegalArgumentException {
+    public RealVector ebeMultiply(RealVector v) {
         if (v instanceof ArrayRealVector) {
             return ebeMultiply((ArrayRealVector) v);
         } else {
@@ -635,8 +632,7 @@ public class ArrayRealVector extends Abs
 
     /** {@inheritDoc} */
     @Override
-    public RealVector ebeMultiply(double[] v)
-        throws IllegalArgumentException {
+    public RealVector ebeMultiply(double[] v) {
         checkVectorDimensions(v.length);
         double[] out = data.clone();
         for (int i = 0; i < data.length; i++) {
@@ -647,18 +643,17 @@ public class ArrayRealVector extends Abs
 
     /**
      * Element-by-element multiplication.
-     * @param v vector by which instance elements must be multiplied
-     * @return a vector containing this[i] * v[i] for all i
-     * @exception IllegalArgumentException if v is not the same size as this
+     * @param v Vector by which instance elements must be multiplied.
+     * @return a Vector containing {@code this[i] * v[i]} for all {@code i}.
+     * @exception DimensionMismatchException if {@code v} is not the same
+     * size as this vector.
      */
-    public ArrayRealVector ebeMultiply(ArrayRealVector v)
-        throws IllegalArgumentException {
+    public ArrayRealVector ebeMultiply(ArrayRealVector v) {
         return (ArrayRealVector) ebeMultiply(v.data);
     }
 
     /** {@inheritDoc} */
-    public RealVector ebeDivide(RealVector v)
-        throws IllegalArgumentException {
+    public RealVector ebeDivide(RealVector v) {
         if (v instanceof ArrayRealVector) {
             return ebeDivide((ArrayRealVector) v);
         } else {
@@ -673,8 +668,7 @@ public class ArrayRealVector extends Abs
 
     /** {@inheritDoc} */
     @Override
-    public RealVector ebeDivide(double[] v)
-        throws IllegalArgumentException {
+    public RealVector ebeDivide(double[] v) {
         checkVectorDimensions(v.length);
         double[] out = data.clone();
         for (int i = 0; i < data.length; i++) {
@@ -685,12 +679,13 @@ public class ArrayRealVector extends Abs
 
     /**
      * Element-by-element division.
-     * @param v vector by which instance elements must be divided
-     * @return a vector containing this[i] / v[i] for all i
-     * @throws IllegalArgumentException if v is not the same size as this
+     *
+     * @param v Vector by which instance elements must be divided.
+     * @return a vector containing {@code this[i] / v[i]} for all {@code i}.
+     * @exception DimensionMismatchException if {@code v} is not the same
+     * size as this vector.
      */
-    public ArrayRealVector ebeDivide(ArrayRealVector v)
-        throws IllegalArgumentException {
+    public ArrayRealVector ebeDivide(ArrayRealVector v) {
         return (ArrayRealVector) ebeDivide(v.data);
     }
 
@@ -701,9 +696,10 @@ public class ArrayRealVector extends Abs
     }
 
     /**
-     * Returns a reference to the underlying data array.
-     * <p>Does not make a fresh copy of the underlying data.</p>
-     * @return array of entries
+     * Get a reference to the underlying data array.
+     * This method does not make a fresh copy of the underlying data.
+     *
+     * @return the array of entries.
      */
     public double[] getDataRef() {
         return data;
@@ -711,8 +707,7 @@ public class ArrayRealVector extends Abs
 
     /** {@inheritDoc} */
     @Override
-    public double dotProduct(RealVector v)
-        throws IllegalArgumentException {
+    public double dotProduct(RealVector v) {
         if (v instanceof ArrayRealVector) {
             return dotProduct((ArrayRealVector) v);
         } else {
@@ -729,8 +724,7 @@ public class ArrayRealVector extends Abs
 
     /** {@inheritDoc} */
     @Override
-    public double dotProduct(double[] v)
-        throws IllegalArgumentException {
+    public double dotProduct(double[] v) {
         checkVectorDimensions(v.length);
         double dot = 0;
         for (int i = 0; i < data.length; i++) {
@@ -783,8 +777,7 @@ public class ArrayRealVector extends Abs
 
     /** {@inheritDoc} */
     @Override
-    public double getDistance(RealVector v)
-        throws IllegalArgumentException {
+    public double getDistance(RealVector v) {
         if (v instanceof ArrayRealVector) {
             return getDistance((ArrayRealVector) v);
         } else {
@@ -800,8 +793,7 @@ public class ArrayRealVector extends Abs
 
     /** {@inheritDoc} */
     @Override
-    public double getDistance(double[] v)
-        throws IllegalArgumentException {
+    public double getDistance(double[] v) {
         checkVectorDimensions(v.length);
         double sum = 0;
         for (int i = 0; i < data.length; ++i) {
@@ -817,7 +809,7 @@ public class ArrayRealVector extends Abs
      * L<sub>2</sub> norm, i.e. the square root of the sum of
      * elements differences, or euclidian distance.
      *
-     * @param v vector to which distance is requested
+     * @param v Vector to which distance is requested.
      * @return the distance between two vectors.
      * @throws DimensionMismatchException if {@code v} is not the same size as
      * this vector.
@@ -848,8 +840,7 @@ public class ArrayRealVector extends Abs
 
     /** {@inheritDoc} */
     @Override
-    public double getL1Distance(double[] v)
-        throws IllegalArgumentException {
+    public double getL1Distance(double[] v) {
         checkVectorDimensions(v.length);
         double sum = 0;
         for (int i = 0; i < data.length; ++i) {
@@ -896,8 +887,7 @@ public class ArrayRealVector extends Abs
 
     /** {@inheritDoc} */
     @Override
-    public double getLInfDistance(double[] v)
-        throws IllegalArgumentException {
+    public double getLInfDistance(double[] v) {
         checkVectorDimensions(v.length);
         double max = 0;
         for (int i = 0; i < data.length; ++i) {
@@ -970,8 +960,7 @@ public class ArrayRealVector extends Abs
 
     /** {@inheritDoc} */
     @Override
-    public RealMatrix outerProduct(RealVector v)
-        throws IllegalArgumentException {
+    public RealMatrix outerProduct(RealVector v) {
         if (v instanceof ArrayRealVector) {
             return outerProduct((ArrayRealVector) v);
         } else {
@@ -989,19 +978,18 @@ public class ArrayRealVector extends Abs
 
     /**
      * Compute the outer product.
-     * @param v vector with which outer product should be computed
-     * @return the square matrix outer product between instance and v
-     * @exception IllegalArgumentException if v is not the same size as this
+     * @param v Vector with which outer product should be computed.
+     * @return the square matrix outer product between this instance and {@code v}.
+     * @throws DimensionMismatchException if {@code v} is not the same
+     * size as this vector.
      */
-    public RealMatrix outerProduct(ArrayRealVector v)
-        throws IllegalArgumentException {
+    public RealMatrix outerProduct(ArrayRealVector v) {
         return outerProduct(v.data);
     }
 
     /** {@inheritDoc} */
     @Override
-    public RealMatrix outerProduct(double[] v)
-        throws IllegalArgumentException {
+    public RealMatrix outerProduct(double[] v) {
         checkVectorDimensions(v.length);
         final int m = data.length;
         final RealMatrix out = MatrixUtils.createRealMatrix(m, m);
@@ -1084,7 +1072,7 @@ public class ArrayRealVector extends Abs
                 set(index, (ArrayRealVector) v);
             } catch (ClassCastException cce) {
                 for (int i = index; i < index + v.getDimension(); ++i) {
-                    data[i] = v.getEntry(i-index);
+                    data[i] = v.getEntry(i - index);
                 }
             }
         } catch (IndexOutOfBoundsException e) {
@@ -1110,7 +1098,7 @@ public class ArrayRealVector extends Abs
      * @param index Index of first element to be set.
      * @param v Vector containing the values to set.
      * @throws org.apache.commons.math.exception.OutOfRangeException
-     * if the index is inconsistent with vector size.
+     * if the index is inconsistent with the vector size.
      */
     public void set(int index, ArrayRealVector v) {
         setSubVector(index, v.data);

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=1038403&r1=1038402&r2=1038403&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 Wed Nov 24 00:42:12 2010
@@ -370,8 +370,7 @@ public class BlockFieldMatrix<T extends 
 
     /** {@inheritDoc} */
     @Override
-    public FieldMatrix<T> subtract(final FieldMatrix<T> m)
-        throws IllegalArgumentException {
+    public FieldMatrix<T> subtract(final FieldMatrix<T> m) {
         try {
             return subtract((BlockFieldMatrix<T>) m);
         } catch (ClassCastException cce) {
@@ -1229,9 +1228,7 @@ public class BlockFieldMatrix<T extends 
 
     /** {@inheritDoc} */
     @Override
-    public T[] operate(final T[] v)
-        throws IllegalArgumentException {
-
+    public T[] operate(final T[] v) {
         if (v.length != columns) {
             throw new DimensionMismatchException(v.length, columns);
         }
@@ -1272,8 +1269,7 @@ public class BlockFieldMatrix<T extends 
 
     /** {@inheritDoc} */
     @Override
-    public T[] preMultiply(final T[] v)
-        throws IllegalArgumentException {
+    public T[] preMultiply(final T[] v) {
 
         if (v.length != rows) {
             throw new DimensionMismatchException(v.length, rows);

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=1038403&r1=1038402&r2=1038403&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 Wed Nov 24 00:42:12 2010
@@ -86,8 +86,8 @@ public class BlockRealMatrix extends Abs
      *
      * @param rows  the number of rows in the new matrix
      * @param columns  the number of columns in the new matrix
-     * @throws IllegalArgumentException if row or column dimension is not
-     * positive.
+     * @throws org.apache.commons.math.exception.NotStrictlyPositiveException
+     * if row or column dimension is not positive.
      */
     public BlockRealMatrix(final int rows, final int columns) {
         super(rows, columns);
@@ -109,28 +109,26 @@ public class BlockRealMatrix extends Abs
      * <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
+     * @param rawData data for new matrix, in raw layout
+     * @throws DimensionMismatchException if the shape of {@code blockData} is
+     * inconsistent with block layout.
      * @see #BlockRealMatrix(int, int, double[][], boolean)
      */
-    public BlockRealMatrix(final double[][] rawData)
-        throws IllegalArgumentException {
+    public BlockRealMatrix(final double[][] rawData) {
         this(rawData.length, rawData[0].length, toBlocksLayout(rawData), false);
     }
 
     /**
      * Create a new dense matrix copying entries from block layout data.
      * <p>The input array <em>must</em> already be in blocks layout.</p>
-     * @param rows  the number of rows in the new matrix
-     * @param columns  the number of columns in the new matrix
-     * @param blockData data for new matrix
-     * @param copyArray if true, the input array will be copied, otherwise
-     * it will be referenced
      *
-     * @exception IllegalArgumentException if <code>blockData</code> shape is
-     * inconsistent with block layout
+     * @param rows Number of rows in the new matrix.
+     * @param columns Number of columns in the new matrix.
+     * @param blockData data for new matrix
+     * @param copyArray Whether the input array will be copied or referenced.
+     * @throws DimensionMismatchException if the shape of {@code blockData} is
+     * inconsistent with block layout.
      * @see #createBlocksLayout(int, int)
      * @see #toBlocksLayout(double[][])
      * @see #BlockRealMatrix(double[][])
@@ -183,10 +181,9 @@ public class BlockRealMatrix extends Abs
      * It can be used to provide the array argument of the {@link
      * #BlockRealMatrix(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)
+     * @param rawData Data array in raw layout.
+     * @return a new data array containing the same entries but in blocks layout.
+     * @throws DimensionMismatchException if {@code rawData} is not rectangular.
      * @see #createBlocksLayout(int, int)
      * @see #BlockRealMatrix(int, int, double[][], boolean)
      */
@@ -239,9 +236,9 @@ public class BlockRealMatrix extends Abs
      * This method can be used to create the array argument of the {@link
      * #BlockRealMatrix(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
+     * @param rows Number of rows in the new matrix.
+     * @param columns Number of columns in the new matrix.
+     * @return a new data array in blocks layout.
      * @see #toBlocksLayout(double[][])
      * @see #BlockRealMatrix(int, int, double[][], boolean)
      */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultFieldMatrixChangingVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultFieldMatrixChangingVisitor.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultFieldMatrixChangingVisitor.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultFieldMatrixChangingVisitor.java Wed Nov 24 00:42:12 2010
@@ -18,7 +18,6 @@
 package org.apache.commons.math.linear;
 
 import org.apache.commons.math.FieldElement;
-import org.apache.commons.math.exception.MathUserException;
 
 /**
  * Default implementation of the {@link FieldMatrixChangingVisitor} interface.
@@ -33,7 +32,6 @@ import org.apache.commons.math.exception
  */
 public class DefaultFieldMatrixChangingVisitor<T extends FieldElement<T>>
     implements FieldMatrixChangingVisitor<T> {
-
     /** Zero element of the field. */
     private final T zero;
 
@@ -58,5 +56,4 @@ public class DefaultFieldMatrixChangingV
     public T end() {
         return zero;
     }
-
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultFieldMatrixPreservingVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultFieldMatrixPreservingVisitor.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultFieldMatrixPreservingVisitor.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultFieldMatrixPreservingVisitor.java Wed Nov 24 00:42:12 2010
@@ -18,7 +18,6 @@
 package org.apache.commons.math.linear;
 
 import org.apache.commons.math.FieldElement;
-import org.apache.commons.math.exception.MathUserException;
 
 /**
  * Default implementation of the {@link FieldMatrixPreservingVisitor} interface.
@@ -33,7 +32,6 @@ import org.apache.commons.math.exception
  */
 public class DefaultFieldMatrixPreservingVisitor<T extends FieldElement<T>>
     implements FieldMatrixPreservingVisitor<T> {
-
     /** Zero element of the field. */
     private final T zero;
 
@@ -56,5 +54,4 @@ public class DefaultFieldMatrixPreservin
     public T end() {
         return zero;
     }
-
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultRealMatrixChangingVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultRealMatrixChangingVisitor.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultRealMatrixChangingVisitor.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultRealMatrixChangingVisitor.java Wed Nov 24 00:42:12 2010
@@ -17,8 +17,6 @@
 
 package org.apache.commons.math.linear;
 
-import org.apache.commons.math.exception.MathUserException;
-
 /**
  * Default implementation of the {@link RealMatrixChangingVisitor} interface.
  * <p>
@@ -30,7 +28,6 @@ import org.apache.commons.math.exception
  * @since 2.0
  */
 public class DefaultRealMatrixChangingVisitor implements RealMatrixChangingVisitor {
-
     /** {@inheritDoc} */
     public void start(int rows, int columns,
                       int startRow, int endRow, int startColumn, int endColumn) {
@@ -45,5 +42,4 @@ public class DefaultRealMatrixChangingVi
     public double end() {
         return 0;
     }
-
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.java Wed Nov 24 00:42:12 2010
@@ -17,8 +17,6 @@
 
 package org.apache.commons.math.linear;
 
-import org.apache.commons.math.exception.MathUserException;
-
 /**
  * Default implementation of the {@link RealMatrixPreservingVisitor} interface.
  * <p>
@@ -30,7 +28,6 @@ import org.apache.commons.math.exception
  * @since 2.0
  */
 public class DefaultRealMatrixPreservingVisitor implements RealMatrixPreservingVisitor {
-
     /** {@inheritDoc} */
     public void start(int rows, int columns,
                       int startRow, int endRow, int startColumn, int endColumn) {
@@ -43,5 +40,4 @@ public class DefaultRealMatrixPreserving
     public double end() {
         return 0;
     }
-
 }

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=1038403&r1=1038402&r2=1038403&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 Wed Nov 24 00:42:12 2010
@@ -20,7 +20,6 @@ package org.apache.commons.math.linear;
 
 import org.apache.commons.math.Field;
 import org.apache.commons.math.FieldElement;
-import org.apache.commons.math.exception.MathUserException;
 
 /**
  * Interface defining field-valued matrix with basic algebraic operations.
@@ -32,7 +31,6 @@ import org.apache.commons.math.exception
  * @version $Revision$ $Date$
  */
 public interface FieldMatrix<T extends FieldElement<T>> extends AnyMatrix {
-
     /**
      * Get the type of field elements of the matrix.
      *

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrixChangingVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrixChangingVisitor.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrixChangingVisitor.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrixChangingVisitor.java Wed Nov 24 00:42:12 2010
@@ -18,7 +18,6 @@
 package org.apache.commons.math.linear;
 
 import org.apache.commons.math.FieldElement;
-import org.apache.commons.math.exception.MathUserException;
 
 /**
  * Interface defining a visitor for matrix entries.
@@ -28,7 +27,6 @@ import org.apache.commons.math.exception
  * @since 2.0
  */
 public interface FieldMatrixChangingVisitor<T extends FieldElement<?>> {
-
     /**
      * Start visiting a matrix.
      * <p>This method is called once before any entry of the matrix is visited.</p>

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrixPreservingVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrixPreservingVisitor.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrixPreservingVisitor.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldMatrixPreservingVisitor.java Wed Nov 24 00:42:12 2010
@@ -18,7 +18,6 @@
 package org.apache.commons.math.linear;
 
 import org.apache.commons.math.FieldElement;
-import org.apache.commons.math.exception.MathUserException;
 
 /**
  * Interface defining a visitor for matrix entries.
@@ -28,7 +27,6 @@ import org.apache.commons.math.exception
  * @since 2.0
  */
 public interface FieldMatrixPreservingVisitor<T extends FieldElement<?>> {
-
     /**
      * Start visiting a matrix.
      * <p>This method is called once before any entry of the matrix is visited.</p>

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixUtils.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixUtils.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/MatrixUtils.java Wed Nov 24 00:42:12 2010
@@ -25,11 +25,12 @@ 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.OutOfRangeException;
-import org.apache.commons.math.exception.ZeroException;
+import org.apache.commons.math.exception.NoDataException;
 import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.exception.NullArgumentException;
+import org.apache.commons.math.exception.MatrixDimensionMismatchException;
+import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.fraction.BigFraction;
 import org.apache.commons.math.fraction.Fraction;
@@ -102,7 +103,7 @@ public class MatrixUtils {
      * @return  RealMatrix containing the values of the array
      * @throws org.apache.commons.math.exception.DimensionMismatchException
      * if {@code data} is not rectangular (not all rows have the same length).
-     * @throws ZeroException if a row or column is empty.
+     * @throws NoDataException if a row or column is empty.
      * @throws NullArgumentException if either {@code data} or {@code data[0]}
      * is {@code null}.
      * @see #createRealMatrix(int, int)
@@ -129,7 +130,7 @@ public class MatrixUtils {
      * @return a matrix containing the values of the array.
      * @throws org.apache.commons.math.exception.DimensionMismatchException
      * if {@code data} is not rectangular (not all rows have the same length).
-     * @throws ZeroException if a row or column is empty.
+     * @throws NoDataException if a row or column is empty.
      * @throws NullArgumentException if either {@code data} or {@code data[0]}
      * is {@code null}.
      * @see #createFieldMatrix(Field, int, int)
@@ -224,7 +225,7 @@ public class MatrixUtils {
      *
      * @param data the input data
      * @return a data.length RealVector
-     * @throws ZeroException if {@code data} is empty.
+     * @throws NoDataException if {@code data} is empty.
      * @throws NullArgumentException if {@code data} is {@code null}.
      */
     public static RealVector createRealVector(double[] data) {
@@ -240,7 +241,7 @@ public class MatrixUtils {
      * @param <T> the type of the field elements
      * @param data the input data
      * @return a data.length FieldVector
-     * @throws ZeroException if {@code data} is empty.
+     * @throws NoDataException if {@code data} is empty.
      * @throws NullArgumentException if {@code data} is {@code null}.
      */
     public static <T extends FieldElement<T>> FieldVector<T> createFieldVector(final T[] data) {
@@ -256,7 +257,7 @@ public class MatrixUtils {
      *
      * @param rowData the input row data
      * @return a 1 x rowData.length RealMatrix
-     * @throws ZeroException if {@code rowData} is empty.
+     * @throws NoDataException if {@code rowData} is empty.
      * @throws NullArgumentException if {@code rowData} is {@code null}.
      */
     public static RealMatrix createRowRealMatrix(double[] rowData) {
@@ -278,7 +279,7 @@ public class MatrixUtils {
      * @param <T> the type of the field elements
      * @param rowData the input row data
      * @return a 1 x rowData.length FieldMatrix
-     * @throws ZeroException if {@code rowData} is empty.
+     * @throws NoDataException if {@code rowData} is empty.
      * @throws NullArgumentException if {@code rowData} is {@code null}.
      */
     public static <T extends FieldElement<T>> FieldMatrix<T>
@@ -288,7 +289,7 @@ public class MatrixUtils {
         }
         final int nCols = rowData.length;
         if (nCols == 0) {
-            throw new ZeroException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
+            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
         }
         final FieldMatrix<T> m = createFieldMatrix(rowData[0].getField(), 1, nCols);
         for (int i = 0; i < nCols; ++i) {
@@ -303,7 +304,7 @@ public class MatrixUtils {
      *
      * @param columnData  the input column data
      * @return a columnData x 1 RealMatrix
-     * @throws ZeroException if {@code columnData} is empty.
+     * @throws NoDataException if {@code columnData} is empty.
      * @throws NullArgumentException if {@code columnData} is {@code null}.
      */
     public static RealMatrix createColumnRealMatrix(double[] columnData) {
@@ -325,7 +326,7 @@ public class MatrixUtils {
      * @param <T> the type of the field elements
      * @param columnData  the input column data
      * @return a columnData x 1 FieldMatrix
-     * @throws ZeroException if {@code data} is empty.
+     * @throws NoDataException if {@code data} is empty.
      * @throws NullArgumentException if {@code columnData} is {@code null}.
      */
     public static <T extends FieldElement<T>> FieldMatrix<T>
@@ -335,7 +336,7 @@ public class MatrixUtils {
         }
         final int nRows = columnData.length;
         if (nRows == 0) {
-            throw MathRuntimeException.createIllegalArgumentException(LocalizedFormats.AT_LEAST_ONE_ROW);
+            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
         }
         final FieldMatrix<T> m = createFieldMatrix(columnData[0].getField(), nRows, 1);
         for (int i = 0; i < nRows; ++i) {
@@ -430,7 +431,7 @@ public class MatrixUtils {
      * @param selectedColumns Array of column indices.
      * @throws NullArgumentException if {@code selectedRows} or
      * {@code selectedColumns} are {@code null}.
-     * @throws ZeroException if the row or column selections are empty (zero
+     * @throws NoDataException if the row or column selections are empty (zero
      * length).
      * @throws OutOfRangeException if row or column selections are not valid.
      */
@@ -444,10 +445,10 @@ public class MatrixUtils {
             throw new NullArgumentException();
         }
         if (selectedRows.length == 0) {
-            throw new ZeroException(LocalizedFormats.EMPTY_SELECTED_ROW_INDEX_ARRAY);
+            throw new NoDataException(LocalizedFormats.EMPTY_SELECTED_ROW_INDEX_ARRAY);
         }
         if (selectedColumns.length == 0) {
-            throw new ZeroException(LocalizedFormats.EMPTY_SELECTED_COLUMN_INDEX_ARRAY);
+            throw new NoDataException(LocalizedFormats.EMPTY_SELECTED_COLUMN_INDEX_ARRAY);
         }
 
         for (final int row : selectedRows) {
@@ -459,59 +460,53 @@ public class MatrixUtils {
     }
 
     /**
-     * Check if matrices are addition compatible
-     * @param left left hand side matrix
-     * @param right right hand side matrix
-     * @exception IllegalArgumentException if matrices are not addition compatible
+     * Check if matrices are addition compatible.
+     *
+     * @param left Left hand side matrix.
+     * @param right Right hand side matrix.
+     * @throws MatrixDimensionMismatchException if the matrices are not addition compatible.
      */
-    public static void checkAdditionCompatible(final AnyMatrix left, final AnyMatrix right)
-        throws IllegalArgumentException {
+    public static void checkAdditionCompatible(final AnyMatrix left, final AnyMatrix right) {
         if ((left.getRowDimension()    != right.getRowDimension()) ||
             (left.getColumnDimension() != right.getColumnDimension())) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.NOT_ADDITION_COMPATIBLE_MATRICES,
-                    left.getRowDimension(), left.getColumnDimension(),
-                    right.getRowDimension(), right.getColumnDimension());
+            throw new MatrixDimensionMismatchException(left.getRowDimension(), left.getColumnDimension(),
+                                                       right.getRowDimension(), right.getColumnDimension());
         }
     }
 
     /**
      * Check if matrices are subtraction compatible
-     * @param left left hand side matrix
-     * @param right right hand side matrix
-     * @exception IllegalArgumentException if matrices are not subtraction compatible
+     *
+     * @param left Left hand side matrix.
+     * @param right Right hand side matrix.
+     * @throws MatrixDimensionMismatchException if the matrices are not addition compatible.
      */
-    public static void checkSubtractionCompatible(final AnyMatrix left, final AnyMatrix right)
-        throws IllegalArgumentException {
+    public static void checkSubtractionCompatible(final AnyMatrix left, final AnyMatrix right) {
         if ((left.getRowDimension()    != right.getRowDimension()) ||
             (left.getColumnDimension() != right.getColumnDimension())) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.NOT_SUBTRACTION_COMPATIBLE_MATRICES,
-                    left.getRowDimension(), left.getColumnDimension(),
-                    right.getRowDimension(), right.getColumnDimension());
+            throw new MatrixDimensionMismatchException(left.getRowDimension(), left.getColumnDimension(),
+                                                       right.getRowDimension(), right.getColumnDimension());
         }
     }
 
     /**
      * Check if matrices are multiplication compatible
-     * @param left left hand side matrix
-     * @param right right hand side matrix
-     * @exception IllegalArgumentException if matrices are not multiplication compatible
+     *
+     * @param left Left hand side matrix.
+     * @param right Right hand side matrix.
+     * @throws DimensionMismatchException if matrices are not multiplication compatible.
      */
-    public static void checkMultiplicationCompatible(final AnyMatrix left, final AnyMatrix right)
-        throws IllegalArgumentException {
+    public static void checkMultiplicationCompatible(final AnyMatrix left, final AnyMatrix right) {
         if (left.getColumnDimension() != right.getRowDimension()) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.NOT_MULTIPLICATION_COMPATIBLE_MATRICES,
-                    left.getRowDimension(), left.getColumnDimension(),
-                    right.getRowDimension(), right.getColumnDimension());
+            throw new DimensionMismatchException(left.getColumnDimension(),
+                                                 right.getRowDimension());
         }
     }
 
     /**
      * Convert a {@link FieldMatrix}/{@link Fraction} matrix to a {@link RealMatrix}.
-     * @param m matrix to convert
-     * @return converted matrix
+     * @param m Matrix to convert.
+     * @return the converted matrix.
      */
     public static Array2DRowRealMatrix fractionMatrixToRealMatrix(final FieldMatrix<Fraction> m) {
         final FractionMatrixConverter converter = new FractionMatrixConverter();
@@ -521,10 +516,8 @@ public class MatrixUtils {
 
     /** Converter for {@link FieldMatrix}/{@link Fraction}. */
     private static class FractionMatrixConverter extends DefaultFieldMatrixPreservingVisitor<Fraction> {
-
         /** Converted array. */
         private double[][] data;
-
         /** Simple constructor. */
         public FractionMatrixConverter() {
             super(Fraction.ZERO);
@@ -543,8 +536,10 @@ public class MatrixUtils {
             data[row][column] = value.doubleValue();
         }
 
-        /** Get the converted matrix.
-         * @return converted matrix
+        /**
+         * Get the converted matrix.
+         *
+         * @return the converted matrix.
          */
         Array2DRowRealMatrix getConvertedMatrix() {
             return new Array2DRowRealMatrix(data, false);
@@ -554,8 +549,9 @@ public class MatrixUtils {
 
     /**
      * Convert a {@link FieldMatrix}/{@link BigFraction} matrix to a {@link RealMatrix}.
-     * @param m matrix to convert
-     * @return converted matrix
+     *
+     * @param m Matrix to convert.
+     * @return the converted matrix.
      */
     public static Array2DRowRealMatrix bigFractionMatrixToRealMatrix(final FieldMatrix<BigFraction> m) {
         final BigFractionMatrixConverter converter = new BigFractionMatrixConverter();
@@ -565,10 +561,8 @@ public class MatrixUtils {
 
     /** Converter for {@link FieldMatrix}/{@link BigFraction}. */
     private static class BigFractionMatrixConverter extends DefaultFieldMatrixPreservingVisitor<BigFraction> {
-
         /** Converted array. */
         private double[][] data;
-
         /** Simple constructor. */
         public BigFractionMatrixConverter() {
             super(BigFraction.ZERO);
@@ -587,13 +581,14 @@ public class MatrixUtils {
             data[row][column] = value.doubleValue();
         }
 
-        /** Get the converted matrix.
-         * @return converted matrix
+        /**
+         * Get the converted matrix.
+         *
+         * @return the converted matrix.
          */
         Array2DRowRealMatrix getConvertedMatrix() {
             return new Array2DRowRealMatrix(data, false);
         }
-
     }
 
     /** Serialize a {@link RealVector}.
@@ -803,7 +798,5 @@ public class MatrixUtils {
             ioe.initCause(iae);
             throw ioe;
         }
-
     }
-
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/OpenMapRealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/OpenMapRealMatrix.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/OpenMapRealMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/OpenMapRealMatrix.java Wed Nov 24 00:42:12 2010
@@ -107,8 +107,7 @@ public class OpenMapRealMatrix extends A
 
     /** {@inheritDoc} */
     @Override
-    public OpenMapRealMatrix subtract(final RealMatrix m)
-        throws IllegalArgumentException {
+    public OpenMapRealMatrix subtract(final RealMatrix m) {
         try {
             return subtract((OpenMapRealMatrix) m);
         } catch (ClassCastException cce) {
@@ -141,8 +140,7 @@ public class OpenMapRealMatrix extends A
 
     /** {@inheritDoc} */
     @Override
-    public RealMatrix multiply(final RealMatrix m)
-        throws IllegalArgumentException {
+    public RealMatrix multiply(final RealMatrix m) {
         try {
             return multiply((OpenMapRealMatrix) m);
         } catch (ClassCastException cce) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrix.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrix.java Wed Nov 24 00:42:12 2010
@@ -17,9 +17,6 @@
 
 package org.apache.commons.math.linear;
 
-import org.apache.commons.math.exception.MathUserException;
-
-
 /**
  * Interface defining a real-valued matrix with basic algebraic operations.
  * <p>
@@ -29,7 +26,6 @@ import org.apache.commons.math.exception
  * @version $Revision$ $Date$
  */
 public interface RealMatrix extends AnyMatrix {
-
     /**
      * Create a new RealMatrix of the same type as the instance with the supplied
      * row and column dimensions.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java Wed Nov 24 00:42:12 2010
@@ -17,8 +17,6 @@
 
 package org.apache.commons.math.linear;
 
-import org.apache.commons.math.exception.MathUserException;
-
 /**
  * Interface defining a visitor for matrix entries.
  *
@@ -27,7 +25,6 @@ import org.apache.commons.math.exception
  * @since 2.0
  */
 public interface RealMatrixChangingVisitor {
-
     /**
      * Start visiting a matrix.
      * <p>This method is called once before any entry of the matrix is visited.</p>

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixPreservingVisitor.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixPreservingVisitor.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixPreservingVisitor.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealMatrixPreservingVisitor.java Wed Nov 24 00:42:12 2010
@@ -17,8 +17,6 @@
 
 package org.apache.commons.math.linear;
 
-import org.apache.commons.math.exception.MathUserException;
-
 /**
  * Interface defining a visitor for matrix entries.
  *
@@ -27,7 +25,6 @@ import org.apache.commons.math.exception
  * @since 2.0
  */
 public interface RealMatrixPreservingVisitor {
-
     /**
      * Start visiting a matrix.
      * <p>This method is called once before any entry of the matrix is visited.</p>

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecomposition.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecomposition.java?rev=1038403&r1=1038402&r2=1038403&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecomposition.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecomposition.java Wed Nov 24 00:42:12 2010
@@ -111,7 +111,7 @@ public interface SingularValueDecomposit
      * @exception IllegalArgumentException if minSingularValue is larger than
      * the largest singular value, meaning all singular values are ignored
      */
-    RealMatrix getCovariance(double minSingularValue) throws IllegalArgumentException;
+    RealMatrix getCovariance(double minSingularValue);
 
     /**
      * Returns the L<sub>2</sub> norm of the matrix.



Mime
View raw message