blob: 3c9a907e8bd53012dc2003616bf05a5fa4fcad8d [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_162) on Thu Oct 25 17:06:10 PDT 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CpcSketch (com.yahoo.datasketches:sketches-core 0.12.1-SNAPSHOT API)</title>
<meta name="date" content="2018-10-25">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="CpcSketch (com.yahoo.datasketches:sketches-core 0.12.1-SNAPSHOT API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":9,"i2":10,"i3":10,"i4":9,"i5":10,"i6":9,"i7":9,"i8":9,"i9":9,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/CpcSketch.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/yahoo/sketches/cpc/CompressedCpcWrapper.html" title="class in com.yahoo.sketches.cpc"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../com/yahoo/sketches/cpc/CpcUnion.html" title="class in com.yahoo.sketches.cpc"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/yahoo/sketches/cpc/CpcSketch.html" target="_top">Frames</a></li>
<li><a href="CpcSketch.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.yahoo.sketches.cpc</div>
<h2 title="Class CpcSketch" class="title">Class CpcSketch</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>com.yahoo.sketches.cpc.CpcSketch</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public final class <span class="typeNameLabel">CpcSketch</span>
extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">This is a unique-counting sketch that implements the
<i>Compressed Probabilistic Counting (CPC, a.k.a FM85)</i> algorithms developed by Kevin Lang in
his paper
<a href="https://arxiv.org/abs/1708.06839">Back to the Future: an Even More Nearly
Optimal Cardinality Estimation Algorithm</a>.
<p>This sketch is extremely space-efficient when serialized. In an apples-to-apples empirical
comparison against compressed HyperLogLog sketches, this new algorithm simultaneously wins on
the two dimensions of the space/accuracy tradeoff and produces sketches that are
smaller than the entropy of HLL, so no possible implementation of compressed HLL can match its
space efficiency for a given accuracy. As described in the paper this sketch implements a newly
developed ICON estimator algorithm that survives unioning operations, another
well-known estimator, the
<a href="https://arxiv.org/abs/1306.3284">Historical Inverse Probability (HIP)</a> estimator
does not.
The update speed performance of this sketch is quite fast and is comparable to the speed of HLL.
The unioning (merging) capability of this sketch also allows for merging of sketches with
different configurations of K.
<p>For additional security this sketch can be configured with a user-specified hash seed.</div>
<dl>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd>Lee Rhodes, Kevin Lang</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#CpcSketch-int-">CpcSketch</a></span>(int&nbsp;lgK)</code>
<div class="block">Constructor with log_base2 of k.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#CpcSketch-int-long-">CpcSketch</a></span>(int&nbsp;lgK,
long&nbsp;seed)</code>
<div class="block">Constructor with log_base2 of k and seed.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#getEstimate--">getEstimate</a></span>()</code>
<div class="block">Returns the best estimate of the cardinality of the sketch.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static <a href="../../../../com/yahoo/sketches/Family.html" title="enum in com.yahoo.sketches">Family</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#getFamily--">getFamily</a></span>()</code>
<div class="block">Return the DataSketches identifier for this CPC family of sketches.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#getLgK--">getLgK</a></span>()</code>
<div class="block">Return the parameter LgK.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#getLowerBound-int-">getLowerBound</a></span>(int&nbsp;kappa)</code>
<div class="block">Returns the best estimate of the lower bound of the confidence interval given <i>kappa</i>,
the number of standard deviations from the mean.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#getMaxSerializedBytes-int-">getMaxSerializedBytes</a></span>(int&nbsp;lgK)</code>
<div class="block">The actual size of a compressed CPC sketch has a small random variance, but the following
empirically measured size should be large enough for at least 99.9 percent of sketches.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#getUpperBound-int-">getUpperBound</a></span>(int&nbsp;kappa)</code>
<div class="block">Returns the best estimate of the upper bound of the confidence interval given <i>kappa</i>,
the number of standard deviations from the mean.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>static <a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html" title="class in com.yahoo.sketches.cpc">CpcSketch</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#heapify-byte:A-">heapify</a></span>(byte[]&nbsp;byteArray)</code>
<div class="block">Return the given byte array as a CpcSketch on the Java heap using the DEFAULT_UPDATE_SEED.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>static <a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html" title="class in com.yahoo.sketches.cpc">CpcSketch</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#heapify-byte:A-long-">heapify</a></span>(byte[]&nbsp;byteArray,
long&nbsp;seed)</code>
<div class="block">Return the given byte array as a CpcSketch on the Java heap.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>static <a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html" title="class in com.yahoo.sketches.cpc">CpcSketch</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#heapify-com.yahoo.memory.Memory-">heapify</a></span>(com.yahoo.memory.Memory&nbsp;mem)</code>
<div class="block">Return the given Memory as a CpcSketch on the Java heap using the DEFAULT_UPDATE_SEED.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>static <a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html" title="class in com.yahoo.sketches.cpc">CpcSketch</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#heapify-com.yahoo.memory.Memory-long-">heapify</a></span>(com.yahoo.memory.Memory&nbsp;mem,
long&nbsp;seed)</code>
<div class="block">Return the given Memory as a CpcSketch on the Java heap.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#isEmpty--">isEmpty</a></span>()</code>
<div class="block">Return true if this sketch is empty</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#reset--">reset</a></span>()</code>
<div class="block">Resets this sketch to empty but retains the original LgK and Seed.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#toByteArray--">toByteArray</a></span>()</code>
<div class="block">Return this sketch as a compressed byte array.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#toString--">toString</a></span>()</code>&nbsp;</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#toString-boolean-">toString</a></span>(boolean&nbsp;detail)</code>
<div class="block">Return a human-readable string summary of this sketch</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#update-byte:A-">update</a></span>(byte[]&nbsp;data)</code>
<div class="block">Present the given byte array as a potential unique item.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#update-char:A-">update</a></span>(char[]&nbsp;data)</code>
<div class="block">Present the given char array as a potential unique item.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#update-double-">update</a></span>(double&nbsp;datum)</code>
<div class="block">Present the given double (or float) datum as a potential unique item.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#update-int:A-">update</a></span>(int[]&nbsp;data)</code>
<div class="block">Present the given integer array as a potential unique item.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#update-long-">update</a></span>(long&nbsp;datum)</code>
<div class="block">Present the given long as a potential unique item.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#update-long:A-">update</a></span>(long[]&nbsp;data)</code>
<div class="block">Present the given long array as a potential unique item.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#update-java.lang.String-">update</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;datum)</code>
<div class="block">Present the given String as a potential unique item.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="CpcSketch-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>CpcSketch</h4>
<pre>public&nbsp;CpcSketch(int&nbsp;lgK)</pre>
<div class="block">Constructor with log_base2 of k.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>lgK</code> - the given log_base2 of k</dd>
</dl>
</li>
</ul>
<a name="CpcSketch-int-long-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>CpcSketch</h4>
<pre>public&nbsp;CpcSketch(int&nbsp;lgK,
long&nbsp;seed)</pre>
<div class="block">Constructor with log_base2 of k and seed.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>lgK</code> - the given log_base2 of k</dd>
<dd><code>seed</code> - the given seed</dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getEstimate--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEstimate</h4>
<pre>public&nbsp;double&nbsp;getEstimate()</pre>
<div class="block">Returns the best estimate of the cardinality of the sketch.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the best estimate of the cardinality of the sketch.</dd>
</dl>
</li>
</ul>
<a name="getFamily--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getFamily</h4>
<pre>public static&nbsp;<a href="../../../../com/yahoo/sketches/Family.html" title="enum in com.yahoo.sketches">Family</a>&nbsp;getFamily()</pre>
<div class="block">Return the DataSketches identifier for this CPC family of sketches.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the DataSketches identifier for this CPC family of sketches.</dd>
</dl>
</li>
</ul>
<a name="getLgK--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLgK</h4>
<pre>public&nbsp;int&nbsp;getLgK()</pre>
<div class="block">Return the parameter LgK.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the parameter LgK.</dd>
</dl>
</li>
</ul>
<a name="getLowerBound-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLowerBound</h4>
<pre>public&nbsp;double&nbsp;getLowerBound(int&nbsp;kappa)</pre>
<div class="block">Returns the best estimate of the lower bound of the confidence interval given <i>kappa</i>,
the number of standard deviations from the mean.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>kappa</code> - the given number of standard deviations from the mean: 1, 2 or 3.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the best estimate of the lower bound of the confidence interval given <i>kappa</i>.</dd>
</dl>
</li>
</ul>
<a name="getMaxSerializedBytes-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMaxSerializedBytes</h4>
<pre>public static&nbsp;int&nbsp;getMaxSerializedBytes(int&nbsp;lgK)</pre>
<div class="block">The actual size of a compressed CPC sketch has a small random variance, but the following
empirically measured size should be large enough for at least 99.9 percent of sketches.
<p>For small values of <i>n</i> the size can be much smaller.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>lgK</code> - the given value of lgK.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the estimated maximum compressed serialized size of a sketch.</dd>
</dl>
</li>
</ul>
<a name="getUpperBound-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getUpperBound</h4>
<pre>public&nbsp;double&nbsp;getUpperBound(int&nbsp;kappa)</pre>
<div class="block">Returns the best estimate of the upper bound of the confidence interval given <i>kappa</i>,
the number of standard deviations from the mean.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>kappa</code> - the given number of standard deviations from the mean: 1, 2 or 3.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the best estimate of the upper bound of the confidence interval given <i>kappa</i>.</dd>
</dl>
</li>
</ul>
<a name="heapify-com.yahoo.memory.Memory-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>heapify</h4>
<pre>public static&nbsp;<a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html" title="class in com.yahoo.sketches.cpc">CpcSketch</a>&nbsp;heapify(com.yahoo.memory.Memory&nbsp;mem)</pre>
<div class="block">Return the given Memory as a CpcSketch on the Java heap using the DEFAULT_UPDATE_SEED.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>mem</code> - the given Memory</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the given Memory as a CpcSketch on the Java heap.</dd>
</dl>
</li>
</ul>
<a name="heapify-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>heapify</h4>
<pre>public static&nbsp;<a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html" title="class in com.yahoo.sketches.cpc">CpcSketch</a>&nbsp;heapify(byte[]&nbsp;byteArray)</pre>
<div class="block">Return the given byte array as a CpcSketch on the Java heap using the DEFAULT_UPDATE_SEED.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>byteArray</code> - the given byte array</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the given byte array as a CpcSketch on the Java heap.</dd>
</dl>
</li>
</ul>
<a name="heapify-com.yahoo.memory.Memory-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>heapify</h4>
<pre>public static&nbsp;<a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html" title="class in com.yahoo.sketches.cpc">CpcSketch</a>&nbsp;heapify(com.yahoo.memory.Memory&nbsp;mem,
long&nbsp;seed)</pre>
<div class="block">Return the given Memory as a CpcSketch on the Java heap.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>mem</code> - the given Memory</dd>
<dd><code>seed</code> - the seed used to create the original sketch from which the Memory was derived.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the given Memory as a CpcSketch on the Java heap.</dd>
</dl>
</li>
</ul>
<a name="heapify-byte:A-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>heapify</h4>
<pre>public static&nbsp;<a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html" title="class in com.yahoo.sketches.cpc">CpcSketch</a>&nbsp;heapify(byte[]&nbsp;byteArray,
long&nbsp;seed)</pre>
<div class="block">Return the given byte array as a CpcSketch on the Java heap.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>byteArray</code> - the given byte array</dd>
<dd><code>seed</code> - the seed used to create the original sketch from which the byte array was derived.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the given byte array as a CpcSketch on the Java heap.</dd>
</dl>
</li>
</ul>
<a name="isEmpty--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isEmpty</h4>
<pre>public&nbsp;boolean&nbsp;isEmpty()</pre>
<div class="block">Return true if this sketch is empty</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if this sketch is empty</dd>
</dl>
</li>
</ul>
<a name="reset--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>reset</h4>
<pre>public final&nbsp;void&nbsp;reset()</pre>
<div class="block">Resets this sketch to empty but retains the original LgK and Seed.</div>
</li>
</ul>
<a name="toByteArray--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toByteArray</h4>
<pre>public&nbsp;byte[]&nbsp;toByteArray()</pre>
<div class="block">Return this sketch as a compressed byte array.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>this sketch as a compressed byte array.</dd>
</dl>
</li>
</ul>
<a name="update-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>update</h4>
<pre>public&nbsp;void&nbsp;update(long&nbsp;datum)</pre>
<div class="block">Present the given long as a potential unique item.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>datum</code> - The given long datum.</dd>
</dl>
</li>
</ul>
<a name="update-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>update</h4>
<pre>public&nbsp;void&nbsp;update(double&nbsp;datum)</pre>
<div class="block">Present the given double (or float) datum as a potential unique item.
The double will be converted to a long using Double.doubleToLongBits(datum),
which normalizes all NaN values to a single NaN representation.
Plus and minus zero will be normalized to plus zero.
The special floating-point values NaN and +/- Infinity are treated as distinct.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>datum</code> - The given double datum.</dd>
</dl>
</li>
</ul>
<a name="update-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>update</h4>
<pre>public&nbsp;void&nbsp;update(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;datum)</pre>
<div class="block">Present the given String as a potential unique item.
The string is converted to a byte array using UTF8 encoding.
If the string is null or empty no update attempt is made and the method returns.
<p>Note: About 2X faster performance can be obtained by first converting the String to a
char[] and updating the sketch with that. This bypasses the complexity of the Java UTF_8
encoding. This, of course, will not produce the same internal hash values as updating directly
with a String. So be consistent! Unioning two sketches, one fed with strings and the other
fed with char[] will be meaningless.
</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>datum</code> - The given String.</dd>
</dl>
</li>
</ul>
<a name="update-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>update</h4>
<pre>public&nbsp;void&nbsp;update(byte[]&nbsp;data)</pre>
<div class="block">Present the given byte array as a potential unique item.
If the byte array is null or empty no update attempt is made and the method returns.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>data</code> - The given byte array.</dd>
</dl>
</li>
</ul>
<a name="update-char:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>update</h4>
<pre>public&nbsp;void&nbsp;update(char[]&nbsp;data)</pre>
<div class="block">Present the given char array as a potential unique item.
If the char array is null or empty no update attempt is made and the method returns.
<p>Note: this will not produce the same output hash values as the <a href="../../../../com/yahoo/sketches/cpc/CpcSketch.html#update-java.lang.String-"><code>update(String)</code></a>
method but will be a little faster as it avoids the complexity of the UTF8 encoding.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>data</code> - The given char array.</dd>
</dl>
</li>
</ul>
<a name="update-int:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>update</h4>
<pre>public&nbsp;void&nbsp;update(int[]&nbsp;data)</pre>
<div class="block">Present the given integer array as a potential unique item.
If the integer array is null or empty no update attempt is made and the method returns.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>data</code> - The given int array.</dd>
</dl>
</li>
</ul>
<a name="update-long:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>update</h4>
<pre>public&nbsp;void&nbsp;update(long[]&nbsp;data)</pre>
<div class="block">Present the given long array as a potential unique item.
If the long array is null or empty no update attempt is made and the method returns.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>data</code> - The given long array.</dd>
</dl>
</li>
</ul>
<a name="toString--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toString</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;toString()</pre>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></dd>
</dl>
</li>
</ul>
<a name="toString-boolean-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>toString</h4>
<pre>public&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;toString(boolean&nbsp;detail)</pre>
<div class="block">Return a human-readable string summary of this sketch</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>detail</code> - include data detail</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a human-readable string summary of this sketch</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/CpcSketch.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/yahoo/sketches/cpc/CompressedCpcWrapper.html" title="class in com.yahoo.sketches.cpc"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../com/yahoo/sketches/cpc/CpcUnion.html" title="class in com.yahoo.sketches.cpc"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/yahoo/sketches/cpc/CpcSketch.html" target="_top">Frames</a></li>
<li><a href="CpcSketch.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2015&#x2013;2018. All rights reserved.</small></p>
</body>
</html>