| <!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_302) on Wed Jan 26 15:15:51 PST 2022 --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>CpcSketch (datasketches-java 3.1.0 API)</title> |
| <meta name="date" content="2022-01-26"> |
| <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 (datasketches-java 3.1.0 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":9,"i16":9,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":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="../../../../org/apache/datasketches/cpc/CompressionCharacterization.html" title="class in org.apache.datasketches.cpc"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/datasketches/cpc/CpcUnion.html" title="class in org.apache.datasketches.cpc"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/datasketches/cpc/CpcSketch.html" target="_top">Frames</a></li> |
| <li><a href="CpcSketch.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../allclasses-noframe.html">All 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: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </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">org.apache.datasketches.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>org.apache.datasketches.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"> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Field and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/cpc/CpcSketch.html#DEFAULT_LG_K">DEFAULT_LG_K</a></span></code> |
| <div class="block">The default Log_base2 of K</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ======== 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"> </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="../../../../org/apache/datasketches/cpc/CpcSketch.html#CpcSketch--">CpcSketch</a></span>()</code> |
| <div class="block">Constructor with default log_base2 of k</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/cpc/CpcSketch.html#CpcSketch-int-">CpcSketch</a></span>(int lgK)</code> |
| <div class="block">Constructor with log_base2 of k.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/cpc/CpcSketch.html#CpcSketch-int-long-">CpcSketch</a></span>(int lgK, |
| long 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"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </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="../../../../org/apache/datasketches/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="../../../../org/apache/datasketches/Family.html" title="enum in org.apache.datasketches">Family</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/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="../../../../org/apache/datasketches/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="../../../../org/apache/datasketches/cpc/CpcSketch.html#getLowerBound-int-">getLowerBound</a></span>(int 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="../../../../org/apache/datasketches/cpc/CpcSketch.html#getMaxSerializedBytes-int-">getMaxSerializedBytes</a></span>(int 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="../../../../org/apache/datasketches/cpc/CpcSketch.html#getUpperBound-int-">getUpperBound</a></span>(int 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="../../../../org/apache/datasketches/cpc/CpcSketch.html" title="class in org.apache.datasketches.cpc">CpcSketch</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/cpc/CpcSketch.html#heapify-byte:A-">heapify</a></span>(byte[] 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="../../../../org/apache/datasketches/cpc/CpcSketch.html" title="class in org.apache.datasketches.cpc">CpcSketch</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/cpc/CpcSketch.html#heapify-byte:A-long-">heapify</a></span>(byte[] byteArray, |
| long 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="../../../../org/apache/datasketches/cpc/CpcSketch.html" title="class in org.apache.datasketches.cpc">CpcSketch</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/cpc/CpcSketch.html#heapify-org.apache.datasketches.memory.Memory-">heapify</a></span>(org.apache.datasketches.memory.Memory 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="../../../../org/apache/datasketches/cpc/CpcSketch.html" title="class in org.apache.datasketches.cpc">CpcSketch</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/cpc/CpcSketch.html#heapify-org.apache.datasketches.memory.Memory-long-">heapify</a></span>(org.apache.datasketches.memory.Memory mem, |
| long 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="../../../../org/apache/datasketches/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="../../../../org/apache/datasketches/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="../../../../org/apache/datasketches/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="../../../../org/apache/datasketches/cpc/CpcSketch.html#toString--">toString</a></span>()</code> |
| <div class="block">Return a human-readable string summary of this sketch</div> |
| </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="../../../../org/apache/datasketches/cpc/CpcSketch.html#toString-boolean-">toString</a></span>(boolean 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>static <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="../../../../org/apache/datasketches/cpc/CpcSketch.html#toString-byte:A-boolean-">toString</a></span>(byte[] byteArr, |
| boolean detail)</code> |
| <div class="block">Returns a human readable string of the preamble of a byte array image of a CpcSketch.</div> |
| </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code>static <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="../../../../org/apache/datasketches/cpc/CpcSketch.html#toString-org.apache.datasketches.memory.Memory-boolean-">toString</a></span>(org.apache.datasketches.memory.Memory mem, |
| boolean detail)</code> |
| <div class="block">Returns a human readable string of the preamble of a Memory image of a CpcSketch.</div> |
| </td> |
| </tr> |
| <tr id="i17" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/cpc/CpcSketch.html#update-byte:A-">update</a></span>(byte[] data)</code> |
| <div class="block">Present the given byte array 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="../../../../org/apache/datasketches/cpc/CpcSketch.html#update-char:A-">update</a></span>(char[] data)</code> |
| <div class="block">Present the given char 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="../../../../org/apache/datasketches/cpc/CpcSketch.html#update-double-">update</a></span>(double datum)</code> |
| <div class="block">Present the given double (or float) datum 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="../../../../org/apache/datasketches/cpc/CpcSketch.html#update-int:A-">update</a></span>(int[] data)</code> |
| <div class="block">Present the given integer 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="../../../../org/apache/datasketches/cpc/CpcSketch.html#update-long-">update</a></span>(long datum)</code> |
| <div class="block">Present the given long as a potential unique item.</div> |
| </td> |
| </tr> |
| <tr id="i22" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/cpc/CpcSketch.html#update-long:A-">update</a></span>(long[] data)</code> |
| <div class="block">Present the given long array as a potential unique item.</div> |
| </td> |
| </tr> |
| <tr id="i23" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/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> datum)</code> |
| <div class="block">Present the given String as a potential unique item.</div> |
| </td> |
| </tr> |
| <tr id="i24" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/cpc/CpcSketch.html#validate--">validate</a></span>()</code> |
| <div class="block">Convience function that this Sketch is valid.</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 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"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a name="DEFAULT_LG_K"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>DEFAULT_LG_K</h4> |
| <pre>public static final int DEFAULT_LG_K</pre> |
| <div class="block">The default Log_base2 of K</div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../constant-values.html#org.apache.datasketches.cpc.CpcSketch.DEFAULT_LG_K">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="CpcSketch--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>CpcSketch</h4> |
| <pre>public CpcSketch()</pre> |
| <div class="block">Constructor with default log_base2 of k</div> |
| </li> |
| </ul> |
| <a name="CpcSketch-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>CpcSketch</h4> |
| <pre>public CpcSketch(int 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 CpcSketch(int lgK, |
| long 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 double 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 <a href="../../../../org/apache/datasketches/Family.html" title="enum in org.apache.datasketches">Family</a> 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 int 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 double getLowerBound(int 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 int getMaxSerializedBytes(int 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 double getUpperBound(int 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-org.apache.datasketches.memory.Memory-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>heapify</h4> |
| <pre>public static <a href="../../../../org/apache/datasketches/cpc/CpcSketch.html" title="class in org.apache.datasketches.cpc">CpcSketch</a> heapify(org.apache.datasketches.memory.Memory 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 <a href="../../../../org/apache/datasketches/cpc/CpcSketch.html" title="class in org.apache.datasketches.cpc">CpcSketch</a> heapify(byte[] 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-org.apache.datasketches.memory.Memory-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>heapify</h4> |
| <pre>public static <a href="../../../../org/apache/datasketches/cpc/CpcSketch.html" title="class in org.apache.datasketches.cpc">CpcSketch</a> heapify(org.apache.datasketches.memory.Memory mem, |
| long 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 <a href="../../../../org/apache/datasketches/cpc/CpcSketch.html" title="class in org.apache.datasketches.cpc">CpcSketch</a> heapify(byte[] byteArray, |
| long 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 boolean 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 void 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 byte[] 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 void update(long 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 void update(double 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 void 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> 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 void update(byte[] 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 void update(char[] 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="../../../../org/apache/datasketches/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 void update(int[] 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 void update(long[] 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="validate--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>validate</h4> |
| <pre>public boolean validate()</pre> |
| <div class="block">Convience function that this Sketch is valid. This is a troubleshooting tool |
| for sketches that have been heapified from serialized images. |
| |
| <p>If you are starting with a serialized image as a byte array, first heapify |
| the byte array to a sketch, which performs a number of checks. Then use this |
| function as one additional check on the sketch.</p></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>true if this sketch is validated.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="toString--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toString</h4> |
| <pre>public <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> toString()</pre> |
| <div class="block">Return a human-readable string summary of this sketch</div> |
| <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> in class <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="blockList"> |
| <li class="blockList"> |
| <h4>toString</h4> |
| <pre>public <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> toString(boolean 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> |
| <a name="toString-byte:A-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toString</h4> |
| <pre>public static <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> toString(byte[] byteArr, |
| boolean detail)</pre> |
| <div class="block">Returns a human readable string of the preamble of a byte array image of a CpcSketch.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>byteArr</code> - the given byte array</dd> |
| <dd><code>detail</code> - if true, a dump of the compressed window and surprising value streams will be |
| included.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a human readable string of the preamble of a byte array image of a CpcSketch.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="toString-org.apache.datasketches.memory.Memory-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>toString</h4> |
| <pre>public static <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> toString(org.apache.datasketches.memory.Memory mem, |
| boolean detail)</pre> |
| <div class="block">Returns a human readable string of the preamble of a Memory image of a CpcSketch.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>mem</code> - the given Memory</dd> |
| <dd><code>detail</code> - if true, a dump of the compressed window and surprising value streams will be |
| included.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a human readable string of the preamble of a Memory image of a CpcSketch.</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="../../../../org/apache/datasketches/cpc/CompressionCharacterization.html" title="class in org.apache.datasketches.cpc"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/datasketches/cpc/CpcUnion.html" title="class in org.apache.datasketches.cpc"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/datasketches/cpc/CpcSketch.html" target="_top">Frames</a></li> |
| <li><a href="CpcSketch.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses-noframe.html">All 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: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li><a href="#constructor.detail">Constr</a> | </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 © 2015–2020 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </body> |
| </html> |