Class CpcWrapper

java.lang.Object
org.apache.datasketches.cpc.CpcWrapper

public final class CpcWrapper
extends Object
This provides a read-only view of a serialized image of a CpcSketch, which can be on-heap or off-heap represented as a Memory object, or on-heap represented as a byte array.
Author:
Lee Rhodes, Kevin Lang
  • Constructor Summary

    Constructors 
    Constructor Description
    CpcWrapper​(byte[] byteArray)
    Construct a read-only view of the given byte array that contains a CpcSketch.
    CpcWrapper​(org.apache.datasketches.memory.Memory mem)
    Construct a read-only view of the given Memory that contains a CpcSketch
  • Method Summary

    Modifier and Type Method Description
    double getEstimate()
    Returns the best estimate of the cardinality of the sketch.
    static Family getFamily()
    Return the DataSketches identifier for this CPC family of sketches.
    int getLgK()
    Returns the configured Log_base2 of K of this sketch.
    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.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CpcWrapper

      public CpcWrapper​(org.apache.datasketches.memory.Memory mem)
      Construct a read-only view of the given Memory that contains a CpcSketch
      Parameters:
      mem - the given Memory
    • 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

      public static Family 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.