You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2010/10/27 15:16:58 UTC

svn commit: r1027952 [4/5] - 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/ test/java/org...

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=1027952&r1=1027951&r2=1027952&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 Oct 27 13:16:57 2010
@@ -134,7 +134,8 @@ public interface RealMatrix extends AnyM
      * @param endColumn Final column index (inclusive)
      * @return The subMatrix containing the data of the
      *         specified rows and columns
-     * @exception MatrixIndexException  if the indices are not valid
+     * @throws org.apache.commons.math.exception.OutOfRangeException if
+     * the indices are not valid.
      */
     RealMatrix getSubMatrix(int startRow, int endRow, int startColumn, int endColumn);
 
@@ -146,7 +147,8 @@ public interface RealMatrix extends AnyM
     * @param selectedColumns Array of column indices.
     * @return The subMatrix containing the data in the
     *         specified rows and columns
-    * @exception MatrixIndexException if row or column selections are not valid
+    * @throws org.apache.commons.math.exception.OutOfRangeException if
+    * the indices are not valid.
     */
     RealMatrix getSubMatrix(int[] selectedRows, int[] selectedColumns);
 
@@ -160,22 +162,24 @@ public interface RealMatrix extends AnyM
     * @param endColumn Final column index (inclusive)
     * @param destination The arrays where the submatrix data should be copied
     * (if larger than rows/columns counts, only the upper-left part will be used)
-    * @exception MatrixIndexException if the indices are not valid
+    * @throws org.apache.commons.math.exception.OutOfRangeException if the
+    * indices are not valid.
     * @exception IllegalArgumentException if the destination array is too small
     */
-  void copySubMatrix(int startRow, int endRow, int startColumn, int endColumn,
-                     double[][] destination);
-  /**
-   * Copy a submatrix. Rows and columns are indicated
-   * counting from 0 to n-1.
-   *
-    * @param selectedRows Array of row indices.
-    * @param selectedColumns Array of column indices.
-   * @param destination The arrays where the submatrix data should be copied
-   * (if larger than rows/columns counts, only the upper-left part will be used)
-   * @exception MatrixIndexException if the indices are not valid
-   * @exception IllegalArgumentException if the destination array is too small
-   */
+    void copySubMatrix(int startRow, int endRow, int startColumn, int endColumn,
+                       double[][] destination);
+    /**
+     * Copy a submatrix. Rows and columns are indicated
+     * counting from 0 to n-1.
+     *
+     * @param selectedRows Array of row indices.
+     * @param selectedColumns Array of column indices.
+     * @param destination The arrays where the submatrix data should be copied
+     * (if larger than rows/columns counts, only the upper-left part will be used)
+     * @throws org.apache.commons.math.exception.OutOfRangeException if the
+     * indices are not valid.
+     * @exception IllegalArgumentException if the destination array is too small
+     */
     void copySubMatrix(int[] selectedRows, int[] selectedColumns, double[][] destination);
 
    /**
@@ -198,58 +202,67 @@ public interface RealMatrix extends AnyM
     * @param subMatrix  array containing the submatrix replacement data
     * @param row  row coordinate of the top, left element to be replaced
     * @param column  column coordinate of the top, left element to be replaced
-    * @throws MatrixIndexException  if subMatrix does not fit into this
-    *    matrix from element in (row, column)
-    * @throws IllegalArgumentException if <code>subMatrix</code> is not rectangular
-    *  (not all rows have the same length) or empty
-    * @throws NullPointerException if <code>subMatrix</code> is null
+    * @throws org.apache.commons.math.exception.ZeroException if
+    * {@code subMatrix} does not contain at least one column.
+    * @throws org.apache.commons.math.exception.OutOfRangeException if
+    * {@code subMatrix} does not fit into this matrix from element in
+    * {@code (row, column)}.
+    * @throws org.apache.commons.math.exception.DimensionMismatchException
+    * if {@code subMatrix} is not rectangular.
+    * (not all rows have the same length) or empty.
+    * @throws org.apache.commons.math.exception.NullArgumentException if
+    * {@code subMatrix} is {@code null}.
     * @since 2.0
     */
     void setSubMatrix(double[][] subMatrix, int row, int column);
 
    /**
-    * Returns the entries in row number <code>row</code>
+    * Geet the entries at the given row index
     * as a row matrix.  Row indices start at 0.
     *
-    * @param row the row to be fetched
-    * @return row matrix
-    * @throws MatrixIndexException if the specified row index is invalid
+    * @param row Row to be fetched.
+    * @return row Matrix.
+    * @throws org.apache.commons.math.exception.OutOfRangeException if
+    * the specified row index is invalid.
     */
    RealMatrix getRowMatrix(int row);
 
    /**
-    * Sets the entries in row number <code>row</code>
+    * Set the entries at the given row index
     * as a row matrix.  Row indices start at 0.
     *
-    * @param row the row to be set
-    * @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
+    * @param row Row to be set.
+    * @param matrix Row matrix (must have one row and the same number of
+    * columns as the instance).
+    * @throws org.apache.commons.math.exception.OutOfRangeException if the
+    * specified row index is invalid.
     * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
     * if the matrix dimensions do not match one instance row.
     */
     void setRowMatrix(int row, RealMatrix matrix);
 
    /**
-    * Returns the entries in column number <code>column</code>
+    * Get the entries at the given column index
     * as a column matrix.  Column indices start at 0.
     *
-    * @param column the column to be fetched
-    * @return column matrix
-    * @throws MatrixIndexException if the specified column index is invalid
+    * @param column Column to be fetched.
+    * @return column Matrix.
+    * @throws org.apache.commons.math.exception.OutOfRangeException if
+    * the specified column index is invalid.
     */
    RealMatrix getColumnMatrix(int column);
 
    /**
-    * Sets the entries in column number <code>column</code>
+    * Set the entries at the given column index
     * as a column matrix.  Column indices start at 0.
     *
-    * @param column the column to be set
-    * @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
+    * @param column Column to be set.
+    * @param matrix Column matrix (must have one column and the same number
+    * of rows as the instance).
+    * @throws org.apache.commons.math.exception.OutOfRangeException if
+    * the specified column index is invalid.
     * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
-    * if the matrix dimensions do not match one instance column.
+    * if the {@code matrix} dimensions do not match one instance column.
     */
     void setColumnMatrix(int column, RealMatrix matrix);
 
@@ -257,162 +270,149 @@ public interface RealMatrix extends AnyM
     * Returns the entries in row number <code>row</code>
     * as a vector.  Row indices start at 0.
     *
-    * @param row the row to be fetched
-    * @return row vector
-    * @throws MatrixIndexException if the specified row index is invalid
+    * @param row Row to be fetched.
+    * @return a row vector.
+    * @throws org.apache.commons.math.exception.OutOfRangeException if
+    * the specified row index is invalid.
     */
    RealVector getRowVector(int row);
 
    /**
-    * Sets the entries in row number <code>row</code>
+    * Set the entries at the given row index.
     * as a vector.  Row indices start at 0.
     *
-    * @param row the row to be set
+    * @param row Row to be set.
     * @param vector row vector (must have the same number of columns
-    * as the instance)
-    * @throws MatrixIndexException if the specified row index is invalid
+    * as the instance).
+    * @throws org.apache.commons.math.exception.OutOfRangeException if
+    * the specified row index is invalid.
     * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
     * if the vector dimension does not match one instance row.
     */
     void setRowVector(int row, RealVector vector);
 
    /**
-    * Returns the entries in column number <code>column</code>
+    * Get the entries at the given column index
     * as a vector.  Column indices start at 0.
     *
-    * @param column the column to be fetched
-    * @return column vector
-    * @throws MatrixIndexException if the specified column index is invalid
+    * @param column Column to be fetched.
+    * @return a column vector.
+    * @throws org.apache.commons.math.exception.OutOfRangeException if
+    * the specified column index is invalid
     */
    RealVector getColumnVector(int column);
 
    /**
-    * Sets the entries in column number <code>column</code>
+    * Set the entries at the given column index
     * as a vector.  Column indices start at 0.
     *
-    * @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
+    * @param column Column to be set.
+    * @param vector column vector (must have the same number of rows as
+    * the instance).
+    * @throws org.apache.commons.math.exception.OutOfRangeException if the
+    * specified column index is invalid.
     * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
     * if the vector dimension does not match one instance column.
     */
     void setColumnVector(int column, RealVector 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}.</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
+     * Get the entries at the given row index.
+     * Row indices start at 0.
+     *
+     * @param row Row to be fetched.
+     * @return the array of entries in the row.
+     * @throws org.apache.commons.math.exception.OutOfRangeException if the
+     * specified row index is not valid.
      */
     double[] getRow(int row);
 
     /**
-     * Sets the entries in row number <code>row</code>
+     * Set the entries at the given row index
      * as a row matrix.  Row indices start at 0.
      *
-     * @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
+     * @param row Row to be set.
+     * @param array Row matrix (must have the same number of columns as
+     * the instance)
+     * @throws org.apache.commons.math.exception.OutOfRangeException if the
+     * specified row index is invalid.
      * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
      * if the array size does not match one instance row.
      */
     void setRow(int row, double[] 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}.</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
+     * Get the entries at the given column index as an array.
+     * Column indices start at 0.
+     *
+     * @param column Column to be fetched.
+     * @return the array of entries in the column.
+     * @throws org.apache.commons.math.exception.OutOfRangeException if the
+     * specified column index is not valid.
      */
     double[] getColumn(int column);
 
     /**
-     * Sets the entries in column number <code>column</code>
-     * as a column matrix.  Column indices start at 0.
+     * Set the entries at the given column index
+     * as a column matrix array.  Column indices start at 0.
      *
-     * @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
+     * @param column Column to be set.
+     * @param array Column array (must have the same number of rows as
+     * the instance).
+     * @throws org.apache.commons.math.exception.OutOfRangeException if the
+     * specified column index is invalid.
      * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
      * if the array size does not match one instance column.
      */
     void setColumn(int column, double[] 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}</li>
-     * <li>{@code 0 <= column < columnDimension}</li>
-     * </ul>
-     * otherwise a <code>MatrixIndexException</code> is thrown.</p>
-     *
-     * @param row  row location of entry to be fetched
-     * @param column  column location of entry to be fetched
-     * @return matrix entry in row,column
-     * @throws MatrixIndexException if the row or column index is not valid
+     * Get the entry in the specified row and column.
+     * Row and column indices start at 0.
+     *
+     * @param row Row location of entry to be fetched.
+     * @param column Column location of entry to be fetched.
+     * @return the matrix entry at {@code (row, column)}.
+     * @throws org.apache.commons.math.exception.OutOfRangeException if the
+     * row or column index is not valid.
      */
     double 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}</li>
-     * <li>{@code 0 <= column < columnDimension}</li>
-     * </ul>
-     * otherwise a <code>MatrixIndexException</code> is thrown.</p>
-     *
-     * @param row  row location of entry to be set
-     * @param column  column location of entry to be set
-     * @param value matrix entry to be set in row,column
-     * @throws MatrixIndexException if the row or column index is not valid
+     * Row and column indices start at 0.
+     *
+     * @param row Row location of entry to be set.
+     * @param column Column location of entry to be set.
+     * @param value matrix entry to be set.
+     * @throws org.apache.commons.math.exception.OutOfRangeException if
+     * the row or column index is not valid
      * @since 2.0
      */
     void setEntry(int row, int column, double 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}</li>
-     * <li>{@code 0 <= column < columnDimension}</li>
-     * </ul>
-     * otherwise a <code>MatrixIndexException</code> is thrown.</p>
-     *
-     * @param row  row location of entry to be set
-     * @param column  column location of entry to be set
-     * @param increment value to add to the current matrix entry in row,column
-     * @throws MatrixIndexException if the row or column index is not valid
+     * Row and column indices start at 0.
+     *
+     * @param row Row location of entry to be set.
+     * @param column Column location of entry to be set.
+     * @param increment value to add to the matrix entry.
+     * @throws org.apache.commons.math.exception.OutOfRangeException if
+     * the row or column index is not valid.
      * @since 2.0
      */
     void addToEntry(int row, int column, double increment);
 
     /**
      * 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}</li>
-     * <li>{@code 0 <= column < columnDimension}</li>
-     * </ul>
-     * otherwise a <code>MatrixIndexException</code> is thrown.</p>
-     *
-     * @param row  row location of entry to be set
-     * @param column  column location of entry to be set
-     * @param factor multiplication factor for the current matrix entry in row,column
-     * @throws MatrixIndexException if the row or column index is not valid
+     * Row and column indices start at 0.
+     *
+     * @param row Row location of entry to be set.
+     * @param column Column location of entry to be set.
+     * @param factor Multiplication factor for the matrix entry.
+     * @throws org.apache.commons.math.exception.OutOfRangeException if
+     * the row or column index is not valid.
      * @since 2.0
      */
     void multiplyEntry(int row, int column, double factor);
@@ -513,7 +513,7 @@ public interface RealMatrix extends AnyM
      * of a row from left to right before going to the leftmost element
      * of the next row.</p>
      * @param visitor visitor used to process all matrix entries
-     * @exception  MatrixVisitorException if the visitor cannot process an entry
+     * @throws MatrixVisitorException if the visitor cannot process an entry
      * @see #walkInRowOrder(RealMatrixPreservingVisitor)
      * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)
      * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int)
@@ -536,7 +536,7 @@ public interface RealMatrix extends AnyM
      * of a row from left to right before going to the leftmost element
      * of the next row.</p>
      * @param visitor visitor used to process all matrix entries
-     * @exception  MatrixVisitorException if the visitor cannot process an entry
+     * @throws MatrixVisitorException if the visitor cannot process an entry
      * @see #walkInRowOrder(RealMatrixChangingVisitor)
      * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)
      * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int)
@@ -563,8 +563,9 @@ public interface RealMatrix extends AnyM
      * @param endRow Final row index (inclusive)
      * @param startColumn Initial column index
      * @param endColumn Final column index
-     * @exception  MatrixVisitorException if the visitor cannot process an entry
-     * @exception MatrixIndexException  if the indices are not valid
+     * @throws MatrixVisitorException if the visitor cannot process an entry
+     * @throws org.apache.commons.math.exception.OutOfRangeException if
+     * the indices are not valid.
      * @see #walkInRowOrder(RealMatrixChangingVisitor)
      * @see #walkInRowOrder(RealMatrixPreservingVisitor)
      * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int)
@@ -592,8 +593,9 @@ public interface RealMatrix extends AnyM
      * @param endRow Final row index (inclusive)
      * @param startColumn Initial column index
      * @param endColumn Final column index
-     * @exception  MatrixVisitorException if the visitor cannot process an entry
-     * @exception MatrixIndexException  if the indices are not valid
+     * @throws MatrixVisitorException if the visitor cannot process an entry
+     * @throws org.apache.commons.math.exception.OutOfRangeException if
+     * the indices are not valid.
      * @see #walkInRowOrder(RealMatrixChangingVisitor)
      * @see #walkInRowOrder(RealMatrixPreservingVisitor)
      * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)
@@ -617,7 +619,7 @@ public interface RealMatrix extends AnyM
      * of a column from top to bottom before going to the topmost element
      * of the next column.</p>
      * @param visitor visitor used to process all matrix entries
-     * @exception  MatrixVisitorException if the visitor cannot process an entry
+     * @throws MatrixVisitorException if the visitor cannot process an entry
      * @see #walkInRowOrder(RealMatrixChangingVisitor)
      * @see #walkInRowOrder(RealMatrixPreservingVisitor)
      * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)
@@ -640,7 +642,7 @@ public interface RealMatrix extends AnyM
      * of a column from top to bottom before going to the topmost element
      * of the next column.</p>
      * @param visitor visitor used to process all matrix entries
-     * @exception  MatrixVisitorException if the visitor cannot process an entry
+     * @throws MatrixVisitorException if the visitor cannot process an entry
      * @see #walkInRowOrder(RealMatrixChangingVisitor)
      * @see #walkInRowOrder(RealMatrixPreservingVisitor)
      * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)
@@ -667,8 +669,9 @@ public interface RealMatrix extends AnyM
      * @param endRow Final row index (inclusive)
      * @param startColumn Initial column index
      * @param endColumn Final column index
-     * @exception  MatrixVisitorException if the visitor cannot process an entry
-     * @exception MatrixIndexException  if the indices are not valid
+     * @throws MatrixVisitorException if the visitor cannot process an entry
+     * @throws org.apache.commons.math.exception.OutOfRangeException if
+     * the indices are not valid.
      * @see #walkInRowOrder(RealMatrixChangingVisitor)
      * @see #walkInRowOrder(RealMatrixPreservingVisitor)
      * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)
@@ -696,8 +699,9 @@ public interface RealMatrix extends AnyM
      * @param endRow Final row index (inclusive)
      * @param startColumn Initial column index
      * @param endColumn Final column index
-     * @exception  MatrixVisitorException if the visitor cannot process an entry
-     * @exception MatrixIndexException  if the indices are not valid
+     * @throws MatrixVisitorException if the visitor cannot process an entry
+     * @throws org.apache.commons.math.exception.OutOfRangeException if
+     * the indices are not valid.
      * @see #walkInRowOrder(RealMatrixChangingVisitor)
      * @see #walkInRowOrder(RealMatrixPreservingVisitor)
      * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)
@@ -720,7 +724,7 @@ public interface RealMatrix extends AnyM
      * <p>The fastest walking order depends on the exact matrix class. It may be
      * different from traditional row or column orders.</p>
      * @param visitor visitor used to process all matrix entries
-     * @exception  MatrixVisitorException if the visitor cannot process an entry
+     * @throws MatrixVisitorException if the visitor cannot process an entry
      * @see #walkInRowOrder(RealMatrixChangingVisitor)
      * @see #walkInRowOrder(RealMatrixPreservingVisitor)
      * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)
@@ -742,7 +746,7 @@ public interface RealMatrix extends AnyM
      * <p>The fastest walking order depends on the exact matrix class. It may be
      * different from traditional row or column orders.</p>
      * @param visitor visitor used to process all matrix entries
-     * @exception  MatrixVisitorException if the visitor cannot process an entry
+     * @throws MatrixVisitorException if the visitor cannot process an entry
      * @see #walkInRowOrder(RealMatrixChangingVisitor)
      * @see #walkInRowOrder(RealMatrixPreservingVisitor)
      * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)
@@ -768,8 +772,9 @@ public interface RealMatrix extends AnyM
      * @param endRow Final row index (inclusive)
      * @param startColumn Initial column index
      * @param endColumn Final column index (inclusive)
-     * @exception  MatrixVisitorException if the visitor cannot process an entry
-     * @exception MatrixIndexException  if the indices are not valid
+     * @throws MatrixVisitorException if the visitor cannot process an entry
+     * @throws org.apache.commons.math.exception.OutOfRangeException if
+     * the indices are not valid.
      * @see #walkInRowOrder(RealMatrixChangingVisitor)
      * @see #walkInRowOrder(RealMatrixPreservingVisitor)
      * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)
@@ -796,8 +801,9 @@ public interface RealMatrix extends AnyM
      * @param endRow Final row index (inclusive)
      * @param startColumn Initial column index
      * @param endColumn Final column index (inclusive)
-     * @exception  MatrixVisitorException if the visitor cannot process an entry
-     * @exception MatrixIndexException  if the indices are not valid
+     * @throws MatrixVisitorException if the visitor cannot process an entry
+     * @throws org.apache.commons.math.exception.OutOfRangeException if the
+     * indices are not valid.
      * @see #walkInRowOrder(RealMatrixChangingVisitor)
      * @see #walkInRowOrder(RealMatrixPreservingVisitor)
      * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int)

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealVector.java?rev=1027952&r1=1027951&r2=1027952&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealVector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealVector.java Wed Oct 27 13:16:57 2010
@@ -46,202 +46,234 @@ import org.apache.commons.math.analysis.
  * @since 2.0
  */
 public interface RealVector {
-
     /**
      * Acts as if it is implemented as:
-     * Entry e = null;
-     * for(Iterator<Entry> it = iterator(); it.hasNext(); e = it.next()) {
-     *   e.setValue(function.value(e.getValue()));
-     * }
-     * @param function to apply to each successive entry
-     * @return this vector
-     * @throws FunctionEvaluationException if function throws it on application to any entry
+     * <pre>
+     *  Entry e = null;
+     *  for(Iterator<Entry> it = iterator(); it.hasNext(); e = it.next()) {
+     *      e.setValue(function.value(e.getValue()));
+     *  }
+     * </pre>
+     *
+     * @param function Function to apply to each entry.
+     * @return this vector.
+     * @throws FunctionEvaluationException if the function throws it.
      */
     RealVector mapToSelf(UnivariateRealFunction function) throws FunctionEvaluationException;
 
     /**
      * Acts as if implemented as:
-     * return copy().map(function);
-     * @param function to apply to each successive entry
-     * @return a new vector
-     * @throws FunctionEvaluationException if function throws it on application to any entry
+     * <pre>
+     *  return copy().map(function);
+     * </pre>
+     *
+     * @param function Functin to apply to each entry.
+     * @return a new vector.
+     * @throws FunctionEvaluationException if the function throws it.
      */
     RealVector map(UnivariateRealFunction function) throws FunctionEvaluationException;
 
     /** Class representing a modifiable entry in the vector. */
     public abstract class Entry {
-
         /** Index of the entry. */
         private int index;
 
-        /** Get the value of the entry.
-         * @return value of the entry
+        /**
+         * Get the value of the entry.
+         *
+         * @return the value of the entry.
          */
         public abstract double getValue();
-
-        /** Set the value of the entry.
-         * @param value new value for the entry
+        /**
+         * Set the value of the entry.
+         *
+         * @param value New value for the entry.
          */
         public abstract void setValue(double value);
-
-        /** Get the index of the entry.
-         * @return index of the entry
+        /**
+         * Get the index of the entry.
+         *
+         * @return the index of the entry.
          */
         public int getIndex() {
             return index;
         }
-
-        /** Set the index of the entry.
-         * @param index new index for the entry
+        /**
+         * Set the index of the entry.
+         *
+         * @param index New index for the entry.
          */
         public void setIndex(int index) {
             this.index = index;
         }
-
     }
 
     /**
-     * Generic dense iterator - starts with index == zero, and hasNext() == true until index == getDimension();
+     * Generic dense iterator.
+     * It iterates in increasing order of the vector index.
+     *
      * @return a dense iterator
      */
     Iterator<Entry> iterator();
 
     /**
-     * Specialized implementations may choose to not iterate over all dimensions, either because those values are
-     * unset, or are equal to defaultValue(), or are small enough to be ignored for the purposes of iteration.
+     * Specialized implementations may choose to not iterate over all
+     * dimensions, either because those values are unset, or are equal
+     * to defaultValue(), or are small enough to be ignored for the
+     * purposes of iteration.
      * No guarantees are made about order of iteration.
-     * In dense implementations, this method will often delegate to {@link #iterator()}
+     * In dense implementations, this method will often delegate to
+     * {@link #iterator()}.
+     *
      * @return a sparse iterator
      */
     Iterator<Entry> sparseIterator();
 
     /**
-     * Returns a (deep) copy of this.
-     * @return vector copy
+     * Returns a (deep) copy of this vector.
+     *
+     * @return a vector copy.
      */
     RealVector copy();
 
     /**
-     * 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
+     * Compute the sum of this vector and {@code v}.
+     *
+     * @param v Vector to be added.
+     * @return {@code this} + {@code v}.
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      */
-    RealVector add(RealVector v)
-        throws IllegalArgumentException;
+    RealVector add(RealVector v);
 
     /**
-     * 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
+     * Compute the sum of this vector and {@code v}.
+     *
+     * @param v Vector to be added.
+     * @return {@code this} + {@code v}.
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      */
-    RealVector add(double[] v)
-        throws IllegalArgumentException;
+    RealVector add(double[] v);
+
 
     /**
-     * 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} - {@code v}.
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      */
-    RealVector subtract(RealVector v)
-        throws IllegalArgumentException;
+    RealVector subtract(RealVector v);
 
     /**
-     * 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} - {@code v}.
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      */
-    RealVector subtract(double[] v)
-        throws IllegalArgumentException;
+    RealVector subtract(double[] v);
 
     /**
-     * Map an addition operation to each entry.
-     * @param d value to be added to each entry
-     * @return this + d
+     * Add a value to each entry.
+     *
+     * @param d Value to be added to each entry.
+     * @return {@code this} + {@code d}.
      */
     RealVector mapAdd(double d);
 
     /**
-     * Map an addition operation to each entry.
-     * <p>The instance <strong>is</strong> changed by this method.</p>
-     * @param d value to be added to each entry
-     * @return for convenience, return this
+     * Add a value to each entry.
+     * The instance is changed in-place.
+     *
+     * @param d Value to be added to each entry.
+     * @return {@code this}.
      */
     RealVector mapAddToSelf(double d);
 
     /**
-     * Map a subtraction operation to each entry.
-     * @param d value to be subtracted to each entry
-     * @return this - d
+     * Subtract a value from each entry.
+     *
+     * @param d Value to be subtracted.
+     * @return {@code this} - {@code d}.
      */
     RealVector mapSubtract(double d);
 
     /**
-     * Map a subtraction operation to each entry.
-     * <p>The instance <strong>is</strong> changed by this method.</p>
-     * @param d value to be subtracted to each entry
-     * @return for convenience, return this
+     * Subtract a value from each entry.
+     * The instance is changed in-place.
+     *
+     * @param d Value to be subtracted.
+     * @return {@code this}.
      */
     RealVector mapSubtractToSelf(double d);
 
     /**
-     * Map a multiplication operation to each entry.
-     * @param d value to multiply all entries by
-     * @return this * d
+     * Multiply each entry.
+     *
+     * @param d Multiplication factor.
+     * @return {@code this} * {@code d}.
      */
     RealVector mapMultiply(double d);
 
     /**
-     * Map a multiplication operation to each entry.
-     * <p>The instance <strong>is</strong> changed by this method.</p>
-     * @param d value to multiply all entries by
-     * @return for convenience, return this
+     * Multiply each entry.
+     * The instance is changed in-place.
+     *
+     * @param d Multiplication factor.
+     * @return {@code this}.
      */
     RealVector mapMultiplyToSelf(double d);
 
     /**
-     * Map a division operation to each entry.
-     * @param d value to divide all entries by
-     * @return this / d
+     * Divide each entry.
+     *
+     * @param d Value to divide by.
+     * @return {@code this} / {@code d}.
      */
     RealVector mapDivide(double d);
 
     /**
-     * Map a division operation to each entry.
-     * <p>The instance <strong>is</strong> changed by this method.</p>
-     * @param d value to divide all entries by
-     * @return for convenience, return this
+     * Divide each entry.
+     * The instance is changed in-place.
+     *
+     * @param d Value to divide by.
+     * @return {@code this}.
      */
     RealVector mapDivideToSelf(double d);
 
     /**
      * Map a power operation to each entry.
-     * @param d value to raise all entries to
-     * @return this ^ d
+     *
+     * @param d Operator value.
+     * @return a mapped copy of the vector.
      */
     RealVector mapPow(double d);
 
     /**
      * Map a power operation to each entry.
-     * <p>The instance <strong>is</strong> changed by this method.</p>
-     * @param d value to raise all entries to
-     * @return for convenience, return this
+     * The instance is changed in-place.
+     *
+     * @param d Operator value.
+     * @return the mapped vector.
      */
     RealVector mapPowToSelf(double d);
 
     /**
      * Map the {@link Math#exp(double)} function to each entry.
-     * @return a vector containing the result of applying the function to each entry
+     *
+     * @return a mapped copy of the vector.
      */
     RealVector mapExp();
 
     /**
-     * Map the {@link Math#exp(double)} function to each entry.
-     * <p>The instance <strong>is</strong> changed by this method.</p>
-     * @return for convenience, return this
+     * Map {@link Math#exp(double)} operation to each entry.
+     * The instance is changed in-place.
+     *
+     * @return the mapped vector.
      */
     RealVector mapExpToSelf();
 
@@ -535,33 +567,37 @@ public interface RealVector {
      * 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
-     * @throws IllegalArgumentException if v is not the same size as this
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      */
-    RealVector ebeMultiply(RealVector v) throws IllegalArgumentException;
+    RealVector ebeMultiply(RealVector v);
 
     /**
      * 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
-     * @throws IllegalArgumentException if v is not the same size as this
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      */
-    RealVector ebeMultiply(double[] v) throws IllegalArgumentException;
+    RealVector ebeMultiply(double[] v);
 
     /**
      * 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
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      */
-    RealVector ebeDivide(RealVector v) throws IllegalArgumentException;
+    RealVector ebeDivide(RealVector v);
 
     /**
      * 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
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      */
-    RealVector ebeDivide(double[] v) throws IllegalArgumentException;
+    RealVector ebeDivide(double[] v);
 
     /**
      * Returns vector entries as a double array.
@@ -573,19 +609,19 @@ public interface RealVector {
      * Compute the dot product.
      * @param v vector with which dot product should be computed
      * @return the scalar dot product between instance and v
-     * @exception IllegalArgumentException if v is not the same size as this
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      */
-    double dotProduct(RealVector v)
-        throws IllegalArgumentException;
+    double dotProduct(RealVector v);
 
     /**
      * Compute the dot product.
      * @param v vector with which dot product should be computed
      * @return the scalar dot product between instance and v
-     * @exception IllegalArgumentException if v is not the same size as this
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      */
-    double dotProduct(double[] v)
-        throws IllegalArgumentException;
+    double dotProduct(double[] v);
 
     /**
      * Returns the L<sub>2</sub> norm of the vector.
@@ -627,13 +663,13 @@ public interface RealVector {
      * elements differences, or euclidian distance.</p>
      * @param v vector to which distance is requested
      * @return distance between two vectors.
-     * @exception IllegalArgumentException if v is not the same size as this
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      * @see #getL1Distance(RealVector)
      * @see #getLInfDistance(RealVector)
      * @see #getNorm()
      */
-    double getDistance(RealVector v)
-        throws IllegalArgumentException;
+    double getDistance(RealVector v);
 
     /**
      * Distance between two vectors.
@@ -642,13 +678,13 @@ public interface RealVector {
      * elements differences, or euclidian distance.</p>
      * @param v vector to which distance is requested
      * @return distance between two vectors.
-     * @exception IllegalArgumentException if v is not the same size as this
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      * @see #getL1Distance(double[])
      * @see #getLInfDistance(double[])
      * @see #getNorm()
      */
-    double getDistance(double[] v)
-        throws IllegalArgumentException;
+    double getDistance(double[] v);
 
     /**
      * Distance between two vectors.
@@ -657,13 +693,13 @@ public interface RealVector {
      * elements differences.</p>
      * @param v vector to which distance is requested
      * @return distance between two vectors.
-     * @exception IllegalArgumentException if v is not the same size as this
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      * @see #getDistance(RealVector)
      * @see #getLInfDistance(RealVector)
      * @see #getL1Norm()
      */
-    double getL1Distance(RealVector v)
-        throws IllegalArgumentException;
+    double getL1Distance(RealVector v);
 
     /**
      * Distance between two vectors.
@@ -672,13 +708,13 @@ public interface RealVector {
      * elements differences.</p>
      * @param v vector to which distance is requested
      * @return distance between two vectors.
-     * @exception IllegalArgumentException if v is not the same size as this
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      * @see #getDistance(double[])
      * @see #getLInfDistance(double[])
      * @see #getL1Norm()
      */
-    double getL1Distance(double[] v)
-        throws IllegalArgumentException;
+    double getL1Distance(double[] v);
 
     /**
      * Distance between two vectors.
@@ -687,13 +723,13 @@ public interface RealVector {
      * elements differences.</p>
      * @param v vector to which distance is requested
      * @return distance between two vectors.
-     * @exception IllegalArgumentException if v is not the same size as this
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      * @see #getDistance(RealVector)
      * @see #getL1Distance(RealVector)
      * @see #getLInfNorm()
      */
-    double getLInfDistance(RealVector v)
-        throws IllegalArgumentException;
+    double getLInfDistance(RealVector v);
 
     /**
      * Distance between two vectors.
@@ -702,13 +738,13 @@ public interface RealVector {
      * elements differences.</p>
      * @param v vector to which distance is requested
      * @return distance between two vectors.
-     * @exception IllegalArgumentException if v is not the same size as this
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      * @see #getDistance(double[])
      * @see #getL1Distance(double[])
      * @see #getLInfNorm()
      */
-    double getLInfDistance(double[] v)
-        throws IllegalArgumentException;
+    double getLInfDistance(double[] v);
 
     /** Creates a unit vector pointing in the direction of this vector.
      * <p>The instance is not changed by this method.</p>
@@ -719,68 +755,65 @@ public interface RealVector {
 
     /** Converts this vector into a unit vector.
      * <p>The instance itself is changed by this method.</p>
-     * @exception ArithmeticException if the norm is null
+     * @throws  org.apache.commons.math.exception.MathArithmeticException
+     * if the norm is zero.
      */
     void unitize();
 
     /** Find the orthogonal projection of this vector onto another vector.
      * @param v vector onto which instance must be projected
      * @return projection of the instance onto v
-     * @throws IllegalArgumentException if v is not the same size as this
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      */
-    RealVector projection(RealVector v)
-        throws IllegalArgumentException;
+    RealVector projection(RealVector v);
 
     /** Find the orthogonal projection of this vector onto another vector.
      * @param v vector onto which instance must be projected
      * @return projection of the instance onto v
-     * @throws IllegalArgumentException if v is not the same size as this
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      */
-    RealVector projection(double[] v)
-        throws IllegalArgumentException;
+    RealVector projection(double[] v);
 
     /**
      * 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
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      */
-    RealMatrix outerProduct(RealVector v)
-        throws IllegalArgumentException;
+    RealMatrix outerProduct(RealVector v);
 
     /**
      * 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
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if {@code v} is not the same size as this vector.
      */
-    RealMatrix outerProduct(double[] v)
-        throws IllegalArgumentException;
+    RealMatrix outerProduct(double[] v);
 
     /**
      * Returns the entry in the specified index.
-     * <p>
-     * The index start at 0 and must be lesser than the size,
-     * otherwise a {@link MatrixIndexException} is thrown.
-     * </p>
-     * @param index  index location of entry to be fetched
-     * @return vector entry at index
-     * @throws MatrixIndexException if the index is not valid
+     *
+     * @param index Index location of entry to be fetched.
+     * @return the vector entry at {@code index}.
+     * @throws org.apache.commons.math.exception.OutOfRangeException
+     * if the index is not valid.
      * @see #setEntry(int, double)
      */
-    double getEntry(int index)
-        throws MatrixIndexException;
+    double getEntry(int index);
 
     /**
      * Set a single element.
      * @param index element index.
      * @param value new value for the element.
-     * @exception MatrixIndexException if the index is
-     * inconsistent with vector size
+     * @throws org.apache.commons.math.exception.OutOfRangeException
+     * if the index is not valid.
      * @see #getEntry(int)
      */
-    void setEntry(int index, double value)
-        throws MatrixIndexException;
+    void setEntry(int index, double value);
 
     /**
      * Returns the size of the vector.
@@ -814,33 +847,30 @@ public interface RealVector {
      * @param index index of first element.
      * @param n number of elements to be retrieved.
      * @return a vector containing n elements.
-     * @exception MatrixIndexException if the index is
-     * inconsistent with vector size
+     * @throws org.apache.commons.math.exception.OutOfRangeException
+     * if the index is not valid.
      */
-    RealVector getSubVector(int index, int n)
-        throws MatrixIndexException;
+    RealVector getSubVector(int index, int n);
 
     /**
      * Set a set of consecutive elements.
      * @param index index of first element to be set.
      * @param v vector containing the values to set.
-     * @exception MatrixIndexException if the index is
-     * inconsistent with vector size
+     * @throws org.apache.commons.math.exception.OutOfRangeException
+     * if the index is not valid.
      * @see #setSubVector(int, double[])
      */
-    void setSubVector(int index, RealVector v)
-        throws MatrixIndexException;
+    void setSubVector(int index, RealVector v);
 
     /**
      * Set a set of consecutive elements.
      * @param index index of first element to be set.
      * @param v vector containing the values to set.
-     * @exception MatrixIndexException if the index is
-     * inconsistent with vector size
+     * @throws org.apache.commons.math.exception.OutOfRangeException
+     * if the index is not valid.
      * @see #setSubVector(int, RealVector)
      */
-    void setSubVector(int index, double[] v)
-        throws MatrixIndexException;
+    void setSubVector(int index, double[] v);
 
     /**
      * Set all elements to a single value.
@@ -857,17 +887,17 @@ public interface RealVector {
     double[] toArray();
 
     /**
-     * Returns true if any coordinate of this vector is NaN; false otherwise
-     * @return  true if any coordinate of this vector is NaN; false otherwise
+     * Check whether any coordinate of this vector is {@code NaN}.
+     * @return {@code true} if any coordinate of this vector is {@code NaN},
+     * {@code false} otherwise.
      */
     boolean isNaN();
 
     /**
-     * Returns true if any coordinate of this vector is infinite and none are NaN;
-     * false otherwise
-     * @return  true if any coordinate of this vector is infinite and none are NaN;
-     * false otherwise
+     * Check whether any coordinate of this vector is infinite and none are {@code NaN}.
+     *
+     * @return {@code true} if any coordinate of this vector is infinite and
+     * none are {@code NaN}, {@code false} otherwise.
      */
     boolean isInfinite();
-
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldMatrix.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldMatrix.java?rev=1027952&r1=1027951&r2=1027952&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldMatrix.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldMatrix.java Wed Oct 27 13:16:57 2010
@@ -28,25 +28,19 @@ import org.apache.commons.math.util.Open
  * @since 2.0
  */
 public class SparseFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMatrix<T> {
-    /**
-     *  Serial id
-     */
+    /** Serialization identifier. */
     private static final long serialVersionUID = 9078068119297757342L;
     /** Storage for (sparse) matrix elements. */
     private final OpenIntToFieldHashMap<T> entries;
-    /**
-     * row dimension
-     */
+    /** Row dimension. */
     private final int rows;
-    /**
-     * column dimension
-     */
+    /** Column dimension. */
     private final int columns;
 
-
     /**
-     * Creates a matrix with no data.
-     * @param field field to which the elements belong
+     * Create a matrix with no data.
+     *
+     * @param field Field to which the elements belong.
      */
     public SparseFieldMatrix(final Field<T> field) {
         super(field);
@@ -56,16 +50,17 @@ public class SparseFieldMatrix<T extends
     }
 
     /**
-     * Create a new SparseFieldMatrix<T> with the supplied row and column dimensions.
+     * Create a new SparseFieldMatrix<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 SparseFieldMatrix(final Field<T> field,
-                             final int rowDimension, final int columnDimension)
-        throws IllegalArgumentException {
+                             final int rowDimension, final int columnDimension) {
         super(field, rowDimension, columnDimension);
         this.rows = rowDimension;
         this.columns = columnDimension;
@@ -74,7 +69,8 @@ public class SparseFieldMatrix<T extends
 
     /**
      * Copy constructor.
-     * @param other The instance to copy
+     *
+     * @param other Instance to copy.
      */
     public SparseFieldMatrix(SparseFieldMatrix<T> other) {
         super(other.getField(), other.getRowDimension(), other.getColumnDimension());
@@ -85,7 +81,8 @@ public class SparseFieldMatrix<T extends
 
     /**
      * Generic copy constructor.
-     * @param other The instance to copy
+     *
+     * @param other Instance to copy.
      */
     public SparseFieldMatrix(FieldMatrix<T> other){
         super(other.getField(), other.getRowDimension(), other.getColumnDimension());
@@ -101,8 +98,7 @@ public class SparseFieldMatrix<T extends
 
     /** {@inheritDoc} */
     @Override
-    public void addToEntry(int row, int column, T increment)
-            throws MatrixIndexException {
+    public void addToEntry(int row, int column, T increment) {
         checkRowIndex(row);
         checkColumnIndex(column);
         final int key = computeKey(row, column);
@@ -112,7 +108,6 @@ public class SparseFieldMatrix<T extends
         } else {
             entries.put(key, value);
         }
-
     }
 
     /** {@inheritDoc} */
@@ -123,8 +118,7 @@ public class SparseFieldMatrix<T extends
 
     /** {@inheritDoc} */
     @Override
-    public FieldMatrix<T> createMatrix(int rowDimension, int columnDimension)
-            throws IllegalArgumentException {
+    public FieldMatrix<T> createMatrix(int rowDimension, int columnDimension) {
         return new SparseFieldMatrix<T>(getField(), rowDimension, columnDimension);
     }
 
@@ -136,7 +130,7 @@ public class SparseFieldMatrix<T extends
 
     /** {@inheritDoc} */
     @Override
-    public T getEntry(int row, int column) throws MatrixIndexException {
+    public T getEntry(int row, int column) {
         checkRowIndex(row);
         checkColumnIndex(column);
         return entries.get(computeKey(row, column));
@@ -150,8 +144,7 @@ public class SparseFieldMatrix<T extends
 
     /** {@inheritDoc} */
     @Override
-    public void multiplyEntry(int row, int column, T factor)
-            throws MatrixIndexException {
+    public void multiplyEntry(int row, int column, T factor) {
         checkRowIndex(row);
         checkColumnIndex(column);
         final int key = computeKey(row, column);
@@ -166,8 +159,7 @@ public class SparseFieldMatrix<T extends
 
     /** {@inheritDoc} */
     @Override
-    public void setEntry(int row, int column, T value)
-            throws MatrixIndexException {
+    public void setEntry(int row, int column, T value) {
         checkRowIndex(row);
         checkColumnIndex(column);
         if (getField().getZero().equals(value)) {
@@ -175,16 +167,16 @@ public class SparseFieldMatrix<T extends
         } else {
             entries.put(computeKey(row, column), value);
         }
-
     }
+
     /**
-     * Compute the key to access a matrix element
-     * @param row row index of the matrix element
-     * @param column column index of the matrix element
-     * @return key within the map to access the matrix element
+     * Compute the key to access a matrix element.
+     *
+     * @param row Row index of the matrix element.
+     * @param column Column index of the matrix element.
+     * @return the key within the map to access the matrix element.
      */
     private int computeKey(int row, int column) {
         return row * columns + column;
     }
-
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java?rev=1027952&r1=1027951&r2=1027952&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java Wed Oct 27 13:16:57 2010
@@ -21,8 +21,8 @@ import java.lang.reflect.Array;
 
 import org.apache.commons.math.Field;
 import org.apache.commons.math.FieldElement;
-import org.apache.commons.math.MathRuntimeException;
-import org.apache.commons.math.exception.util.LocalizedFormats;
+import org.apache.commons.math.exception.OutOfRangeException;
+import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.util.OpenIntToFieldHashMap;
 
 /**
@@ -32,10 +32,7 @@ import org.apache.commons.math.util.Open
  * @since 2.0
  */
 public class SparseFieldVector<T extends FieldElement<T>> implements FieldVector<T>, Serializable {
-
-    /**
-     *  Serial version id
-     */
+    /**  Serialization identifier. */
     private static final long serialVersionUID = 7841233292190413362L;
     /** Field to which the elements belong. */
     private final Field<T> field;
@@ -46,13 +43,14 @@ public class SparseFieldVector<T extends
 
     /**
      * Build a 0-length vector.
-     * <p>Zero-length vectors may be used to initialize construction of vectors
+     * Zero-length vectors may be used to initialize construction of vectors
      * by data gathering. We start with zero-length and use either the {@link
      * #SparseFieldVector(SparseFieldVector, int)} constructor
-     * or one of the <code>append</code> method ({@link #append(FieldElement)},
+     * or one of the {@code append} method ({@link #append(FieldElement)},
      * {@link #append(FieldElement[])}, {@link #append(FieldVector)},
-     * {@link #append(SparseFieldVector)}) to gather data into this vector.</p>
-     * @param field field to which the elements belong
+     * {@link #append(SparseFieldVector)}) to gather data into this vector.
+     *
+     * @param field Field to which the elements belong.
      */
     public SparseFieldVector(Field<T> field) {
         this(field, 0);
@@ -60,9 +58,10 @@ public class SparseFieldVector<T extends
 
 
     /**
-     * Construct a (dimension)-length vector of zeros.
-     * @param field field to which the elements belong
-     * @param dimension Size of the vector
+     * Construct a vector of zeroes.
+     *
+     * @param field Field to which the elements belong.
+     * @param dimension Size of the vector.
      */
     public SparseFieldVector(Field<T> field, int dimension) {
         this.field = field;
@@ -72,8 +71,9 @@ public class SparseFieldVector<T extends
 
     /**
      * Build a resized vector, for use with append.
-     * @param v The original vector
-     * @param resize The amount to resize it
+     *
+     * @param v Original vector
+     * @param resize Amount to add.
      */
     protected SparseFieldVector(SparseFieldVector<T> v, int resize) {
         field = v.field;
@@ -84,9 +84,10 @@ public class SparseFieldVector<T extends
 
     /**
      * Build a vector with known the sparseness (for advanced use only).
-     * @param field field to which the elements belong
-     * @param dimension The size of the vector
-     * @param expectedSize The expected number of non-zero entries
+     *
+     * @param field Field to which the elements belong.
+     * @param dimension Size of the vector.
+     * @param expectedSize Expected number of non-zero entries.
      */
     public SparseFieldVector(Field<T> field, int dimension, int expectedSize) {
         this.field = field;
@@ -96,9 +97,10 @@ public class SparseFieldVector<T extends
 
     /**
      * Create from a Field array.
-     * Only non-zero entries will be stored
-     * @param field field to which the elements belong
-     * @param values The set of values to create from
+     * Only non-zero entries will be stored.
+     *
+     * @param field Field to which the elements belong.
+     * @param values Set of values to create from.
      */
     public SparseFieldVector(Field<T> field, T[] values) {
         this.field = field;
@@ -110,11 +112,10 @@ public class SparseFieldVector<T extends
         }
     }
 
-
-
     /**
      * Copy constructor.
-     * @param v The instance to copy from
+     *
+     * @param v Instance to copy.
      */
     public SparseFieldVector(SparseFieldVector<T> v) {
         field = v.field;
@@ -124,7 +125,8 @@ public class SparseFieldVector<T extends
 
     /**
      * Get the entries of this instance.
-     * @return entries of this instance
+     *
+     * @return the entries of this instance
      */
     private OpenIntToFieldHashMap<T> getEntries() {
         return entries;
@@ -132,11 +134,13 @@ public class SparseFieldVector<T extends
 
     /**
      * Optimized method to add sparse vectors.
-     * @param v vector to add
-     * @return The sum of <code>this</code> and <code>v</code>
-     * @throws IllegalArgumentException If the dimensions don't match
+     *
+     * @param v Vector to add.
+     * @return the sum of {@code this} and {@code v}.
+     * @throws DimensionMismatchException
+     * if the dimensions do not match.
      */
-    public FieldVector<T> add(SparseFieldVector<T> v) throws IllegalArgumentException {
+    public FieldVector<T> add(SparseFieldVector<T> v) {
         checkVectorDimensions(v.getDimension());
         SparseFieldVector<T> res = (SparseFieldVector<T>)copy();
         OpenIntToFieldHashMap<T>.Iterator iter = v.getEntries().iterator();
@@ -156,7 +160,7 @@ public class SparseFieldVector<T extends
 
 
     /** {@inheritDoc} */
-    public FieldVector<T> add(T[] v) throws IllegalArgumentException {
+    public FieldVector<T> add(T[] v) {
         checkVectorDimensions(v.length);
         SparseFieldVector<T> res = new SparseFieldVector<T>(field,getDimension());
         for (int i = 0; i < v.length; i++) {
@@ -167,8 +171,9 @@ public class SparseFieldVector<T extends
 
     /**
      * Construct a vector by appending a vector to this vector.
-     * @param v vector to append to this one.
-     * @return a new vector
+     *
+     * @param v Vector to append to this one.
+     * @return a new vector.
      */
     public FieldVector<T> append(SparseFieldVector<T> v) {
         SparseFieldVector<T> res = new SparseFieldVector<T>(this, v.getDimension());
@@ -211,7 +216,7 @@ public class SparseFieldVector<T extends
    }
 
     /** {@inheritDoc} */
-    public T dotProduct(FieldVector<T> v) throws IllegalArgumentException {
+    public T dotProduct(FieldVector<T> v) {
         checkVectorDimensions(v.getDimension());
         T res = field.getZero();
         OpenIntToFieldHashMap<T>.Iterator iter = entries.iterator();
@@ -223,7 +228,7 @@ public class SparseFieldVector<T extends
     }
 
     /** {@inheritDoc} */
-    public T dotProduct(T[] v) throws IllegalArgumentException {
+    public T dotProduct(T[] v) {
         checkVectorDimensions(v.length);
         T res = field.getZero();
         OpenIntToFieldHashMap<T>.Iterator iter = entries.iterator();
@@ -239,8 +244,7 @@ public class SparseFieldVector<T extends
      }
 
     /** {@inheritDoc} */
-    public FieldVector<T> ebeDivide(FieldVector<T> v)
-        throws IllegalArgumentException {
+    public FieldVector<T> ebeDivide(FieldVector<T> v) {
         checkVectorDimensions(v.getDimension());
         SparseFieldVector<T> res = new SparseFieldVector<T>(this);
         OpenIntToFieldHashMap<T>.Iterator iter = res.entries.iterator();
@@ -252,7 +256,7 @@ public class SparseFieldVector<T extends
     }
 
     /** {@inheritDoc} */
-    public FieldVector<T> ebeDivide(T[] v) throws IllegalArgumentException {
+    public FieldVector<T> ebeDivide(T[] v) {
         checkVectorDimensions(v.length);
         SparseFieldVector<T> res = new SparseFieldVector<T>(this);
         OpenIntToFieldHashMap<T>.Iterator iter = res.entries.iterator();
@@ -264,7 +268,7 @@ public class SparseFieldVector<T extends
     }
 
     /** {@inheritDoc} */
-    public FieldVector<T> ebeMultiply(FieldVector<T> v)throws IllegalArgumentException {
+    public FieldVector<T> ebeMultiply(FieldVector<T> v) {
         checkVectorDimensions(v.getDimension());
         SparseFieldVector<T> res = new SparseFieldVector<T>(this);
         OpenIntToFieldHashMap<T>.Iterator iter = res.entries.iterator();
@@ -276,7 +280,7 @@ public class SparseFieldVector<T extends
     }
 
     /** {@inheritDoc} */
-     public FieldVector<T> ebeMultiply(T[] v) throws IllegalArgumentException {
+     public FieldVector<T> ebeMultiply(T[] v) {
         checkVectorDimensions(v.length);
         SparseFieldVector<T> res = new SparseFieldVector<T>(this);
         OpenIntToFieldHashMap<T>.Iterator iter = res.entries.iterator();
@@ -304,7 +308,7 @@ public class SparseFieldVector<T extends
     }
 
      /** {@inheritDoc} */
-     public T getEntry(int index) throws MatrixIndexException {
+     public T getEntry(int index) {
         checkIndex(index);
         return entries.get(index);
    }
@@ -315,8 +319,7 @@ public class SparseFieldVector<T extends
     }
 
      /** {@inheritDoc} */
-     public FieldVector<T> getSubVector(int index, int n)
-            throws MatrixIndexException {
+     public FieldVector<T> getSubVector(int index, int n) {
         checkIndex(index);
         checkIndex(index + n - 1);
         SparseFieldVector<T> res = new SparseFieldVector<T>(field,n);
@@ -398,14 +401,14 @@ public class SparseFieldVector<T extends
         return mapAddToSelf(field.getZero().subtract(d));
     }
 
-     /**
-      * Optimized method to compute outer product when both vectors are sparse.
-      * @param v vector with which outer product should be computed
-      * @return the square matrix outer product between instance and v
-      * @throws IllegalArgumentException if v is not the same size as {@code this}
-      */
-    public FieldMatrix<T> outerProduct(SparseFieldVector<T> v)
-            throws IllegalArgumentException {
+    /**
+     * Optimized method to compute outer product when both vectors are sparse.
+     * @param v vector with which outer product should be computed
+     * @return the square matrix outer product between instance and v
+     * @throws DimensionMismatchException
+     * if the dimensions do not match.
+     */
+    public FieldMatrix<T> outerProduct(SparseFieldVector<T> v) {
         checkVectorDimensions(v.getDimension());
         SparseFieldMatrix<T> res = new SparseFieldMatrix<T>(field, virtualSize, virtualSize);
         OpenIntToFieldHashMap<T>.Iterator iter = entries.iterator();
@@ -421,7 +424,7 @@ public class SparseFieldVector<T extends
     }
 
     /** {@inheritDoc} */
-    public FieldMatrix<T> outerProduct(T[] v) throws IllegalArgumentException {
+    public FieldMatrix<T> outerProduct(T[] v) {
         checkVectorDimensions(v.length);
         FieldMatrix<T> res = new SparseFieldMatrix<T>(field, virtualSize, virtualSize);
         OpenIntToFieldHashMap<T>.Iterator iter = entries.iterator();
@@ -437,8 +440,7 @@ public class SparseFieldVector<T extends
      }
 
     /** {@inheritDoc} */
-    public FieldMatrix<T> outerProduct(FieldVector<T> v)
-    throws IllegalArgumentException {
+    public FieldMatrix<T> outerProduct(FieldVector<T> v) {
         if(v instanceof SparseFieldVector<?>)
             return outerProduct((SparseFieldVector<T>)v);
         else
@@ -446,14 +448,13 @@ public class SparseFieldVector<T extends
     }
 
     /** {@inheritDoc} */
-    public FieldVector<T> projection(FieldVector<T> v)
-    throws IllegalArgumentException {
+    public FieldVector<T> projection(FieldVector<T> v) {
         checkVectorDimensions(v.getDimension());
         return v.mapMultiply(dotProduct(v).divide(v.dotProduct(v)));
     }
 
     /** {@inheritDoc} */
-    public FieldVector<T> projection(T[] v) throws IllegalArgumentException {
+    public FieldVector<T> projection(T[] v) {
         checkVectorDimensions(v.length);
         return projection(new SparseFieldVector<T>(field,v));
     }
@@ -466,21 +467,20 @@ public class SparseFieldVector<T extends
     }
 
     /** {@inheritDoc} */
-    public void setEntry(int index, T value) throws MatrixIndexException {
+    public void setEntry(int index, T value) {
         checkIndex(index);
         entries.put(index, value);
    }
 
     /** {@inheritDoc} */
-    public void setSubVector(int index, FieldVector<T> v)
-            throws MatrixIndexException {
+    public void setSubVector(int index, FieldVector<T> v) {
         checkIndex(index);
         checkIndex(index + v.getDimension() - 1);
         setSubVector(index, v.getData());
     }
 
     /** {@inheritDoc} */
-    public void setSubVector(int index, T[] v) throws MatrixIndexException {
+    public void setSubVector(int index, T[] v) {
         checkIndex(index);
         checkIndex(index + v.length - 1);
         for (int i = 0; i < v.length; i++) {
@@ -491,11 +491,13 @@ public class SparseFieldVector<T extends
 
     /**
      * Optimized method to subtract SparseRealVectors.
-     * @param v The vector to subtract from <code>this</code>
-     * @return The difference of <code>this</code> and <code>v</code>
-     * @throws IllegalArgumentException If the dimensions don't match
+     *
+     * @param v Vector to subtract.
+     * @return the difference between {@code this} and {@code v}.
+     * @throws DimensionMismatchException
+     * if the dimensions do not match.
      */
-    public SparseFieldVector<T> subtract(SparseFieldVector<T> v) throws IllegalArgumentException{
+    public SparseFieldVector<T> subtract(SparseFieldVector<T> v){
         checkVectorDimensions(v.getDimension());
         SparseFieldVector<T> res = (SparseFieldVector<T>)copy();
         OpenIntToFieldHashMap<T>.Iterator iter = v.getEntries().iterator();
@@ -512,8 +514,7 @@ public class SparseFieldVector<T extends
     }
 
     /** {@inheritDoc} */
-    public FieldVector<T> subtract(FieldVector<T> v)
-           throws IllegalArgumentException {
+    public FieldVector<T> subtract(FieldVector<T> v) {
         if(v instanceof SparseFieldVector<?>)
             return subtract((SparseFieldVector<T>)v);
         else
@@ -521,7 +522,7 @@ public class SparseFieldVector<T extends
     }
 
     /** {@inheritDoc} */
-    public FieldVector<T> subtract(T[] v) throws IllegalArgumentException {
+    public FieldVector<T> subtract(T[] v) {
         checkVectorDimensions(v.length);
         SparseFieldVector<T> res = new SparseFieldVector<T>(this);
         for (int i = 0; i < v.length; i++) {
@@ -540,39 +541,31 @@ public class SparseFieldVector<T extends
     }
 
     /**
-     * Check if an index is valid.
+     * Check whether an index is valid.
      *
-     * @param index
-     *            index to check
-     * @exception MatrixIndexException
-     *                if index is not valid
+     * @param index Index to check.
+     * @throws OutOfRangeException if the dimensions do not match.
      */
-    private void checkIndex(final int index) throws MatrixIndexException {
+    private void checkIndex(final int index) {
         if (index < 0 || index >= getDimension()) {
-            throw new MatrixIndexException(LocalizedFormats.INDEX_OUT_OF_RANGE,
-                                           index, 0, getDimension() - 1);
+            throw new OutOfRangeException(index, 0, getDimension() - 1);
         }
     }
 
     /**
      * Check if instance dimension is equal to some expected value.
      *
-     * @param n
-     *            expected dimension.
-     * @exception IllegalArgumentException
-     *                if the dimension is inconsistent with vector size
+     * @param n Expected dimension.
+     * @throws DimensionMismatchException if the dimensions do not match.
      */
-    protected void checkVectorDimensions(int n) throws IllegalArgumentException {
+    protected void checkVectorDimensions(int n) {
         if (getDimension() != n) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                    LocalizedFormats.VECTOR_LENGTH_MISMATCH,
-                    getDimension(), n);
+            throw new DimensionMismatchException(getDimension(), n);
         }
     }
 
-
     /** {@inheritDoc} */
-    public FieldVector<T> add(FieldVector<T> v) throws IllegalArgumentException {
+    public FieldVector<T> add(FieldVector<T> v) {
         if (v instanceof SparseFieldVector<?>) {
             return add((SparseFieldVector<T>)v);
         } else {
@@ -580,9 +573,11 @@ public class SparseFieldVector<T extends
         }
     }
 
-    /** Build an array of elements.
-     * @param length size of the array to build
-     * @return a new array
+    /**
+     * Build an array of elements.
+     *
+     * @param length Size of the array to build.
+     * @return a new array.
      */
     @SuppressWarnings("unchecked") // field is type T
     private T[] buildArray(final int length) {
@@ -651,7 +646,4 @@ public class SparseFieldVector<T extends
         }
         return true;
     }
-
-
-
 }

Modified: commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties?rev=1027952&r1=1027951&r2=1027952&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties (original)
+++ commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties Wed Oct 27 13:16:57 2010
@@ -84,11 +84,12 @@ IDENTICAL_ABSCISSAS_DIVISION_BY_ZERO = l
 INDEX_LARGER_THAN_MAX = l''index sp\u00e9cifi\u00e9 ({0}) d\u00e9passe l''index maximal courant ({1})
 INDEX_NOT_POSITIVE = l''indice ({0}) n''est pas positif
 INDEX_OUT_OF_RANGE = l''indice ({0}) est hors du domaine autoris\u00e9 [{1}, {2}]
+INDEX = indice ({0})
 INFINITE_ARRAY_ELEMENT = le tableau contient l''\u00e9l\u00e9ment infini {0} \u00e0 l''index {1}
 INFINITE_VALUE_CONVERSION = les valeurs infinies ne peuvent \u00eatre converties
 INITIAL_CAPACITY_NOT_POSITIVE = la capacit\u00e9 initiale ({0}) n''est pas positive
-INITIAL_COLUMN_AFTER_FINAL_COLUMN = colonne initiale {0} apr\u00e8s la colonne finale {1}
-INITIAL_ROW_AFTER_FINAL_ROW = ligne initiale {0} apr\u00e8s la ligne finale {1}
+INITIAL_COLUMN_AFTER_FINAL_COLUMN = colonne initiale {1} apr\u00e8s la colonne finale {0}
+INITIAL_ROW_AFTER_FINAL_ROW = ligne initiale {1} apr\u00e8s la ligne finale {0}
 INPUT_DATA_FROM_UNSUPPORTED_DATASOURCE = les donn\u00e9es d''entr\u00e9e proviennent 
 INSTANCES_NOT_COMPARABLE_TO_EXISTING_VALUES = l''instance de la classe {0} n''est pas comparable aux valeurs existantes
 INSUFFICIENT_DATA_FOR_T_STATISTIC = deux valeurs ou plus sont n\u00e9cessaires pour la statistique t, il y en a {0}

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java?rev=1027952&r1=1027951&r2=1027952&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java Wed Oct 27 13:16:57 2010
@@ -21,6 +21,9 @@ import junit.framework.TestCase;
 import org.apache.commons.math.TestUtils;
 import org.apache.commons.math.util.FastMath;
 import org.apache.commons.math.exception.MatrixDimensionMismatchException;
+import org.apache.commons.math.exception.OutOfRangeException;
+import org.apache.commons.math.exception.ZeroException;
+import org.apache.commons.math.exception.NumberIsTooSmallException;
 
 /**
  * Test cases for the {@link Array2DRowRealMatrix} class.
@@ -316,14 +319,14 @@ public final class Array2DRowRealMatrixT
         TestUtils.assertEquals("get col",m.getColumn(2),testDataCol3,entryTolerance);
         try {
             m.getRow(10);
-            fail("expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // ignored
         }
         try {
             m.getColumn(-1);
-            fail("expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // ignored
         }
     }
@@ -333,8 +336,8 @@ public final class Array2DRowRealMatrixT
         assertEquals("get entry",m.getEntry(0,1),2d,entryTolerance);
         try {
             m.getEntry(10, 4);
-            fail ("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail ("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
     }
@@ -394,9 +397,17 @@ public final class Array2DRowRealMatrixT
             RealMatrix sub = m.getSubMatrix(startRow, endRow, startColumn, endColumn);
             assertEquals(new Array2DRowRealMatrix(reference), sub);
             if (mustFail) {
-                fail("Expecting MatrixIndexException");
+                fail("Expecting OutOfRangeException or NumberIsTooSmallException or ZeroException");
             }
-        } catch (MatrixIndexException e) {
+        } catch (OutOfRangeException e) {
+            if (!mustFail) {
+                throw e;
+            }
+        } catch (NumberIsTooSmallException e) {
+            if (!mustFail) {
+                throw e;
+            }
+        } catch (ZeroException e) {
             if (!mustFail) {
                 throw e;
             }
@@ -410,9 +421,17 @@ public final class Array2DRowRealMatrixT
             RealMatrix sub = m.getSubMatrix(selectedRows, selectedColumns);
             assertEquals(new Array2DRowRealMatrix(reference), sub);
             if (mustFail) {
-                fail("Expecting MatrixIndexException");
+                fail("Expecting OutOfRangeException or NumberIsTooSmallException or ZeroException");
+            }
+        } catch (OutOfRangeException e) {
+            if (!mustFail) {
+                throw e;
+            }
+        } catch (NumberIsTooSmallException e) {
+            if (!mustFail) {
+                throw e;
             }
-        } catch (MatrixIndexException e) {
+        } catch (ZeroException e) {
             if (!mustFail) {
                 throw e;
             }
@@ -449,9 +468,17 @@ public final class Array2DRowRealMatrixT
             m.copySubMatrix(startRow, endRow, startColumn, endColumn, sub);
             assertEquals(new Array2DRowRealMatrix(reference), new Array2DRowRealMatrix(sub));
             if (mustFail) {
-                fail("Expecting MatrixIndexException");
+                fail("Expecting OutOfRangeException or NumberIsTooSmallException or ZeroException");
             }
-        } catch (MatrixIndexException e) {
+        } catch (OutOfRangeException e) {
+            if (!mustFail) {
+                throw e;
+            }
+        } catch (NumberIsTooSmallException e) {
+            if (!mustFail) {
+                throw e;
+            }
+        } catch (ZeroException e) {
             if (!mustFail) {
                 throw e;
             }
@@ -468,9 +495,17 @@ public final class Array2DRowRealMatrixT
             m.copySubMatrix(selectedRows, selectedColumns, sub);
             assertEquals(new Array2DRowRealMatrix(reference), new Array2DRowRealMatrix(sub));
             if (mustFail) {
-                fail("Expecting MatrixIndexException");
+                fail("Expecting OutOfRangeException or NumberIsTooSmallException or ZeroException");
+            }
+        } catch (OutOfRangeException e) {
+            if (!mustFail) {
+                throw e;
+            }
+        } catch (NumberIsTooSmallException e) {
+            if (!mustFail) {
+                throw e;
             }
-        } catch (MatrixIndexException e) {
+        } catch (ZeroException e) {
             if (!mustFail) {
                 throw e;
             }
@@ -487,14 +522,14 @@ public final class Array2DRowRealMatrixT
                 m.getRowMatrix(3));
         try {
             m.getRowMatrix(-1);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
             m.getRowMatrix(4);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
     }
@@ -507,8 +542,8 @@ public final class Array2DRowRealMatrixT
         assertEquals(mRow3, m.getRowMatrix(0));
         try {
             m.setRowMatrix(-1, mRow3);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
@@ -529,14 +564,14 @@ public final class Array2DRowRealMatrixT
                 m.getColumnMatrix(3));
         try {
             m.getColumnMatrix(-1);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
             m.getColumnMatrix(4);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
     }
@@ -549,8 +584,8 @@ public final class Array2DRowRealMatrixT
         assertEquals(mColumn3, m.getColumnMatrix(1));
         try {
             m.setColumnMatrix(-1, mColumn3);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
@@ -569,14 +604,14 @@ public final class Array2DRowRealMatrixT
         assertEquals("Row3", mRow3, m.getRowVector(3));
         try {
             m.getRowVector(-1);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
             m.getRowVector(4);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
     }
@@ -589,8 +624,8 @@ public final class Array2DRowRealMatrixT
         assertEquals(mRow3, m.getRowVector(0));
         try {
             m.setRowVector(-1, mRow3);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
@@ -609,14 +644,14 @@ public final class Array2DRowRealMatrixT
         assertEquals("Column3", mColumn3, m.getColumnVector(3));
         try {
             m.getColumnVector(-1);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
             m.getColumnVector(4);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
     }
@@ -629,8 +664,8 @@ public final class Array2DRowRealMatrixT
         assertEquals(mColumn3, m.getColumnVector(1));
         try {
             m.setColumnVector(-1, mColumn3);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
@@ -655,14 +690,14 @@ public final class Array2DRowRealMatrixT
         checkArrays(subRow3[0], m.getRow(3));
         try {
             m.getRow(-1);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
             m.getRow(4);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
     }
@@ -674,8 +709,8 @@ public final class Array2DRowRealMatrixT
         checkArrays(subRow3[0], m.getRow(0));
         try {
             m.setRow(-1, subRow3[0]);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
@@ -694,14 +729,14 @@ public final class Array2DRowRealMatrixT
         checkArrays(mColumn3, m.getColumn(3));
         try {
             m.getColumn(-1);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
             m.getColumn(4);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
     }
@@ -714,8 +749,8 @@ public final class Array2DRowRealMatrixT
         checkArrays(mColumn3, m.getColumn(1));
         try {
             m.setColumn(-1, mColumn3);
-            fail("Expecting MatrixIndexException");
-        } catch (MatrixIndexException ex) {
+            fail("Expecting OutOfRangeException");
+        } catch (OutOfRangeException ex) {
             // expected
         }
         try {
@@ -783,21 +818,21 @@ public final class Array2DRowRealMatrixT
         // dimension overflow
         try {
             m.setSubMatrix(testData,1,1);
-            fail("expecting MatrixIndexException");
-        } catch (MatrixIndexException e) {
+            fail("expecting OutOfRangeException");
+        } catch (OutOfRangeException e) {
             // expected
         }
         // dimension underflow
         try {
             m.setSubMatrix(testData,-1,1);
-            fail("expecting MatrixIndexException");
-        } catch (MatrixIndexException e) {
+            fail("expecting OutOfRangeException");
+        } catch (OutOfRangeException e) {
             // expected
         }
         try {
             m.setSubMatrix(testData,1,-1);
-            fail("expecting MatrixIndexException");
-        } catch (MatrixIndexException e) {
+            fail("expecting OutOfRangeException");
+        } catch (OutOfRangeException e) {
             // expected
         }