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 2021/05/31 01:50:10 UTC
[commons-math] 01/05: MATH-1589: Spurious "throws" clauses.
This is an automated email from the ASF dual-hosted git repository.
erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git
commit 7eadea31678c14d223cb0a14edd4ae1be4aa8ed1
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Sun May 30 23:04:17 2021 +0200
MATH-1589: Spurious "throws" clauses.
---
.../commons/math4/legacy/random/HaltonSequenceGenerator.java | 9 +++------
.../commons/math4/legacy/random/SobolSequenceGenerator.java | 10 ++++------
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/random/HaltonSequenceGenerator.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/random/HaltonSequenceGenerator.java
index 0fb7347..63dda90 100644
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/random/HaltonSequenceGenerator.java
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/random/HaltonSequenceGenerator.java
@@ -84,7 +84,7 @@ public class HaltonSequenceGenerator implements RandomVectorGenerator {
* @param dimension the space dimension
* @throws OutOfRangeException if the space dimension is outside the allowed range of [1, 40]
*/
- public HaltonSequenceGenerator(final int dimension) throws OutOfRangeException {
+ public HaltonSequenceGenerator(final int dimension) {
this(dimension, PRIMES, WEIGHTS);
}
@@ -100,9 +100,7 @@ public class HaltonSequenceGenerator implements RandomVectorGenerator {
* len refers to the length of the bases array
* @throws DimensionMismatchException if weights is non-null and the length of the input arrays differ
*/
- public HaltonSequenceGenerator(final int dimension, final int[] bases, final int[] weights)
- throws NullArgumentException, OutOfRangeException, DimensionMismatchException {
-
+ public HaltonSequenceGenerator(final int dimension, final int[] bases, final int[] weights) {
NullArgumentException.check(bases);
if (dimension < 1 || dimension > bases.length) {
@@ -165,7 +163,7 @@ public class HaltonSequenceGenerator implements RandomVectorGenerator {
* @return the i-th point in the Halton sequence
* @throws NotPositiveException if index < 0
*/
- public double[] skipTo(final int index) throws NotPositiveException {
+ public double[] skipTo(final int index) {
count = index;
return nextVector();
}
@@ -179,5 +177,4 @@ public class HaltonSequenceGenerator implements RandomVectorGenerator {
public int getNextIndex() {
return count;
}
-
}
diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/random/SobolSequenceGenerator.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/random/SobolSequenceGenerator.java
index 9ab816d..c43b4f1 100644
--- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/random/SobolSequenceGenerator.java
+++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/random/SobolSequenceGenerator.java
@@ -88,7 +88,7 @@ public class SobolSequenceGenerator implements RandomVectorGenerator {
* @param dimension the space dimension
* @throws OutOfRangeException if the space dimension is outside the allowed range of [1, 21201]
*/
- public SobolSequenceGenerator(final int dimension) throws OutOfRangeException {
+ public SobolSequenceGenerator(final int dimension) {
if (dimension < 1 || dimension > MAX_DIMENSION) {
throw new OutOfRangeException(dimension, 1, MAX_DIMENSION);
}
@@ -154,8 +154,7 @@ public class SobolSequenceGenerator implements RandomVectorGenerator {
* @throws IOException if an error occurs while reading from the input stream
*/
public SobolSequenceGenerator(final int dimension, final InputStream is)
- throws NotStrictlyPositiveException, MathParseException, IOException {
-
+ throws IOException {
if (dimension < 1) {
throw new NotStrictlyPositiveException(dimension);
}
@@ -184,8 +183,7 @@ public class SobolSequenceGenerator implements RandomVectorGenerator {
* @throws IOException if the stream could not be read
* @throws MathParseException if the content could not be parsed successfully
*/
- private int initFromStream(final InputStream is) throws MathParseException, IOException {
-
+ private int initFromStream(final InputStream is) throws IOException {
// special case: dimension 1 -> use unit initialization
for (int i = 1; i <= BITS; i++) {
direction[0][i] = 1l << (BITS - i);
@@ -287,7 +285,7 @@ public class SobolSequenceGenerator implements RandomVectorGenerator {
* @return the i-th point in the Sobol sequence
* @throws NotPositiveException if index < 0
*/
- public double[] skipTo(final int index) throws NotPositiveException {
+ public double[] skipTo(final int index) {
if (index == 0) {
// reset x vector
Arrays.fill(x, 0);