Author: erans
Date: Fri Nov 12 00:13:27 2010
New Revision: 1034220
URL: http://svn.apache.org/viewvc?rev=1034220&view=rev
Log:
MATH-438
Removed deprecated class "InvalidMatrixException".
Removed:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/InvalidMatrixException.java
commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/InvalidMatrixExceptionTest.java
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecomposition.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecompositionImpl.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DecompositionSolver.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldDecompositionSolver.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/LUDecompositionImpl.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/QRDecompositionImpl.java
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecomposition.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecomposition.java?rev=1034220&r1=1034219&r2=1034220&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecomposition.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecomposition.java
Fri Nov 12 00:13:27 2010
@@ -28,7 +28,8 @@ package org.apache.commons.math.linear;
* <li>a {...@link #getLT() getLT} method has been added,</li>
* <li>the <code>isspd</code> method has been removed, the constructors of
* implementation classes being expected to throw {...@link
- * NotPositiveDefiniteMatrixException} when a matrix cannot be
decomposed,</li>
+ * org.apache.commons.math.exception.NonPositiveDefiniteMatrixException}
+ * when a matrix cannot be decomposed,</li>
* <li>a {...@link #getDeterminant() getDeterminant} method has been
added,</li>
* <li>the <code>solve</code> method has been replaced by a {...@link
* #getSolver() getSolver} method and the equivalent method provided by
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecompositionImpl.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecompositionImpl.java?rev=1034220&r1=1034219&r2=1034220&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecompositionImpl.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/CholeskyDecompositionImpl.java
Fri Nov 12 00:13:27 2010
@@ -269,8 +269,9 @@ public class CholeskyDecompositionImpl i
* <p>The A matrix is implicit here. It is </p>
* @param b right-hand side of the equation A × X = B
* @return a vector X such that A × X = B
- * @throws IllegalArgumentException if matrices dimensions don't match
- * @throws InvalidMatrixException if decomposed matrix is singular
+ * @throws DimensionMismatchException if the matrices dimensions do
not match.
+ * @throws org.apache.commons.math.exception.SingularMatrixException if
+ * the decomposed matrix is singular.
*/
public ArrayRealVector solve(ArrayRealVector b) {
return new ArrayRealVector(solve(b.getDataRef()), false);
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DecompositionSolver.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DecompositionSolver.java?rev=1034220&r1=1034219&r2=1034220&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DecompositionSolver.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/DecompositionSolver.java
Fri Nov 12 00:13:27 2010
@@ -40,45 +40,47 @@ public interface DecompositionSolver {
* decomposition algorithm.</p>
* @param b right-hand side of the equation A × X = B
* @return a vector X that minimizes the two norm of A × X - B
- * @exception IllegalArgumentException if matrices dimensions don't match
- * @exception InvalidMatrixException if decomposed matrix is singular
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if the matrices dimensions do not match.
+ * @throws org.apache.commons.math.exception.SingularMatrixException
+ * if the decomposed matrix is singular.
*/
- double[] solve(final double[] b)
- throws IllegalArgumentException, InvalidMatrixException;
+ double[] solve(final double[] b);
/** Solve the linear equation A × X = B for matrices A.
* <p>The A matrix is implicit, it is provided by the underlying
* decomposition algorithm.</p>
* @param b right-hand side of the equation A × X = B
* @return a vector X that minimizes the two norm of A × X - B
- * @exception IllegalArgumentException if matrices dimensions don't match
- * @exception InvalidMatrixException if decomposed matrix is singular
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if the matrices dimensions do not match.
+ * @throws org.apache.commons.math.exception.SingularMatrixException
+ * if the decomposed matrix is singular.
*/
- RealVector solve(final RealVector b)
- throws IllegalArgumentException, InvalidMatrixException;
+ RealVector solve(final RealVector b);
/** Solve the linear equation A × X = B for matrices A.
* <p>The A matrix is implicit, it is provided by the underlying
* decomposition algorithm.</p>
* @param b right-hand side of the equation A × X = B
* @return a matrix X that minimizes the two norm of A × X - B
- * @exception IllegalArgumentException if matrices dimensions don't match
- * @exception InvalidMatrixException if decomposed matrix is singular
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if the matrices dimensions do not match.
+ * @throws org.apache.commons.math.exception.SingularMatrixException
+ * if the decomposed matrix is singular.
*/
- RealMatrix solve(final RealMatrix b)
- throws IllegalArgumentException, InvalidMatrixException;
+ RealMatrix solve(final RealMatrix b);
/**
* Check if the decomposed matrix is non-singular.
- * @return true if the decomposed matrix is non-singular
+ * @return true if the decomposed matrix is non-singular.
*/
boolean isNonSingular();
/** Get the inverse (or pseudo-inverse) of the decomposed matrix.
* @return inverse matrix
- * @throws InvalidMatrixException if decomposed matrix is singular
+ * @throws org.apache.commons.math.exception.SingularMatrixException
+ * if the decomposed matrix is singular.
*/
- RealMatrix getInverse()
- throws InvalidMatrixException;
-
+ RealMatrix getInverse();
}
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java?rev=1034220&r1=1034219&r2=1034220&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/EigenDecompositionImpl.java
Fri Nov 12 00:13:27 2010
@@ -276,13 +276,10 @@ public class EigenDecompositionImpl impl
* This method only find exact linear solutions, i.e. solutions for
* which ||A × X - B|| is exactly 0.
* </p>
- * @param b
- * right-hand side of the equation A × X = B
- * @return a vector X that minimizes the two norm of A × X - B
- * @exception IllegalArgumentException
- * if matrices dimensions don't match
- * @exception InvalidMatrixException
- * if decomposed matrix is singular
+ * @param b Right-hand side of the equation A × X = B
+ * @return a Vector X that minimizes the two norm of A × X - B
+ * @throws DimensionMismatchException if the matrices dimensions do
not match.
+ * @throws SingularMatrixException if the decomposed matrix is
singular.
*/
public double[] solve(final double[] b) {
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldDecompositionSolver.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldDecompositionSolver.java?rev=1034220&r1=1034219&r2=1034220&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldDecompositionSolver.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldDecompositionSolver.java
Fri Nov 12 00:13:27 2010
@@ -42,33 +42,36 @@ public interface FieldDecompositionSolve
* decomposition algorithm.</p>
* @param b right-hand side of the equation A × X = B
* @return a vector X that minimizes the two norm of A × X - B
- * @exception IllegalArgumentException if matrices dimensions don't match
- * @exception InvalidMatrixException if decomposed matrix is singular
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if the matrices dimensions do not match.
+ * @throws org.apache.commons.math.exception.SingularMatrixException
+ * if the decomposed matrix is singular.
*/
- T[] solve(final T[] b)
- throws IllegalArgumentException, InvalidMatrixException;
+ T[] solve(final T[] b);
/** Solve the linear equation A × X = B for matrices A.
* <p>The A matrix is implicit, it is provided by the underlying
* decomposition algorithm.</p>
* @param b right-hand side of the equation A × X = B
* @return a vector X that minimizes the two norm of A × X - B
- * @exception IllegalArgumentException if matrices dimensions don't match
- * @exception InvalidMatrixException if decomposed matrix is singular
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if the matrices dimensions do not match.
+ * @throws org.apache.commons.math.exception.SingularMatrixException
+ * if the decomposed matrix is singular.
*/
- FieldVector<T> solve(final FieldVector<T> b)
- throws IllegalArgumentException, InvalidMatrixException;
+ FieldVector<T> solve(final FieldVector<T> b);
/** Solve the linear equation A × X = B for matrices A.
* <p>The A matrix is implicit, it is provided by the underlying
* decomposition algorithm.</p>
* @param b right-hand side of the equation A × X = B
* @return a matrix X that minimizes the two norm of A × X - B
- * @exception IllegalArgumentException if matrices dimensions don't match
- * @exception InvalidMatrixException if decomposed matrix is singular
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if the matrices dimensions do not match.
+ * @throws org.apache.commons.math.exception.SingularMatrixException
+ * if the decomposed matrix is singular.
*/
- FieldMatrix<T> solve(final FieldMatrix<T> b)
- throws IllegalArgumentException, InvalidMatrixException;
+ FieldMatrix<T> solve(final FieldMatrix<T> b);
/**
* Check if the decomposed matrix is non-singular.
@@ -78,9 +81,8 @@ public interface FieldDecompositionSolve
/** Get the inverse (or pseudo-inverse) of the decomposed matrix.
* @return inverse matrix
- * @throws InvalidMatrixException if decomposed matrix is singular
+ * @throws org.apache.commons.math.exception.SingularMatrixException
+ * if the decomposed matrix is singular.
*/
- FieldMatrix<T> getInverse()
- throws InvalidMatrixException;
-
+ FieldMatrix<T> getInverse();
}
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java?rev=1034220&r1=1034219&r2=1034220&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/FieldLUDecompositionImpl.java
Fri Nov 12 00:13:27 2010
@@ -344,8 +344,8 @@ public class FieldLUDecompositionImpl<T
* <p>The A matrix is implicit here. It is </p>
* @param b right-hand side of the equation A × X = B
* @return a vector X such that A × X = B
- * @throws IllegalArgumentException if matrices dimensions don't match
- * @throws InvalidMatrixException if decomposed matrix is singular
+ * @throws DimensionMismatchException if the matrices dimensions do
not match.
+ * @throws SingularMatrixException if the decomposed matrix is
singular.
*/
public ArrayFieldVector<T> solve(ArrayFieldVector<T> b) {
return new ArrayFieldVector<T>(solve(b.getDataRef()), false);
@@ -407,7 +407,7 @@ public class FieldLUDecompositionImpl<T
}
/** {...@inheritdoc} */
- public FieldMatrix<T> getInverse() throws InvalidMatrixException {
+ public FieldMatrix<T> getInverse() {
final int m = pivot.length;
final T one = field.getOne();
FieldMatrix<T> identity = new Array2DRowFieldMatrix<T>(field, m,
m);
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/LUDecompositionImpl.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/LUDecompositionImpl.java?rev=1034220&r1=1034219&r2=1034220&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/LUDecompositionImpl.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/LUDecompositionImpl.java
Fri Nov 12 00:13:27 2010
@@ -54,11 +54,10 @@ public class LUDecompositionImpl impleme
/**
* Calculates the LU-decomposition of the given matrix.
- * @param matrix The matrix to decompose.
- * @throws InvalidMatrixException if matrix is not square
+ * @param matrix Matrix to decompose.
+ * @throws NonSquareMatrixException if matrix is not square.
*/
- public LUDecompositionImpl(RealMatrix matrix)
- throws InvalidMatrixException {
+ public LUDecompositionImpl(RealMatrix matrix) {
this(matrix, DEFAULT_TOO_SMALL);
}
@@ -333,7 +332,7 @@ public class LUDecompositionImpl impleme
* @return a vector X such that A × X = B
* @throws DimensionMismatchException if the matrices dimensions
* do not match.
- * @throws InvalidMatrixException if decomposed matrix is singular
+ * @throws SingularMatrixException if decomposed matrix is singular.
*/
public ArrayRealVector solve(ArrayRealVector b) {
return new ArrayRealVector(solve(b.getDataRef()), false);
@@ -394,7 +393,7 @@ public class LUDecompositionImpl impleme
}
/** {...@inheritdoc} */
- public RealMatrix getInverse() throws InvalidMatrixException {
+ public RealMatrix getInverse() {
return solve(MatrixUtils.createRealIdentityMatrix(pivot.length));
}
}
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/QRDecompositionImpl.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/QRDecompositionImpl.java?rev=1034220&r1=1034219&r2=1034220&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/QRDecompositionImpl.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/QRDecompositionImpl.java
Fri Nov 12 00:13:27 2010
@@ -331,8 +331,8 @@ public class QRDecompositionImpl impleme
* <p>The A matrix is implicit here. It is </p>
* @param b right-hand side of the equation A × X = B
* @return a vector X that minimizes the two norm of A × X - B
- * @throws IllegalArgumentException if matrices dimensions don't match
- * @throws InvalidMatrixException if decomposed matrix is singular
+ * @throws DimensionMismatchException if the matrices dimensions do
not match.
+ * @throws SingularMatrixException if the decomposed matrix is
singular.
*/
public ArrayRealVector solve(ArrayRealVector b) {
return new ArrayRealVector(solve(b.getDataRef()), false);
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
URL:
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java?rev=1034220&r1=1034219&r2=1034220&view=diff
==============================================================================
---
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
(original)
+++
commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/SingularValueDecompositionImpl.java
Fri Nov 12 00:13:27 2010
@@ -66,16 +66,9 @@ public class SingularValueDecompositionI
/**
* Calculates the compact Singular Value Decomposition of the given matrix.
- * @param matrix
- * The matrix to decompose.
- * @exception InvalidMatrixException
- * (wrapping a
- * {...@link org.apache.commons.math.ConvergenceException}
if
- * algorithm fails to converge
+ * @param matrix Matrix to decompose.
*/
- public SingularValueDecompositionImpl(final RealMatrix matrix)
- throws InvalidMatrixException {
-
+ public SingularValueDecompositionImpl(final RealMatrix matrix) {
m = matrix.getRowDimension();
n = matrix.getColumnDimension();
@@ -154,14 +147,14 @@ public class SingularValueDecompositionI
}
/** {...@inheritdoc} */
- public RealMatrix getU() throws InvalidMatrixException {
+ public RealMatrix getU() {
// return the cached matrix
return cachedU;
}
/** {...@inheritdoc} */
- public RealMatrix getUT() throws InvalidMatrixException {
+ public RealMatrix getUT() {
if (cachedUt == null) {
cachedUt = getU().transpose();
@@ -173,7 +166,7 @@ public class SingularValueDecompositionI
}
/** {...@inheritdoc} */
- public RealMatrix getS() throws InvalidMatrixException {
+ public RealMatrix getS() {
if (cachedS == null) {
@@ -185,19 +178,19 @@ public class SingularValueDecompositionI
}
/** {...@inheritdoc} */
- public double[] getSingularValues() throws InvalidMatrixException {
+ public double[] getSingularValues() {
return singularValues.clone();
}
/** {...@inheritdoc} */
- public RealMatrix getV() throws InvalidMatrixException {
+ public RealMatrix getV() {
// return the cached matrix
return cachedV;
}
/** {...@inheritdoc} */
- public RealMatrix getVT() throws InvalidMatrixException {
+ public RealMatrix getVT() {
if (cachedVt == null) {
cachedVt = getV().transpose();
@@ -240,12 +233,12 @@ public class SingularValueDecompositionI
}
/** {...@inheritdoc} */
- public double getNorm() throws InvalidMatrixException {
+ public double getNorm() {
return singularValues[0];
}
/** {...@inheritdoc} */
- public double getConditionNumber() throws InvalidMatrixException {
+ public double getConditionNumber() {
return singularValues[0] / singularValues[singularValues.length - 1];
}