From 407f1e780e63df0af81a80f499dfbfe5d2841612 Mon Sep 17 00:00:00 2001 From: Gilles Sadowski Date: Sun, 27 Oct 2019 15:02:21 +0100 Subject: [PATCH] Code upgraded following MATH-1499. --- .../math4/stat/inference/KolmogorovSmirnovTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java b/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java index accc3d6ac..026a94ede 100644 --- a/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java +++ b/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java @@ -27,7 +27,6 @@ import org.apache.commons.statistics.distribution.ContinuousDistribution; import org.apache.commons.numbers.combinatorics.BinomialCoefficientDouble; import org.apache.commons.numbers.fraction.BigFraction; import org.apache.commons.numbers.field.BigFractionField; -import org.apache.commons.numbers.field.FieldSquareMatrix; import org.apache.commons.math4.distribution.EnumeratedRealDistribution; import org.apache.commons.math4.distribution.AbstractRealDistribution; import org.apache.commons.math4.exception.InsufficientDataException; @@ -44,6 +43,7 @@ import org.apache.commons.math4.linear.RealMatrix; import org.apache.commons.math4.util.FastMath; import org.apache.commons.math4.util.MathArrays; import org.apache.commons.math4.util.MathUtils; +import org.apache.commons.math4.field.linalg.FieldDenseMatrix; /** * Implementation of the @@ -490,14 +490,14 @@ public class KolmogorovSmirnovTest { private double exactK(double d, int n) { final int k = (int) Math.ceil(n * d); - final FieldSquareMatrix H; + final FieldDenseMatrix H; try { H = createExactH(d, n); } catch (ArithmeticException e) { throw new MathArithmeticException(LocalizedFormats.FRACTION); } - final FieldSquareMatrix Hpower = H.pow(n); + final FieldDenseMatrix Hpower = H.pow(n); BigFraction pFrac = Hpower.get(k - 1, k - 1); @@ -684,8 +684,8 @@ public class KolmogorovSmirnovTest { * @throws ArithmeticException if algorithm fails to convert {@code h} to a * {@link BigFraction}. */ - private FieldSquareMatrix createExactH(double d, - int n) { + private FieldDenseMatrix createExactH(double d, + int n) { final int k = (int) Math.ceil(n * d); final int m = 2 * k - 1; final double hDouble = k - n * d; @@ -702,7 +702,7 @@ public class KolmogorovSmirnovTest { h = BigFraction.from(hDouble, 1e-5, 10000); } } - final FieldSquareMatrix Hdata = FieldSquareMatrix.create(BigFractionField.get(), m); + final FieldDenseMatrix Hdata = FieldDenseMatrix.create(BigFractionField.get(), m, m); /* * Start by filling everything with either 0 or 1.