diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/CanberraDistance.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/CanberraDistance.java index 0db6028dd..8f9295bef 100644 --- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/CanberraDistance.java +++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/CanberraDistance.java @@ -16,7 +16,6 @@ */ package org.apache.commons.math4.legacy.ml.distance; -import org.apache.commons.math4.legacy.exception.DimensionMismatchException; import org.apache.commons.math4.core.jdkmath.JdkMath; import org.apache.commons.math4.legacy.core.MathArrays; @@ -28,8 +27,7 @@ import org.apache.commons.math4.legacy.core.MathArrays; public class CanberraDistance implements DistanceMeasure { /** {@inheritDoc} */ @Override - public double compute(double[] a, double[] b) - throws DimensionMismatchException { + public double compute(double[] a, double[] b) { MathArrays.checkEqualLength(a, b); double sum = 0; for (int i = 0; i < a.length; i++) { diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/ChebyshevDistance.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/ChebyshevDistance.java index 2f042c04e..5819649a7 100644 --- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/ChebyshevDistance.java +++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/ChebyshevDistance.java @@ -16,7 +16,6 @@ */ package org.apache.commons.math4.legacy.ml.distance; -import org.apache.commons.math4.legacy.exception.DimensionMismatchException; import org.apache.commons.math4.legacy.core.MathArrays; /** @@ -27,8 +26,7 @@ import org.apache.commons.math4.legacy.core.MathArrays; public class ChebyshevDistance implements DistanceMeasure { /** {@inheritDoc} */ @Override - public double compute(double[] a, double[] b) - throws DimensionMismatchException { + public double compute(double[] a, double[] b) { return MathArrays.distanceInf(a, b); } } diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/DistanceMeasure.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/DistanceMeasure.java index a5a22f15a..eea0d52e4 100644 --- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/DistanceMeasure.java +++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/DistanceMeasure.java @@ -16,8 +16,6 @@ */ package org.apache.commons.math4.legacy.ml.distance; -import org.apache.commons.math4.legacy.exception.DimensionMismatchException; - /** * Interface for distance measures of n-dimensional vectors. * @@ -33,7 +31,8 @@ public interface DistanceMeasure { * @param a the first vector * @param b the second vector * @return the distance between the two vectors - * @throws DimensionMismatchException if the array lengths differ. + * @throws org.apache.commons.math4.legacy.exception.DimensionMismatchException + * if the array lengths differ. */ - double compute(double[] a, double[] b) throws DimensionMismatchException; + double compute(double[] a, double[] b); } diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/EarthMoversDistance.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/EarthMoversDistance.java index 3fedb22bb..052ade330 100644 --- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/EarthMoversDistance.java +++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/EarthMoversDistance.java @@ -16,7 +16,6 @@ */ package org.apache.commons.math4.legacy.ml.distance; -import org.apache.commons.math4.legacy.exception.DimensionMismatchException; import org.apache.commons.math4.core.jdkmath.JdkMath; import org.apache.commons.math4.legacy.core.MathArrays; @@ -30,8 +29,7 @@ import org.apache.commons.math4.legacy.core.MathArrays; public class EarthMoversDistance implements DistanceMeasure { /** {@inheritDoc} */ @Override - public double compute(double[] a, double[] b) - throws DimensionMismatchException { + public double compute(double[] a, double[] b) { MathArrays.checkEqualLength(a, b); double lastDistance = 0; double totalDistance = 0; diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/EuclideanDistance.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/EuclideanDistance.java index 1aa0fe76a..3748ab9e4 100644 --- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/EuclideanDistance.java +++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/EuclideanDistance.java @@ -16,7 +16,6 @@ */ package org.apache.commons.math4.legacy.ml.distance; -import org.apache.commons.math4.legacy.exception.DimensionMismatchException; import org.apache.commons.math4.legacy.core.MathArrays; /** @@ -27,8 +26,7 @@ import org.apache.commons.math4.legacy.core.MathArrays; public class EuclideanDistance implements DistanceMeasure { /** {@inheritDoc} */ @Override - public double compute(double[] a, double[] b) - throws DimensionMismatchException { + public double compute(double[] a, double[] b) { return MathArrays.distance(a, b); } } diff --git a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/ManhattanDistance.java b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/ManhattanDistance.java index d9813a7c2..3337ee20c 100644 --- a/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/ManhattanDistance.java +++ b/commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ml/distance/ManhattanDistance.java @@ -16,7 +16,6 @@ */ package org.apache.commons.math4.legacy.ml.distance; -import org.apache.commons.math4.legacy.exception.DimensionMismatchException; import org.apache.commons.math4.legacy.core.MathArrays; /** @@ -27,8 +26,7 @@ import org.apache.commons.math4.legacy.core.MathArrays; public class ManhattanDistance implements DistanceMeasure { /** {@inheritDoc} */ @Override - public double compute(double[] a, double[] b) - throws DimensionMismatchException { + public double compute(double[] a, double[] b) { return MathArrays.distance1(a, b); } }