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/09/25 01:12:35 UTC
svn commit: r1001107 [2/2] - in /commons/proper/math/trunk/src:
main/java/org/apache/commons/math/exception/
main/java/org/apache/commons/math/exception/util/
main/java/org/apache/commons/math/linear/
main/resources/META-INF/localization/ site/xdoc/ te...
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=1001107&r1=1001106&r2=1001107&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 Fri Sep 24 23:12:34 2010
@@ -35,7 +35,8 @@ public interface RealMatrix extends AnyM
* @param rowDimension the number of rows in the new matrix
* @param columnDimension the number of columns in the new matrix
* @return a new matrix of the same type as the instance
- * @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.
* @since 2.0
*/
RealMatrix createMatrix(final int rowDimension, final int columnDimension);
@@ -54,7 +55,7 @@ public interface RealMatrix extends AnyM
* @return this + m
* @throws IllegalArgumentException if m is not the same size as this
*/
- RealMatrix add(RealMatrix m) throws IllegalArgumentException;
+ RealMatrix add(RealMatrix m);
/**
* Compute this minus m.
@@ -63,7 +64,7 @@ public interface RealMatrix extends AnyM
* @return this - m
* @throws IllegalArgumentException if m is not the same size as this
*/
- RealMatrix subtract(RealMatrix m) throws IllegalArgumentException;
+ RealMatrix subtract(RealMatrix m);
/**
* Returns the result of adding d to each entry of this.
@@ -89,7 +90,7 @@ public interface RealMatrix extends AnyM
* @throws IllegalArgumentException
* if columnDimension(this) != rowDimension(m)
*/
- RealMatrix multiply(RealMatrix m) throws IllegalArgumentException;
+ RealMatrix multiply(RealMatrix m);
/**
* Returns the result premultiplying this by <code>m</code>.
@@ -98,7 +99,7 @@ public interface RealMatrix extends AnyM
* @throws IllegalArgumentException
* if rowDimension(this) != columnDimension(m)
*/
- RealMatrix preMultiply(RealMatrix m) throws IllegalArgumentException;
+ RealMatrix preMultiply(RealMatrix m);
/**
* Returns matrix entries as a two-dimensional array.
@@ -135,8 +136,7 @@ public interface RealMatrix extends AnyM
* specified rows and columns
* @exception MatrixIndexException if the indices are not valid
*/
- RealMatrix getSubMatrix(int startRow, int endRow, int startColumn, int endColumn)
- throws MatrixIndexException;
+ RealMatrix getSubMatrix(int startRow, int endRow, int startColumn, int endColumn);
/**
* Gets a submatrix. Rows and columns are indicated
@@ -148,8 +148,7 @@ public interface RealMatrix extends AnyM
* specified rows and columns
* @exception MatrixIndexException if row or column selections are not valid
*/
- RealMatrix getSubMatrix(int[] selectedRows, int[] selectedColumns)
- throws MatrixIndexException;
+ RealMatrix getSubMatrix(int[] selectedRows, int[] selectedColumns);
/**
* Copy a submatrix. Rows and columns are indicated
@@ -165,9 +164,7 @@ public interface RealMatrix extends AnyM
* @exception IllegalArgumentException if the destination array is too small
*/
void copySubMatrix(int startRow, int endRow, int startColumn, int endColumn,
- double[][] destination)
- throws MatrixIndexException, IllegalArgumentException;
-
+ double[][] destination);
/**
* Copy a submatrix. Rows and columns are indicated
* counting from 0 to n-1.
@@ -179,8 +176,7 @@ public interface RealMatrix extends AnyM
* @exception MatrixIndexException if the indices are not valid
* @exception IllegalArgumentException if the destination array is too small
*/
- void copySubMatrix(int[] selectedRows, int[] selectedColumns, double[][] destination)
- throws MatrixIndexException, IllegalArgumentException;
+ void copySubMatrix(int[] selectedRows, int[] selectedColumns, double[][] destination);
/**
* Replace the submatrix starting at <code>row, column</code> using data in
@@ -209,8 +205,7 @@ public interface RealMatrix extends AnyM
* @throws NullPointerException if <code>subMatrix</code> is null
* @since 2.0
*/
- void setSubMatrix(double[][] subMatrix, int row, int column)
- throws MatrixIndexException;
+ void setSubMatrix(double[][] subMatrix, int row, int column);
/**
* Returns the entries in row number <code>row</code>
@@ -220,7 +215,7 @@ public interface RealMatrix extends AnyM
* @return row matrix
* @throws MatrixIndexException if the specified row index is invalid
*/
- RealMatrix getRowMatrix(int row) throws MatrixIndexException;
+ RealMatrix getRowMatrix(int row);
/**
* Sets the entries in row number <code>row</code>
@@ -230,11 +225,10 @@ public interface RealMatrix extends AnyM
* @param matrix row matrix (must have one row and the same number of columns
* as the instance)
* @throws MatrixIndexException if the specified row index is invalid
- * @throws InvalidMatrixException if the matrix dimensions do not match one
- * instance row
+ * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+ * if the matrix dimensions do not match one instance row.
*/
- void setRowMatrix(int row, RealMatrix matrix)
- throws MatrixIndexException, InvalidMatrixException;
+ void setRowMatrix(int row, RealMatrix matrix);
/**
* Returns the entries in column number <code>column</code>
@@ -244,7 +238,7 @@ public interface RealMatrix extends AnyM
* @return column matrix
* @throws MatrixIndexException if the specified column index is invalid
*/
- RealMatrix getColumnMatrix(int column) throws MatrixIndexException;
+ RealMatrix getColumnMatrix(int column);
/**
* Sets the entries in column number <code>column</code>
@@ -254,11 +248,10 @@ public interface RealMatrix extends AnyM
* @param matrix column matrix (must have one column and the same number of rows
* as the instance)
* @throws MatrixIndexException if the specified column index is invalid
- * @throws InvalidMatrixException if the matrix dimensions do not match one
- * instance column
+ * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+ * if the matrix dimensions do not match one instance column.
*/
- void setColumnMatrix(int column, RealMatrix matrix)
- throws MatrixIndexException, InvalidMatrixException;
+ void setColumnMatrix(int column, RealMatrix matrix);
/**
* Returns the entries in row number <code>row</code>
@@ -268,7 +261,7 @@ public interface RealMatrix extends AnyM
* @return row vector
* @throws MatrixIndexException if the specified row index is invalid
*/
- RealVector getRowVector(int row) throws MatrixIndexException;
+ RealVector getRowVector(int row);
/**
* Sets the entries in row number <code>row</code>
@@ -278,11 +271,10 @@ public interface RealMatrix extends AnyM
* @param vector row vector (must have the same number of columns
* as the instance)
* @throws MatrixIndexException if the specified row index is invalid
- * @throws InvalidMatrixException if the vector dimension does not match one
- * instance row
+ * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+ * if the vector dimension does not match one instance row.
*/
- void setRowVector(int row, RealVector vector)
- throws MatrixIndexException, InvalidMatrixException;
+ void setRowVector(int row, RealVector vector);
/**
* Returns the entries in column number <code>column</code>
@@ -292,7 +284,7 @@ public interface RealMatrix extends AnyM
* @return column vector
* @throws MatrixIndexException if the specified column index is invalid
*/
- RealVector getColumnVector(int column) throws MatrixIndexException;
+ RealVector getColumnVector(int column);
/**
* Sets the entries in column number <code>column</code>
@@ -301,23 +293,22 @@ public interface RealMatrix extends AnyM
* @param column the column to be set
* @param vector column vector (must have the same number of rows as the instance)
* @throws MatrixIndexException if the specified column index is invalid
- * @throws InvalidMatrixException if the vector dimension does not match one
- * instance column
+ * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+ * if the vector dimension does not match one instance column.
*/
- void setColumnVector(int column, RealVector vector)
- throws MatrixIndexException, InvalidMatrixException;
+ 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.</code></p>
+ * unless {@code 0 <= row < rowDimension}.</p>
*
* @param row the row to be fetched
* @return array of entries in the row
* @throws MatrixIndexException if the specified row index is not valid
*/
- double[] getRow(int row) throws MatrixIndexException;
+ double[] getRow(int row);
/**
* Sets the entries in row number <code>row</code>
@@ -326,23 +317,22 @@ public interface RealMatrix extends AnyM
* @param row the row to be set
* @param array row matrix (must have the same number of columns as the instance)
* @throws MatrixIndexException if the specified row index is invalid
- * @throws InvalidMatrixException if the array size does not match one
- * instance row
+ * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+ * if the array size does not match one instance row.
*/
- void setRow(int row, double[] array)
- throws MatrixIndexException, InvalidMatrixException;
+ 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.</code></p>
+ * unless {@code 0 <= column < columnDimension}.</p>
*
* @param column the column to be fetched
* @return array of entries in the column
* @throws MatrixIndexException if the specified column index is not valid
*/
- double[] getColumn(int column) throws MatrixIndexException;
+ double[] getColumn(int column);
/**
* Sets the entries in column number <code>column</code>
@@ -351,19 +341,18 @@ public interface RealMatrix extends AnyM
* @param column the column to be set
* @param array column array (must have the same number of rows as the instance)
* @throws MatrixIndexException if the specified column index is invalid
- * @throws InvalidMatrixException if the array size does not match one
- * instance column
+ * @throws org.apache.commons.math.exception.MatrixDimensionMismatchException
+ * if the array size does not match one instance column.
*/
- void setColumn(int column, double[] array)
- throws MatrixIndexException, InvalidMatrixException;
+ 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</code></li>
- * <li><code> 0 <= column < columnDimension</code></li>
+ * <li>{@code 0 <= row < rowDimension}</li>
+ * <li>{@code 0 <= column < columnDimension}</li>
* </ul>
* otherwise a <code>MatrixIndexException</code> is thrown.</p>
*
@@ -372,15 +361,15 @@ public interface RealMatrix extends AnyM
* @return matrix entry in row,column
* @throws MatrixIndexException if the row or column index is not valid
*/
- double getEntry(int row, int column) throws MatrixIndexException;
+ 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</code></li>
- * <li><code> 0 <= column < columnDimension</code></li>
+ * <li>{@code 0 <= row < rowDimension}</li>
+ * <li>{@code 0 <= column < columnDimension}</li>
* </ul>
* otherwise a <code>MatrixIndexException</code> is thrown.</p>
*
@@ -390,15 +379,15 @@ public interface RealMatrix extends AnyM
* @throws MatrixIndexException if the row or column index is not valid
* @since 2.0
*/
- void setEntry(int row, int column, double value) throws MatrixIndexException;
+ 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</code></li>
- * <li><code> 0 <= column < columnDimension</code></li>
+ * <li>{@code 0 <= row < rowDimension}</li>
+ * <li>{@code 0 <= column < columnDimension}</li>
* </ul>
* otherwise a <code>MatrixIndexException</code> is thrown.</p>
*
@@ -408,15 +397,15 @@ public interface RealMatrix extends AnyM
* @throws MatrixIndexException if the row or column index is not valid
* @since 2.0
*/
- void addToEntry(int row, int column, double increment) throws MatrixIndexException;
+ 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</code></li>
- * <li><code> 0 <= column < columnDimension</code></li>
+ * <li>{@code 0 <= row < rowDimension}</li>
+ * <li>{@code 0 <= column < columnDimension}</li>
* </ul>
* otherwise a <code>MatrixIndexException</code> is thrown.</p>
*
@@ -426,7 +415,7 @@ public interface RealMatrix extends AnyM
* @throws MatrixIndexException if the row or column index is not valid
* @since 2.0
*/
- void multiplyEntry(int row, int column, double factor) throws MatrixIndexException;
+ void multiplyEntry(int row, int column, double factor);
/**
* Returns the transpose of this matrix.
@@ -439,7 +428,7 @@ public interface RealMatrix extends AnyM
* Returns the inverse of this matrix.
*
* @return inverse matrix
- * @throws InvalidMatrixException if this is not invertible
+ * @throws InvalidMatrixException if this is not invertible
* @deprecated as of release 2.0, replaced by <code>
* {@link LUDecompositionImpl#LUDecompositionImpl(RealMatrix)
* new LUDecompositionImpl(m)}.{@link LUDecomposition#getSolver()
@@ -447,7 +436,7 @@ public interface RealMatrix extends AnyM
* getInverse()}</code>
*/
@Deprecated
- RealMatrix inverse() throws InvalidMatrixException;
+ RealMatrix inverse();
/**
* Returns the determinant of this matrix.
@@ -480,7 +469,7 @@ public interface RealMatrix extends AnyM
* @return trace
* @throws NonSquareMatrixException if the matrix is not square
*/
- double getTrace() throws NonSquareMatrixException;
+ double getTrace();
/**
* Returns the result of multiplying this by the vector <code>v</code>.
@@ -489,7 +478,7 @@ public interface RealMatrix extends AnyM
* @return this*v
* @throws IllegalArgumentException if columnDimension != v.size()
*/
- double[] operate(double[] v) throws IllegalArgumentException;
+ double[] operate(double[] v);
/**
* Returns the result of multiplying this by the vector <code>v</code>.
@@ -498,7 +487,7 @@ public interface RealMatrix extends AnyM
* @return this*v
* @throws IllegalArgumentException if columnDimension != v.size()
*/
- RealVector operate(RealVector v) throws IllegalArgumentException;
+ RealVector operate(RealVector v);
/**
* Returns the (row) vector result of premultiplying this by the vector <code>v</code>.
@@ -507,7 +496,7 @@ public interface RealMatrix extends AnyM
* @return v*this
* @throws IllegalArgumentException if rowDimension != v.size()
*/
- double[] preMultiply(double[] v) throws IllegalArgumentException;
+ double[] preMultiply(double[] v);
/**
* Returns the (row) vector result of premultiplying this by the vector <code>v</code>.
@@ -516,7 +505,7 @@ public interface RealMatrix extends AnyM
* @return v*this
* @throws IllegalArgumentException if rowDimension != v.size()
*/
- RealVector preMultiply(RealVector v) throws IllegalArgumentException;
+ RealVector preMultiply(RealVector v);
/**
* Visit (and possibly change) all matrix entries in row order.
@@ -539,8 +528,7 @@ public interface RealMatrix extends AnyM
* @return the value returned by {@link RealMatrixChangingVisitor#end()} at the end
* of the walk
*/
- double walkInRowOrder(RealMatrixChangingVisitor visitor)
- throws MatrixVisitorException;
+ double walkInRowOrder(RealMatrixChangingVisitor visitor);
/**
* Visit (but don't change) all matrix entries in row order.
@@ -563,8 +551,7 @@ public interface RealMatrix extends AnyM
* @return the value returned by {@link RealMatrixPreservingVisitor#end()} at the end
* of the walk
*/
- double walkInRowOrder(RealMatrixPreservingVisitor visitor)
- throws MatrixVisitorException;
+ double walkInRowOrder(RealMatrixPreservingVisitor visitor);
/**
* Visit (and possibly change) some matrix entries in row order.
@@ -593,8 +580,7 @@ public interface RealMatrix extends AnyM
* of the walk
*/
double walkInRowOrder(RealMatrixChangingVisitor visitor,
- int startRow, int endRow, int startColumn, int endColumn)
- throws MatrixIndexException, MatrixVisitorException;
+ int startRow, int endRow, int startColumn, int endColumn);
/**
* Visit (but don't change) some matrix entries in row order.
@@ -623,8 +609,7 @@ public interface RealMatrix extends AnyM
* of the walk
*/
double walkInRowOrder(RealMatrixPreservingVisitor visitor,
- int startRow, int endRow, int startColumn, int endColumn)
- throws MatrixIndexException, MatrixVisitorException;
+ int startRow, int endRow, int startColumn, int endColumn);
/**
* Visit (and possibly change) all matrix entries in column order.
@@ -647,8 +632,7 @@ public interface RealMatrix extends AnyM
* @return the value returned by {@link RealMatrixChangingVisitor#end()} at the end
* of the walk
*/
- double walkInColumnOrder(RealMatrixChangingVisitor visitor)
- throws MatrixVisitorException;
+ double walkInColumnOrder(RealMatrixChangingVisitor visitor);
/**
* Visit (but don't change) all matrix entries in column order.
@@ -671,8 +655,7 @@ public interface RealMatrix extends AnyM
* @return the value returned by {@link RealMatrixPreservingVisitor#end()} at the end
* of the walk
*/
- double walkInColumnOrder(RealMatrixPreservingVisitor visitor)
- throws MatrixVisitorException;
+ double walkInColumnOrder(RealMatrixPreservingVisitor visitor);
/**
* Visit (and possibly change) some matrix entries in column order.
@@ -701,8 +684,7 @@ public interface RealMatrix extends AnyM
* of the walk
*/
double walkInColumnOrder(RealMatrixChangingVisitor visitor,
- int startRow, int endRow, int startColumn, int endColumn)
- throws MatrixIndexException, MatrixVisitorException;
+ int startRow, int endRow, int startColumn, int endColumn);
/**
* Visit (but don't change) some matrix entries in column order.
@@ -731,8 +713,7 @@ public interface RealMatrix extends AnyM
* of the walk
*/
double walkInColumnOrder(RealMatrixPreservingVisitor visitor,
- int startRow, int endRow, int startColumn, int endColumn)
- throws MatrixIndexException, MatrixVisitorException;
+ int startRow, int endRow, int startColumn, int endColumn);
/**
* Visit (and possibly change) all matrix entries using the fastest possible order.
@@ -754,8 +735,7 @@ public interface RealMatrix extends AnyM
* @return the value returned by {@link RealMatrixChangingVisitor#end()} at the end
* of the walk
*/
- double walkInOptimizedOrder(RealMatrixChangingVisitor visitor)
- throws MatrixVisitorException;
+ double walkInOptimizedOrder(RealMatrixChangingVisitor visitor);
/**
* Visit (but don't change) all matrix entries using the fastest possible order.
@@ -777,8 +757,7 @@ public interface RealMatrix extends AnyM
* @return the value returned by {@link RealMatrixPreservingVisitor#end()} at the end
* of the walk
*/
- double walkInOptimizedOrder(RealMatrixPreservingVisitor visitor)
- throws MatrixVisitorException;
+ double walkInOptimizedOrder(RealMatrixPreservingVisitor visitor);
/**
* Visit (and possibly change) some matrix entries using the fastest possible order.
@@ -806,8 +785,7 @@ public interface RealMatrix extends AnyM
* of the walk
*/
double walkInOptimizedOrder(RealMatrixChangingVisitor visitor,
- int startRow, int endRow, int startColumn, int endColumn)
- throws MatrixIndexException, MatrixVisitorException;
+ int startRow, int endRow, int startColumn, int endColumn);
/**
* Visit (but don't change) some matrix entries using the fastest possible order.
@@ -835,8 +813,7 @@ public interface RealMatrix extends AnyM
* of the walk
*/
double walkInOptimizedOrder(RealMatrixPreservingVisitor visitor,
- int startRow, int endRow, int startColumn, int endColumn)
- throws MatrixIndexException, MatrixVisitorException;
+ int startRow, int endRow, int startColumn, int endColumn);
/**
* Returns the solution vector for a linear system with coefficient
@@ -849,7 +826,7 @@ public interface RealMatrix extends AnyM
* @deprecated as of release 2.0, replaced by {@link DecompositionSolver#solve(double[])}
*/
@Deprecated
- double[] solve(double[] b) throws IllegalArgumentException, InvalidMatrixException;
+ double[] solve(double[] b);
/**
* Returns a matrix of (column) solution vectors for linear systems with
@@ -864,6 +841,5 @@ public interface RealMatrix extends AnyM
* @deprecated as of release 2.0, replaced by {@link DecompositionSolver#solve(RealMatrix)}
*/
@Deprecated
- RealMatrix solve(RealMatrix b) throws IllegalArgumentException, InvalidMatrixException;
-
+ RealMatrix solve(RealMatrix b);
}
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=1001107&r1=1001106&r2=1001107&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 Fri Sep 24 23:12:34 2010
@@ -51,8 +51,9 @@ CONVERGENCE_FAILED = \u00c9chec de conve
CUMULATIVE_PROBABILITY_RETURNED_NAN = Fonction de probabilit\u00e9 cumulative retourn\u00e9 NaN \u00e0 l''argument de {0} p = {1}
DIFFERENT_ROWS_LENGTHS = certaines lignes ont une longueur de {0} alors que d''autres ont une longueur de {1}
DIGEST_NOT_INITIALIZED = mod\u00e8le empirique non initialis\u00e9
-DIMENSIONS_MISMATCH_2x2 = dimensions incoh\u00e9rentes : {0}x{1} \u00e0 la place de {2}x{3}
-DIMENSIONS_MISMATCH_SIMPLE = dimensions incoh\u00e9rentes {0} != {1}
+DIMENSIONS_MISMATCH_2x2 = {0}x{1} \u00e0 la place de {2}x{3}
+DIMENSIONS_MISMATCH_SIMPLE = {0} != {1}
+DIMENSIONS_MISMATCH = dimensions incoh\u00e9rentes
DISCRETE_CUMULATIVE_PROBABILITY_RETURNED_NAN = Discr\u00e8tes fonction de probabilit\u00e9 cumulative retourn\u00e9 NaN \u00e0 l''argument de {0}
DISTRIBUTION_NOT_LOADED = aucune distribution n''a \u00e9t\u00e9 charg\u00e9e
DUPLICATED_ABSCISSA = Abscisse {0} dupliqu\u00e9e aux indices {1} et {2}
Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=1001107&r1=1001106&r2=1001107&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Fri Sep 24 23:12:34 2010
@@ -52,6 +52,10 @@ The <action> type attribute can be add,u
If the output is not quite correct, check for invisible trailing spaces!
-->
<release version="3.0" date="TBD" description="TBD">
+ <action dev="erans" type="update" issue="MATH-195">
+ Created "MatrixDimensionMismatch" to replace "InvalidMatrixException"
+ (when the latter is used to signal a row or column dimension mismatch).
+ </action>
<action dev="erans" type="update" issue="MATH-370">
Modified semantics: "equals" methods now consider that NaNs are not
equal (compliant with IEEE754).
Added: commons/proper/math/trunk/src/test/java/org/apache/commons/math/exception/MatrixDimensionMismatchExceptionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/exception/MatrixDimensionMismatchExceptionTest.java?rev=1001107&view=auto
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/exception/MatrixDimensionMismatchExceptionTest.java (added)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/exception/MatrixDimensionMismatchExceptionTest.java Fri Sep 24 23:12:34 2010
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math.exception;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test for {@link MatrixDimensionMismatchException}.
+ *
+ * @version $Revision$ $Date$
+ */
+public class MatrixDimensionMismatchExceptionTest {
+ @Test
+ public void testAccessors() {
+ final MatrixDimensionMismatchException e
+ = new MatrixDimensionMismatchException(1, 2, 3, 4);
+ Assert.assertEquals(1, e.getWrongRowDimension());
+ Assert.assertEquals(2, e.getWrongColumnDimension());
+ Assert.assertEquals(3, e.getExpectedRowDimension());
+ Assert.assertEquals(4, e.getExpectedColumnDimension());
+ }
+}
Propchange: commons/proper/math/trunk/src/test/java/org/apache/commons/math/exception/MatrixDimensionMismatchExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
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=1001107&r1=1001106&r2=1001107&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 Fri Sep 24 23:12:34 2010
@@ -20,6 +20,7 @@ import junit.framework.TestCase;
import org.apache.commons.math.TestUtils;
import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.exception.MatrixDimensionMismatchException;
/**
* Test cases for the {@link Array2DRowRealMatrix} class.
@@ -512,8 +513,8 @@ public final class Array2DRowRealMatrixT
}
try {
m.setRowMatrix(0, m);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -554,8 +555,8 @@ public final class Array2DRowRealMatrixT
}
try {
m.setColumnMatrix(0, m);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -594,8 +595,8 @@ public final class Array2DRowRealMatrixT
}
try {
m.setRowVector(0, new ArrayRealVector(5));
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -634,8 +635,8 @@ public final class Array2DRowRealMatrixT
}
try {
m.setColumnVector(0, new ArrayRealVector(5));
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -679,8 +680,8 @@ public final class Array2DRowRealMatrixT
}
try {
m.setRow(0, new double[5]);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -719,8 +720,8 @@ public final class Array2DRowRealMatrixT
}
try {
m.setColumn(0, new double[5]);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -953,11 +954,13 @@ public final class Array2DRowRealMatrixT
//--------------- -----------------Protected methods
/** extracts the l and u matrices from compact lu representation */
- protected void splitLU(RealMatrix lu, double[][] lowerData, double[][] upperData) throws InvalidMatrixException {
- if (!lu.isSquare() || lowerData.length != lowerData[0].length || upperData.length != upperData[0].length ||
- lowerData.length != upperData.length
- || lowerData.length != lu.getRowDimension()) {
- throw new InvalidMatrixException("incorrect dimensions");
+ protected void splitLU(RealMatrix lu, double[][] lowerData, double[][] upperData) {
+ if (!lu.isSquare() ||
+ lowerData.length != lowerData[0].length ||
+ upperData.length != upperData[0].length ||
+ lowerData.length != upperData.length ||
+ lowerData.length != lu.getRowDimension()) {
+ throw new IllegalArgumentException("incorrect dimensions");
}
int n = lu.getRowDimension();
for (int i = 0; i < n; i++) {
@@ -1002,6 +1005,5 @@ public final class Array2DRowRealMatrixT
// System.out.println(os);
// }
// }
-
}
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java?rev=1001107&r1=1001106&r2=1001107&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java Fri Sep 24 23:12:34 2010
@@ -24,6 +24,7 @@ import junit.framework.TestCase;
import org.apache.commons.math.TestUtils;
import org.apache.commons.math.fraction.Fraction;
import org.apache.commons.math.fraction.FractionField;
+import org.apache.commons.math.exception.MatrixDimensionMismatchException;
/**
* Test cases for the {@link BlockFieldMatrix} class.
@@ -703,8 +704,8 @@ public final class BlockFieldMatrixTest
}
try {
m.setRowMatrix(0, m);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -764,8 +765,8 @@ public final class BlockFieldMatrixTest
}
try {
m.setColumnMatrix(0, m);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -825,8 +826,8 @@ public final class BlockFieldMatrixTest
}
try {
m.setRowVector(0, new ArrayFieldVector<Fraction>(FractionField.getInstance(), 5));
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -884,8 +885,8 @@ public final class BlockFieldMatrixTest
}
try {
m.setColumnVector(0, new ArrayFieldVector<Fraction>(FractionField.getInstance(), 5));
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -948,8 +949,8 @@ public final class BlockFieldMatrixTest
}
try {
m.setRow(0, new Fraction[5]);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -1008,8 +1009,8 @@ public final class BlockFieldMatrixTest
}
try {
m.setColumn(0, new Fraction[5]);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java?rev=1001107&r1=1001106&r2=1001107&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java Fri Sep 24 23:12:34 2010
@@ -23,6 +23,7 @@ import junit.framework.TestCase;
import org.apache.commons.math.TestUtils;
import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.exception.MatrixDimensionMismatchException;
/**
* Test cases for the {@link BlockRealMatrix} class.
@@ -629,8 +630,8 @@ public final class BlockRealMatrixTest e
}
try {
m.setRowMatrix(0, m);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -688,8 +689,8 @@ public final class BlockRealMatrixTest e
}
try {
m.setColumnMatrix(0, m);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -747,8 +748,8 @@ public final class BlockRealMatrixTest e
}
try {
m.setRowVector(0, new ArrayRealVector(5));
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -806,8 +807,8 @@ public final class BlockRealMatrixTest e
}
try {
m.setColumnVector(0, new ArrayRealVector(5));
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -870,8 +871,8 @@ public final class BlockRealMatrixTest e
}
try {
m.setRow(0, new double[5]);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -930,8 +931,8 @@ public final class BlockRealMatrixTest e
}
try {
m.setColumn(0, new double[5]);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java?rev=1001107&r1=1001106&r2=1001107&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java Fri Sep 24 23:12:34 2010
@@ -21,6 +21,7 @@ import junit.framework.TestCase;
import org.apache.commons.math.TestUtils;
import org.apache.commons.math.fraction.Fraction;
import org.apache.commons.math.fraction.FractionField;
+import org.apache.commons.math.exception.MatrixDimensionMismatchException;
/**
* Test cases for the {@link Array2DRowFieldMatrix} class.
@@ -498,8 +499,8 @@ public final class FieldMatrixImplTest e
}
try {
m.setRowMatrix(0, m);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -540,8 +541,8 @@ public final class FieldMatrixImplTest e
}
try {
m.setColumnMatrix(0, m);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -580,8 +581,8 @@ public final class FieldMatrixImplTest e
}
try {
m.setRowVector(0, new ArrayFieldVector<Fraction>(FractionField.getInstance(), 5));
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -620,8 +621,8 @@ public final class FieldMatrixImplTest e
}
try {
m.setColumnVector(0, new ArrayFieldVector<Fraction>(FractionField.getInstance(), 5));
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -665,8 +666,8 @@ public final class FieldMatrixImplTest e
}
try {
m.setRow(0, new Fraction[5]);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -705,8 +706,8 @@ public final class FieldMatrixImplTest e
}
try {
m.setColumn(0, new Fraction[5]);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -958,14 +959,13 @@ public final class FieldMatrixImplTest e
/** extracts the l and u matrices from compact lu representation */
protected void splitLU(FieldMatrix<Fraction> lu,
Fraction[][] lowerData,
- Fraction[][] upperData)
- throws InvalidMatrixException {
+ Fraction[][] upperData) {
if (!lu.isSquare() ||
lowerData.length != lowerData[0].length ||
upperData.length != upperData[0].length ||
lowerData.length != upperData.length ||
lowerData.length != lu.getRowDimension()) {
- throw new InvalidMatrixException("incorrect dimensions");
+ throw new IllegalArgumentException("incorrect dimensions");
}
int n = lu.getRowDimension();
for (int i = 0; i < n; i++) {
@@ -999,6 +999,4 @@ public final class FieldMatrixImplTest e
}
return new Array2DRowFieldMatrix<Fraction>(out);
}
-
}
-
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/RealMatrixImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/RealMatrixImplTest.java?rev=1001107&r1=1001106&r2=1001107&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/RealMatrixImplTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/RealMatrixImplTest.java Fri Sep 24 23:12:34 2010
@@ -20,6 +20,7 @@ import junit.framework.TestCase;
import org.apache.commons.math.TestUtils;
import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.exception.MatrixDimensionMismatchException;
/**
* Test cases for the {@link RealMatrixImpl} class.
@@ -512,8 +513,8 @@ public final class RealMatrixImplTest ex
}
try {
m.setRowMatrix(0, m);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -554,8 +555,8 @@ public final class RealMatrixImplTest ex
}
try {
m.setColumnMatrix(0, m);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -594,8 +595,8 @@ public final class RealMatrixImplTest ex
}
try {
m.setRowVector(0, new ArrayRealVector(5));
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -634,8 +635,8 @@ public final class RealMatrixImplTest ex
}
try {
m.setColumnVector(0, new ArrayRealVector(5));
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -679,8 +680,8 @@ public final class RealMatrixImplTest ex
}
try {
m.setRow(0, new double[5]);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -719,8 +720,8 @@ public final class RealMatrixImplTest ex
}
try {
m.setColumn(0, new double[5]);
- fail("Expecting InvalidMatrixException");
- } catch (InvalidMatrixException ex) {
+ fail("Expecting MatrixDimensionMismatchException");
+ } catch (MatrixDimensionMismatchException ex) {
// expected
}
}
@@ -953,11 +954,13 @@ public final class RealMatrixImplTest ex
//--------------- -----------------Protected methods
/** extracts the l and u matrices from compact lu representation */
- protected void splitLU(RealMatrix lu, double[][] lowerData, double[][] upperData) throws InvalidMatrixException {
- if (!lu.isSquare() || lowerData.length != lowerData[0].length || upperData.length != upperData[0].length ||
- lowerData.length != upperData.length
- || lowerData.length != lu.getRowDimension()) {
- throw new InvalidMatrixException("incorrect dimensions");
+ protected void splitLU(RealMatrix lu, double[][] lowerData, double[][] upperData) {
+ if (!lu.isSquare() ||
+ lowerData.length != lowerData[0].length ||
+ upperData.length != upperData[0].length ||
+ lowerData.length != upperData.length ||
+ lowerData.length != lu.getRowDimension()) {
+ throw new IllegalArgumentException("incorrect dimensions");
}
int n = lu.getRowDimension();
for (int i = 0; i < n; i++) {
@@ -1002,6 +1005,5 @@ public final class RealMatrixImplTest ex
// System.out.println(os);
// }
// }
-
}