Package org.apache.datasketches
Class QuantilesHelper
- java.lang.Object
-
- org.apache.datasketches.QuantilesHelper
-
public class QuantilesHelper extends Object
Common static methods for classic quantiles and KLL sketches
-
-
Constructor Summary
Constructors Constructor Description QuantilesHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static intchunkContainingPos(long[] wtArr, long pos)This is written in terms of a plain array to facilitate testing.static longconvertToPrecedingCummulative(long[] array)Convert the weights into totals of the weights preceding each item.static longposOfPhi(double rank, long n)Deprecated.useposOfRank(double, long)instead.static longposOfRank(double rank, long n)Returns the linear zero-based index (position) of a value in the hypothetical sorted stream of values of size n.
-
-
-
Method Detail
-
convertToPrecedingCummulative
public static long convertToPrecedingCummulative(long[] array)
Convert the weights into totals of the weights preceding each item. An array of {1,1,1,0} becomes {0,1,2,3}- Parameters:
array- of weights where first element is zero- Returns:
- total weight
-
posOfRank
public static long posOfRank(double rank, long n)Returns the linear zero-based index (position) of a value in the hypothetical sorted stream of values of size n.- Parameters:
rank- the fractional position where: 0 ≤ φ ≤ 1.0.n- the size of the stream- Returns:
- the index, a value between 0 and n-1.
-
posOfPhi
@Deprecated public static long posOfPhi(double rank, long n)
Deprecated.useposOfRank(double, long)instead. Version 3.2.0.Returns the linear zero-based index (position) of a value in the hypothetical sorted stream of values of size n.- Parameters:
rank- the fractional position where: 0 ≤ φ ≤ 1.0.n- the size of the stream- Returns:
- the index, a value between 0 and n-1.
-
chunkContainingPos
public static int chunkContainingPos(long[] wtArr, long pos)This is written in terms of a plain array to facilitate testing.- Parameters:
wtArr- the cumulative weights array consisting of chunkspos- the position- Returns:
- the index of the chunk containing the position
-
-