From 0f0e1abde967505363f6b4619581aee904507e7c Mon Sep 17 00:00:00 2001 From: Luc Maisonobe Date: Tue, 6 Sep 2011 20:19:37 +0000 Subject: [PATCH] removed MathUserException from linear package git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1165822 13f79535-47bb-0310-9956-ffa450edef68 --- .../commons/math/linear/FieldMatrix.java | 24 ----------------- .../linear/FieldMatrixChangingVisitor.java | 2 -- .../linear/FieldMatrixPreservingVisitor.java | 2 -- .../commons/math/linear/RealMatrix.java | 24 ----------------- .../linear/RealMatrixChangingVisitor.java | 2 -- .../linear/RealMatrixPreservingVisitor.java | 2 -- .../commons/math/linear/RealVector.java | 4 --- .../math/linear/Array2DRowRealMatrixTest.java | 2 +- .../math/linear/BlockFieldMatrixTest.java | 2 +- .../math/linear/BlockRealMatrixTest.java | 2 +- .../math/linear/FieldMatrixImplTest.java | 2 +- .../math/linear/QRDecompositionImplTest.java | 27 ++++++++----------- .../commons/math/linear/QRSolverTest.java | 5 ++-- 13 files changed, 17 insertions(+), 83 deletions(-) diff --git a/src/main/java/org/apache/commons/math/linear/FieldMatrix.java b/src/main/java/org/apache/commons/math/linear/FieldMatrix.java index a648294ed..50cb85f5d 100644 --- a/src/main/java/org/apache/commons/math/linear/FieldMatrix.java +++ b/src/main/java/org/apache/commons/math/linear/FieldMatrix.java @@ -481,8 +481,6 @@ public interface FieldMatrix> extends AnyMatrix { * of a row from left to right before going to the leftmost element * of the next row.

* @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(FieldMatrixPreservingVisitor) * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int) * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int) @@ -505,8 +503,6 @@ public interface FieldMatrix> extends AnyMatrix { * of a row from left to right before going to the leftmost element * of the next row.

* @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(FieldMatrixChangingVisitor) * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int) * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int) @@ -533,8 +529,6 @@ public interface FieldMatrix> extends AnyMatrix { * @param endRow Final row index (inclusive) * @param startColumn Initial column index * @param endColumn Final column index - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @throws org.apache.commons.math.exception.OutOfRangeException * if the indices are not valid. * @see #walkInRowOrder(FieldMatrixChangingVisitor) @@ -564,8 +558,6 @@ public interface FieldMatrix> extends AnyMatrix { * @param endRow Final row index (inclusive) * @param startColumn Initial column index * @param endColumn Final column index - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @throws org.apache.commons.math.exception.OutOfRangeException * if the indices are not valid. * @see #walkInRowOrder(FieldMatrixChangingVisitor) @@ -591,8 +583,6 @@ public interface FieldMatrix> extends AnyMatrix { * of a column from top to bottom before going to the topmost element * of the next column.

* @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(FieldMatrixChangingVisitor) * @see #walkInRowOrder(FieldMatrixPreservingVisitor) * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int) @@ -615,8 +605,6 @@ public interface FieldMatrix> extends AnyMatrix { * of a column from top to bottom before going to the topmost element * of the next column.

* @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(FieldMatrixChangingVisitor) * @see #walkInRowOrder(FieldMatrixPreservingVisitor) * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int) @@ -643,8 +631,6 @@ public interface FieldMatrix> extends AnyMatrix { * @param endRow Final row index (inclusive) * @param startColumn Initial column index * @param endColumn Final column index - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @throws org.apache.commons.math.exception.OutOfRangeException * if the indices are not valid. * @see #walkInRowOrder(FieldMatrixChangingVisitor) @@ -674,8 +660,6 @@ public interface FieldMatrix> extends AnyMatrix { * @param endRow Final row index (inclusive) * @param startColumn Initial column index * @param endColumn Final column index - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @throws org.apache.commons.math.exception.OutOfRangeException * if the indices are not valid. * @see #walkInRowOrder(FieldMatrixChangingVisitor) @@ -700,8 +684,6 @@ public interface FieldMatrix> extends AnyMatrix { *

The fastest walking order depends on the exact matrix class. It may be * different from traditional row or column orders.

* @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(FieldMatrixChangingVisitor) * @see #walkInRowOrder(FieldMatrixPreservingVisitor) * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int) @@ -723,8 +705,6 @@ public interface FieldMatrix> extends AnyMatrix { *

The fastest walking order depends on the exact matrix class. It may be * different from traditional row or column orders.

* @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(FieldMatrixChangingVisitor) * @see #walkInRowOrder(FieldMatrixPreservingVisitor) * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int) @@ -750,8 +730,6 @@ public interface FieldMatrix> extends AnyMatrix { * @param endRow Final row index (inclusive) * @param startColumn Initial column index * @param endColumn Final column index (inclusive) - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @throws org.apache.commons.math.exception.OutOfRangeException * if the indices are not valid. * @see #walkInRowOrder(FieldMatrixChangingVisitor) @@ -780,8 +758,6 @@ public interface FieldMatrix> extends AnyMatrix { * @param endRow Final row index (inclusive) * @param startColumn Initial column index * @param endColumn Final column index (inclusive) - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @throws org.apache.commons.math.exception.OutOfRangeException * if the indices are not valid. * @see #walkInRowOrder(FieldMatrixChangingVisitor) diff --git a/src/main/java/org/apache/commons/math/linear/FieldMatrixChangingVisitor.java b/src/main/java/org/apache/commons/math/linear/FieldMatrixChangingVisitor.java index dc00a9456..4624bea9f 100644 --- a/src/main/java/org/apache/commons/math/linear/FieldMatrixChangingVisitor.java +++ b/src/main/java/org/apache/commons/math/linear/FieldMatrixChangingVisitor.java @@ -46,8 +46,6 @@ public interface FieldMatrixChangingVisitor> { * @param column column index of the entry * @param value current value of the entry * @return the new value to be set for the entry - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. */ T visit(int row, int column, T value); diff --git a/src/main/java/org/apache/commons/math/linear/FieldMatrixPreservingVisitor.java b/src/main/java/org/apache/commons/math/linear/FieldMatrixPreservingVisitor.java index c2c7d4304..cedc5ec67 100644 --- a/src/main/java/org/apache/commons/math/linear/FieldMatrixPreservingVisitor.java +++ b/src/main/java/org/apache/commons/math/linear/FieldMatrixPreservingVisitor.java @@ -45,8 +45,6 @@ public interface FieldMatrixPreservingVisitor> { * @param row row index of the entry * @param column column index of the entry * @param value current value of the entry - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. */ void visit(int row, int column, T value); diff --git a/src/main/java/org/apache/commons/math/linear/RealMatrix.java b/src/main/java/org/apache/commons/math/linear/RealMatrix.java index a0f4fd3c1..3f4ac508d 100644 --- a/src/main/java/org/apache/commons/math/linear/RealMatrix.java +++ b/src/main/java/org/apache/commons/math/linear/RealMatrix.java @@ -486,8 +486,6 @@ public interface RealMatrix extends AnyMatrix { * of a row from left to right before going to the leftmost element * of the next row.

* @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(RealMatrixPreservingVisitor) * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int) * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int) @@ -510,8 +508,6 @@ public interface RealMatrix extends AnyMatrix { * of a row from left to right before going to the leftmost element * of the next row.

* @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(RealMatrixChangingVisitor) * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int) * @see #walkInRowOrder(RealMatrixPreservingVisitor, int, int, int, int) @@ -538,8 +534,6 @@ public interface RealMatrix extends AnyMatrix { * @param endRow Final row index (inclusive) * @param startColumn Initial column index * @param endColumn Final column index - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @throws org.apache.commons.math.exception.OutOfRangeException if * the indices are not valid. * @see #walkInRowOrder(RealMatrixChangingVisitor) @@ -569,8 +563,6 @@ public interface RealMatrix extends AnyMatrix { * @param endRow Final row index (inclusive) * @param startColumn Initial column index * @param endColumn Final column index - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @throws org.apache.commons.math.exception.OutOfRangeException if * the indices are not valid. * @see #walkInRowOrder(RealMatrixChangingVisitor) @@ -596,8 +588,6 @@ public interface RealMatrix extends AnyMatrix { * of a column from top to bottom before going to the topmost element * of the next column.

* @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(RealMatrixChangingVisitor) * @see #walkInRowOrder(RealMatrixPreservingVisitor) * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int) @@ -620,8 +610,6 @@ public interface RealMatrix extends AnyMatrix { * of a column from top to bottom before going to the topmost element * of the next column.

* @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(RealMatrixChangingVisitor) * @see #walkInRowOrder(RealMatrixPreservingVisitor) * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int) @@ -648,8 +636,6 @@ public interface RealMatrix extends AnyMatrix { * @param endRow Final row index (inclusive) * @param startColumn Initial column index * @param endColumn Final column index - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @throws org.apache.commons.math.exception.OutOfRangeException if * the indices are not valid. * @see #walkInRowOrder(RealMatrixChangingVisitor) @@ -679,8 +665,6 @@ public interface RealMatrix extends AnyMatrix { * @param endRow Final row index (inclusive) * @param startColumn Initial column index * @param endColumn Final column index - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @throws org.apache.commons.math.exception.OutOfRangeException if * the indices are not valid. * @see #walkInRowOrder(RealMatrixChangingVisitor) @@ -705,8 +689,6 @@ public interface RealMatrix extends AnyMatrix { *

The fastest walking order depends on the exact matrix class. It may be * different from traditional row or column orders.

* @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(RealMatrixChangingVisitor) * @see #walkInRowOrder(RealMatrixPreservingVisitor) * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int) @@ -728,8 +710,6 @@ public interface RealMatrix extends AnyMatrix { *

The fastest walking order depends on the exact matrix class. It may be * different from traditional row or column orders.

* @param visitor visitor used to process all matrix entries - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @see #walkInRowOrder(RealMatrixChangingVisitor) * @see #walkInRowOrder(RealMatrixPreservingVisitor) * @see #walkInRowOrder(RealMatrixChangingVisitor, int, int, int, int) @@ -755,8 +735,6 @@ public interface RealMatrix extends AnyMatrix { * @param endRow Final row index (inclusive) * @param startColumn Initial column index * @param endColumn Final column index (inclusive) - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @throws org.apache.commons.math.exception.OutOfRangeException if * the indices are not valid. * @see #walkInRowOrder(RealMatrixChangingVisitor) @@ -785,8 +763,6 @@ public interface RealMatrix extends AnyMatrix { * @param endRow Final row index (inclusive) * @param startColumn Initial column index * @param endColumn Final column index (inclusive) - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. * @throws org.apache.commons.math.exception.OutOfRangeException if the * indices are not valid. * @see #walkInRowOrder(RealMatrixChangingVisitor) diff --git a/src/main/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java b/src/main/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java index 678ac1b99..1f9f88ecc 100644 --- a/src/main/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java +++ b/src/main/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java @@ -44,8 +44,6 @@ public interface RealMatrixChangingVisitor { * @param column column index of the entry * @param value current value of the entry * @return the new value to be set for the entry - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. */ double visit(int row, int column, double value); diff --git a/src/main/java/org/apache/commons/math/linear/RealMatrixPreservingVisitor.java b/src/main/java/org/apache/commons/math/linear/RealMatrixPreservingVisitor.java index a5b44c349..dbae91e4a 100644 --- a/src/main/java/org/apache/commons/math/linear/RealMatrixPreservingVisitor.java +++ b/src/main/java/org/apache/commons/math/linear/RealMatrixPreservingVisitor.java @@ -43,8 +43,6 @@ public interface RealMatrixPreservingVisitor { * @param row row index of the entry * @param column column index of the entry * @param value current value of the entry - * @throws org.apache.commons.math.exception.MathUserException if the visitor - * cannot process an entry. */ void visit(int row, int column, double value); diff --git a/src/main/java/org/apache/commons/math/linear/RealVector.java b/src/main/java/org/apache/commons/math/linear/RealVector.java index 9d1ff451f..e710db3d6 100644 --- a/src/main/java/org/apache/commons/math/linear/RealVector.java +++ b/src/main/java/org/apache/commons/math/linear/RealVector.java @@ -731,8 +731,6 @@ public abstract class RealVector { * * @param function Function to apply to each entry. * @return a new vector. - * @throws org.apache.commons.math.exception.MathUserException - * if the function throws it. */ public RealVector map(UnivariateRealFunction function) { return copy().mapToSelf(function); @@ -750,8 +748,6 @@ public abstract class RealVector { * * @param function Function to apply to each entry. * @return a reference to this vector. - * @throws org.apache.commons.math.exception.MathUserException - * if the function throws it. */ public RealVector mapToSelf(UnivariateRealFunction function) { Iterator it = (function.value(0) == 0) ? sparseIterator() : iterator(); diff --git a/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java b/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java index b56bd9db5..02187f4ec 100644 --- a/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java +++ b/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java @@ -972,7 +972,7 @@ public final class Array2DRowRealMatrixTest { } @Test - public void testWalk() throws MathUserException { + public void testWalk() { int rows = 150; int columns = 75; diff --git a/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java b/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java index 15212c3f8..e4a5df8d0 100644 --- a/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java +++ b/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java @@ -1237,7 +1237,7 @@ public final class BlockFieldMatrixTest { } @Test - public void testWalk() throws MathUserException { + public void testWalk() { int rows = 150; int columns = 75; diff --git a/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java b/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java index edac0a367..b9851f130 100644 --- a/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java +++ b/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java @@ -1142,7 +1142,7 @@ public final class BlockRealMatrixTest { } @Test - public void testWalk() throws MathUserException { + public void testWalk() { int rows = 150; int columns = 75; diff --git a/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java b/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java index 459c5fb5a..9abd8c3ae 100644 --- a/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java +++ b/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java @@ -964,7 +964,7 @@ public final class FieldMatrixImplTest { } @Test - public void testWalk() throws MathUserException { + public void testWalk() { int rows = 150; int columns = 75; diff --git a/src/test/java/org/apache/commons/math/linear/QRDecompositionImplTest.java b/src/test/java/org/apache/commons/math/linear/QRDecompositionImplTest.java index 383ae931f..c5d57ddd9 100644 --- a/src/test/java/org/apache/commons/math/linear/QRDecompositionImplTest.java +++ b/src/test/java/org/apache/commons/math/linear/QRDecompositionImplTest.java @@ -19,7 +19,6 @@ package org.apache.commons.math.linear; import java.util.Random; -import org.apache.commons.math.exception.MathUserException; import org.junit.Assert; import org.junit.Test; @@ -50,10 +49,9 @@ public class QRDecompositionImplTest { private static final double normTolerance = 10e-14; - /** test dimensions - * @throws MathUserException */ + /** test dimensions */ @Test - public void testDimensions() throws MathUserException { + public void testDimensions() { checkDimension(MatrixUtils.createRealMatrix(testData3x3NonSingular)); checkDimension(MatrixUtils.createRealMatrix(testData4x3)); @@ -78,10 +76,9 @@ public class QRDecompositionImplTest { Assert.assertEquals(columns, qr.getR().getColumnDimension()); } - /** test A = QR - * @throws MathUserException */ + /** test A = QR */ @Test - public void testAEqualQR() throws MathUserException { + public void testAEqualQR() { checkAEqualQR(MatrixUtils.createRealMatrix(testData3x3NonSingular)); checkAEqualQR(MatrixUtils.createRealMatrix(testData3x3Singular)); @@ -105,10 +102,9 @@ public class QRDecompositionImplTest { Assert.assertEquals(0, norm, normTolerance); } - /** test the orthogonality of Q - * @throws MathUserException */ + /** test the orthogonality of Q */ @Test - public void testQOrthogonal() throws MathUserException { + public void testQOrthogonal() { checkQOrthogonal(MatrixUtils.createRealMatrix(testData3x3NonSingular)); checkQOrthogonal(MatrixUtils.createRealMatrix(testData3x3Singular)); @@ -135,7 +131,7 @@ public class QRDecompositionImplTest { /** test that R is upper triangular */ @Test - public void testRUpperTriangular() throws MathUserException { + public void testRUpperTriangular() { RealMatrix matrix = MatrixUtils.createRealMatrix(testData3x3NonSingular); checkUpperTriangular(new QRDecompositionImpl(matrix).getR()); @@ -159,7 +155,7 @@ public class QRDecompositionImplTest { } - private void checkUpperTriangular(RealMatrix m) throws MathUserException { + private void checkUpperTriangular(RealMatrix m) { m.walkInOptimizedOrder(new DefaultRealMatrixPreservingVisitor() { @Override public void visit(int row, int column, double value) { @@ -170,10 +166,9 @@ public class QRDecompositionImplTest { }); } - /** test that H is trapezoidal - * @throws MathUserException */ + /** test that H is trapezoidal */ @Test - public void testHTrapezoidal() throws MathUserException { + public void testHTrapezoidal() { RealMatrix matrix = MatrixUtils.createRealMatrix(testData3x3NonSingular); checkTrapezoidal(new QRDecompositionImpl(matrix).getH()); @@ -197,7 +192,7 @@ public class QRDecompositionImplTest { } - private void checkTrapezoidal(RealMatrix m) throws MathUserException { + private void checkTrapezoidal(RealMatrix m) { m.walkInOptimizedOrder(new DefaultRealMatrixPreservingVisitor() { @Override public void visit(int row, int column, double value) { diff --git a/src/test/java/org/apache/commons/math/linear/QRSolverTest.java b/src/test/java/org/apache/commons/math/linear/QRSolverTest.java index 296c5eb82..5c6368e21 100644 --- a/src/test/java/org/apache/commons/math/linear/QRSolverTest.java +++ b/src/test/java/org/apache/commons/math/linear/QRSolverTest.java @@ -19,7 +19,6 @@ package org.apache.commons.math.linear; import java.util.Random; -import org.apache.commons.math.exception.MathUserException; import org.apache.commons.math.exception.MathIllegalArgumentException; import org.junit.Test; @@ -147,7 +146,7 @@ public class QRSolverTest { } @Test - public void testOverdetermined() throws MathUserException { + public void testOverdetermined() { final Random r = new Random(5559252868205245l); int p = (7 * BlockRealMatrix.BLOCK_SIZE) / 4; int q = (5 * BlockRealMatrix.BLOCK_SIZE) / 4; @@ -171,7 +170,7 @@ public class QRSolverTest { } @Test - public void testUnderdetermined() throws MathUserException { + public void testUnderdetermined() { final Random r = new Random(42185006424567123l); int p = (5 * BlockRealMatrix.BLOCK_SIZE) / 4; int q = (7 * BlockRealMatrix.BLOCK_SIZE) / 4;