{{ message }}
Removed redundant "exclusive"
leerho committed Mar 31, 2022
Showing 10 changed files with 40 additions and 27 deletions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 @@ -29,7 +29,7 @@ public class QuantilesHelper { * An array of {1,1,1,0} becomes {0,1,2,3} * @param array of weights where first element is zero * @return total weight */ //also used by KLL */ //used by classic Quantiles and KLL public static long convertToPrecedingCummulative(final long[] array) { long subtotal = 0; for (int i = 0; i < array.length; i++) { @@ -43,15 +43,28 @@ public static long convertToPrecedingCummulative(final long[] array) { /** * Returns the linear zero-based index (position) of a value in the hypothetical sorted stream of * values of size n. * @param phi the fractional position where: 0 ≤ φ ≤ 1.0. * @param rank the fractional position where: 0 ≤ φ ≤ 1.0. * @param n the size of the stream * @return the index, a value between 0 and n-1. */ //also used by KLL public static long posOfPhi(final double phi, final long n) { final long pos = (long) Math.floor(phi * n); */ //used by classic Quantiles and KLL public static long posOfRank(final double rank, final long n) { final long pos = (long) Math.floor(rank * n); return pos == n ? n - 1 : pos; //avoids ArrayIndexOutOfBoundException } /** * Returns the linear zero-based index (position) of a value in the hypothetical sorted stream of * values of size n. * @param rank the fractional position where: 0 ≤ φ ≤ 1.0. * @param n the size of the stream * @return the index, a value between 0 and n-1. * @deprecated use {@link #posOfRank(double, long)} instead. Version 3.2.0. */ //used by classic Quantiles and KLL @Deprecated public static long posOfPhi(final double rank, final long n) { return posOfRank(rank, n); } /** * This is written in terms of a plain array to facilitate testing. * @param wtArr the cumulative weights array consisting of chunks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 @@ -135,7 +135,7 @@ static KllDirectDoublesSketch newInstance(final int k, final int m, final Writab * the maximum value. * It is not necessary to include either the min or max values in these split points. * * @return an array of m+1 double values on the interval [0.0, 1.0) exclusive, * @return an array of m+1 double values on the interval [0.0, 1.0), * which are a consecutive approximation to the CDF of the input stream given the splitPoints. * The value at array position j of the returned CDF array is the sum of the returned values * in positions 0 through j of the returned PMF array. @@ -180,7 +180,7 @@ public double getMinValue() { * the maximum value. * It is not necessary to include either the min or max values in these split points. * * @return an array of m+1 doubles on the interval [0.0, 1.0) exclusive, * @return an array of m+1 doubles on the interval [0.0, 1.0), * each of which is an approximation to the fraction of the total input stream values * (the mass) that fall into one of those intervals. * The definition of an "interval" is inclusive of the left splitPoint and exclusive of the right
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 @@ -135,7 +135,7 @@ static KllDirectFloatsSketch newInstance(final int k, final int m, final Writabl * the maximum value. * It is not necessary to include either the min or max values in these split points. * * @return an array of m+1 double values on the interval [0.0, 1.0) exclusive, * @return an array of m+1 double values on the interval [0.0, 1.0), * which are a consecutive approximation to the CDF of the input stream given the splitPoints. * The value at array position j of the returned CDF array is the sum of the returned values * in positions 0 through j of the returned PMF array. @@ -180,7 +180,7 @@ public float getMinValue() { * the maximum value. * It is not necessary to include either the min or max values in these split points. * * @return an array of m+1 doubles on the interval [0.0, 1.0) exclusive, * @return an array of m+1 doubles on the interval [0.0, 1.0), * each of which is an approximation to the fraction of the total input stream values * (the mass) that fall into one of those intervals. * The definition of an "interval" is inclusive of the left splitPoint and exclusive of the right
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 @@ -132,8 +132,8 @@ private static void tandemMerge( } } double getQuantile(final double phi) { //phi is normalized rank [0,1]. final long pos = QuantilesHelper.posOfPhi(phi, n_); double getQuantile(final double rank) { final long pos = QuantilesHelper.posOfRank(rank, n_); return approximatelyAnswerPositonalQuery(pos); }
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 @@ -121,7 +121,7 @@ public static KllDoublesSketch heapify(final Memory mem) { * the maximum value. * It is not necessary to include either the min or max values in these split points. * * @return an array of m+1 double values on the interval [0.0, 1.0) exclusive, * @return an array of m+1 double values on the interval [0.0, 1.0), * which are a consecutive approximation to the CDF of the input stream given the splitPoints. * The value at array position j of the returned CDF array is the sum of the returned values * in positions 0 through j of the returned PMF array. @@ -162,7 +162,7 @@ public double[] getCDF(final double[] splitPoints) { * the maximum value. * It is not necessary to include either the min or max values in these split points. * * @return an array of m+1 doubles on the interval [0.0, 1.0) exclusive, * @return an array of m+1 doubles on the interval [0.0, 1.0), * each of which is an approximation to the fraction of the total input stream values * (the mass) that fall into one of those intervals. * The definition of an "interval" is inclusive of the left splitPoint and exclusive of the right
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 @@ -132,8 +132,8 @@ private static void tandemMerge( } } float getQuantile(final double phi) { //phi is normalized rank [0,1]. final long pos = QuantilesHelper.posOfPhi(phi, n_); float getQuantile(final double rank) { final long pos = QuantilesHelper.posOfRank(rank, n_); return approximatelyAnswerPositonalQuery(pos); }
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 @@ -121,7 +121,7 @@ public static KllFloatsSketch heapify(final Memory mem) { * the maximum value. * It is not necessary to include either the min or max values in these split points. * * @return an array of m+1 double values on the interval [0.0, 1.0) exclusive, * @return an array of m+1 double values on the interval [0.0, 1.0), * which are a consecutive approximation to the CDF of the input stream given the splitPoints. * The value at array position j of the returned CDF array is the sum of the returned values * in positions 0 through j of the returned PMF array. @@ -162,7 +162,7 @@ public double[] getCDF(final float[] splitPoints) { * the maximum value. * It is not necessary to include either the min or max values in these split points. * * @return an array of m+1 doubles on the interval [0.0, 1.0) exclusive, * @return an array of m+1 doubles on the interval [0.0, 1.0), * each of which is an approximation to the fraction of the total input stream values * (the mass) that fall into one of those intervals. * The definition of an "interval" is inclusive of the left splitPoint and exclusive of the right
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 @@ -70,12 +70,12 @@ final class DoublesAuxiliary { /** * Get the estimated quantile given a fractional rank. * @param fRank the fractional rank where: 0 ≤ fRank ≤ 1.0. * @param rank the normalized rank where: 0 ≤ rank ≤ 1.0. * @return the estimated quantile */ double getQuantile(final double fRank) { checkFractionalRankBounds(fRank); final long pos = QuantilesHelper.posOfPhi(fRank, auxN_); double getQuantile(final double rank) { checkFractionalRankBounds(rank); final long pos = QuantilesHelper.posOfRank(rank, auxN_); return approximatelyAnswerPositionalQuery(pos); }
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 @@ -79,13 +79,13 @@ /** * Get the estimated quantile given a fractional rank. * @param fRank the fractional rank where: 0 ≤ fRank ≤ 1.0. * @param rank the normalized rank where: 0 ≤ rank ≤ 1.0. * @return the estimated quantile */ T getQuantile(final double fRank) { checkFractionalRankBounds(fRank); T getQuantile(final double rank) { checkFractionalRankBounds(rank); if (auxN_ <= 0) { return null; } final long pos = QuantilesHelper.posOfPhi(fRank, auxN_); final long pos = QuantilesHelper.posOfRank(rank, auxN_); return approximatelyAnswerPositionalQuery(pos); }
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 @@ -855,9 +855,9 @@ public void checkPutMemoryTooSmall() { } @Test public void checkAuxPosOfPhi() throws Exception { public void checkAuxPosOfRank() throws Exception { long n = 10; long returnValue = QuantilesHelper.posOfPhi(1.0, 10); long returnValue = QuantilesHelper.posOfRank(1.0, 10); //println("" + returnValue); assertEquals(returnValue, n-1); }