Class CpcWrapper
java.lang.Object
org.apache.datasketches.cpc.CpcWrapper
This provides a read-only view of a serialized image of a CpcSketch, which can be
on-heap or off-heap represented as a MemorySegment object, or on-heap represented as a byte array.
- Author:
- Lee Rhodes, Kevin Lang
-
Constructor Summary
ConstructorsConstructorDescriptionCpcWrapper(byte[] byteArray) Construct a read-only view of the given byte array that contains a CpcSketch.CpcWrapper(MemorySegment seg) Construct a read-only view of the given MemorySegment that contains a CpcSketch -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the best estimate of the cardinality of the sketch.static FamilyReturn the DataSketches identifier for this CPC family of sketches.intgetLgK()Returns the configured Log_base2 of K of this sketch.doublegetLowerBound(int kappa) Returns the best estimate of the lower bound of the confidence interval given kappa, the number of standard deviations from the mean.doublegetUpperBound(int kappa) Returns the best estimate of the upper bound of the confidence interval given kappa, the number of standard deviations from the mean.
-
Constructor Details
-
CpcWrapper
Construct a read-only view of the given MemorySegment that contains a CpcSketch- Parameters:
seg- the given MemorySegment
-
CpcWrapper
public CpcWrapper(byte[] byteArray) Construct a read-only view of the given byte array that contains a CpcSketch.- Parameters:
byteArray- the given byte array
-
-
Method Details
-
getEstimate
public double getEstimate()Returns the best estimate of the cardinality of the sketch.- Returns:
- the best estimate of the cardinality of the sketch.
-
getFamily
Return the DataSketches identifier for this CPC family of sketches.- Returns:
- the DataSketches identifier for this CPC family of sketches.
-
getLgK
public int getLgK()Returns the configured Log_base2 of K of this sketch.- Returns:
- the configured Log_base2 of K of this sketch.
-
getLowerBound
public double getLowerBound(int kappa) Returns the best estimate of the lower bound of the confidence interval given kappa, the number of standard deviations from the mean.- Parameters:
kappa- the given number of standard deviations from the mean: 1, 2 or 3.- Returns:
- the best estimate of the lower bound of the confidence interval given kappa.
-
getUpperBound
public double getUpperBound(int kappa) Returns the best estimate of the upper bound of the confidence interval given kappa, the number of standard deviations from the mean.- Parameters:
kappa- the given number of standard deviations from the mean: 1, 2 or 3.- Returns:
- the best estimate of the upper bound of the confidence interval given kappa.
-