| <!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>ReqSketch (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="ReqSketch (datasketches-java 3.1.0 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":9,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":9,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10,"i27":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/ReqSketch.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/req/ReqIterator.html" title="class in org.apache.datasketches.req"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/datasketches/req/ReqSketchBuilder.html" title="class in org.apache.datasketches.req"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/datasketches/req/ReqSketch.html" target="_top">Frames</a></li> |
| <li><a href="ReqSketch.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>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </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.req</div> |
| <h2 title="Class ReqSketch" class="title">Class ReqSketch</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.req.ReqSketch</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>public class <span class="typeNameLabel">ReqSketch</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 Relative Error Quantiles Sketch is the Java implementation based on the paper |
| "Relative Error Streaming Quantiles", https://arxiv.org/abs/2004.01668, and loosely derived from |
| a Python prototype written by Pavel Vesely. |
| |
| <p>This implementation differs from the algorithm described in the paper in the following:</p> |
| |
| <ul> |
| <li>The algorithm requires no upper bound on the stream length. |
| Instead, each relative-compactor counts the number of compaction operations performed |
| so far (via variable state). Initially, the relative-compactor starts with INIT_NUMBER_OF_SECTIONS. |
| Each time the number of compactions (variable state) exceeds 2^{numSections - 1}, we double |
| numSections. Note that after merging the sketch with another one variable state may not correspond |
| to the number of compactions performed at a particular level, however, since the state variable |
| never exceeds the number of compactions, the guarantees of the sketch remain valid.</li> |
| |
| <li>The size of each section (variable k and sectionSize in the code and parameter k in |
| the paper) is initialized with a value set by the user via variable k. |
| When the number of sections doubles, we decrease sectionSize by a factor of sqrt(2). |
| This is applied at each level separately. Thus, when we double the number of sections, the |
| nominal compactor size increases by a factor of approx. sqrt(2) (+/- rounding).</li> |
| |
| <li>The merge operation here does not perform "special compactions", which are used in the paper |
| to allow for a tight mathematical analysis of the sketch.</li> |
| </ul> |
| |
| <p>This implementation provides a number of capabilities not discussed in the paper or provided |
| in the Python prototype.</p> |
| <ul><li>The Python prototype only implemented high accuracy for low ranks. This implementation |
| provides the user with the ability to choose either high rank accuracy or low rank accuracy at |
| the time of sketch construction.</li> |
| <li>The Python prototype only implemented a comparison criterion of "≤". This implementation |
| allows the user to switch back and forth between the "≤" criterion and the "<" criterion.</li> |
| <li>This implementation provides extensive debug visibility into the operation of the sketch with |
| two levels of detail output. This is not only useful for debugging, but is a powerful tool to |
| help users understand how the sketch works.</li> |
| </ul></div> |
| <dl> |
| <dt><span class="simpleTagLabel">Author:</span></dt> |
| <dd>Edo Liberty, Pavel Vesely, Lee Rhodes</dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========== 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>static <a href="../../../../org/apache/datasketches/req/ReqSketchBuilder.html" title="class in org.apache.datasketches.req">ReqSketchBuilder</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#builder--">builder</a></span>()</code> |
| <div class="block">Returns a new ReqSketchBuilder</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>double[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#getCDF-float:A-">getCDF</a></span>(float[] splitPoints)</code> |
| <div class="block">Returns an approximation to the Cumulative Distribution Function (CDF), which is the |
| cumulative analog of the PMF, of the input stream given a set of splitPoint (values).</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#getHighRankAccuracy--">getHighRankAccuracy</a></span>()</code> |
| <div class="block">If true, the high ranks are prioritized for better accuracy.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>float</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#getMaxValue--">getMaxValue</a></span>()</code> |
| <div class="block">Gets the largest value seen by this sketch</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>float</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#getMinValue--">getMinValue</a></span>()</code> |
| <div class="block">Gets the smallest value seen by this sketch</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>long</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#getN--">getN</a></span>()</code> |
| <div class="block">Gets the total number of items offered to the sketch.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>double[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#getPMF-float:A-">getPMF</a></span>(float[] splitPoints)</code> |
| <div class="block">Returns an approximation to the Probability Mass Function (PMF) of the input stream |
| given a set of splitPoints (values).</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>float</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#getQuantile-double-">getQuantile</a></span>(double normRank)</code> |
| <div class="block">Gets the approximate quantile of the given normalized rank based on the lteq criterion.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>float[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#getQuantiles-double:A-">getQuantiles</a></span>(double[] normRanks)</code> |
| <div class="block">Gets an array of quantiles that correspond to the given array of normalized ranks.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>double</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#getRank-float-">getRank</a></span>(float value)</code> |
| <div class="block">Computes the normalized rank of the given value in the stream.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>double</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#getRankLowerBound-double-int-">getRankLowerBound</a></span>(double rank, |
| int numStdDev)</code> |
| <div class="block">returns an approximate lower bound rank of the given noramalized rank.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>double[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#getRanks-float:A-">getRanks</a></span>(float[] values)</code> |
| <div class="block">Gets an array of normalized ranks that correspond to the given array of values.</div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code>double</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#getRankUpperBound-double-int-">getRankUpperBound</a></span>(double rank, |
| int numStdDev)</code> |
| <div class="block">Returns an approximate upper bound rank of the given rank.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#getRetainedItems--">getRetainedItems</a></span>()</code> |
| <div class="block">Gets the number of retained items of this sketch</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code>double</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#getRSE-int-double-boolean-long-">getRSE</a></span>(int k, |
| double rank, |
| boolean hra, |
| long totalN)</code> |
| <div class="block">Returns an a priori estimate of relative standard error (RSE, expressed as a number in [0,1]).</div> |
| </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code>int</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#getSerializationBytes--">getSerializationBytes</a></span>()</code> |
| <div class="block">Gets the number of bytes when serialized.</div> |
| </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code>static <a href="../../../../org/apache/datasketches/req/ReqSketch.html" title="class in org.apache.datasketches.req">ReqSketch</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#heapify-org.apache.datasketches.memory.Memory-">heapify</a></span>(org.apache.datasketches.memory.Memory mem)</code> |
| <div class="block">Returns an ReqSketch on the heap from a Memory image of the sketch.</div> |
| </td> |
| </tr> |
| <tr id="i17" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#isEmpty--">isEmpty</a></span>()</code> |
| <div class="block">Returns true if this sketch is empty.</div> |
| </td> |
| </tr> |
| <tr id="i18" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#isEstimationMode--">isEstimationMode</a></span>()</code> |
| <div class="block">Returns true if this sketch is in estimation mode.</div> |
| </td> |
| </tr> |
| <tr id="i19" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#isLessThanOrEqual--">isLessThanOrEqual</a></span>()</code> |
| <div class="block">Returns the current comparison criterion.</div> |
| </td> |
| </tr> |
| <tr id="i20" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/datasketches/req/ReqIterator.html" title="class in org.apache.datasketches.req">ReqIterator</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#iterator--">iterator</a></span>()</code> |
| <div class="block">Returns an iterator for all the items in this sketch.</div> |
| </td> |
| </tr> |
| <tr id="i21" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/datasketches/req/ReqSketch.html" title="class in org.apache.datasketches.req">ReqSketch</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#merge-org.apache.datasketches.req.ReqSketch-">merge</a></span>(<a href="../../../../org/apache/datasketches/req/ReqSketch.html" title="class in org.apache.datasketches.req">ReqSketch</a> other)</code> |
| <div class="block">Merge other sketch into this one.</div> |
| </td> |
| </tr> |
| <tr id="i22" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/datasketches/req/ReqSketch.html" title="class in org.apache.datasketches.req">ReqSketch</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#reset--">reset</a></span>()</code> |
| <div class="block">Resets this sketch by removing all data and setting all data related variables to their |
| virgin state.</div> |
| </td> |
| </tr> |
| <tr id="i23" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/datasketches/req/ReqSketch.html" title="class in org.apache.datasketches.req">ReqSketch</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#setLessThanOrEqual-boolean-">setLessThanOrEqual</a></span>(boolean ltEq)</code> |
| <div class="block">Sets the chosen criterion for value comparison</div> |
| </td> |
| </tr> |
| <tr id="i24" class="altColor"> |
| <td class="colFirst"><code>byte[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#toByteArray--">toByteArray</a></span>()</code> |
| <div class="block">Returns a byte array representation of this sketch.</div> |
| </td> |
| </tr> |
| <tr id="i25" 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/req/ReqSketch.html#toString--">toString</a></span>()</code> |
| <div class="block">Returns a summary of the key parameters of the sketch.</div> |
| </td> |
| </tr> |
| <tr id="i26" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/datasketches/req/ReqSketch.html#update-float-">update</a></span>(float item)</code> |
| <div class="block">Updates this sketch with the given item.</div> |
| </td> |
| </tr> |
| <tr id="i27" 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/req/ReqSketch.html#viewCompactorDetail-java.lang.String-boolean-">viewCompactorDetail</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> fmt, |
| boolean allData)</code> |
| <div class="block">A detailed, human readable view of the sketch compactors and their data.</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"> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <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/req/ReqSketch.html" title="class in org.apache.datasketches.req">ReqSketch</a> heapify(org.apache.datasketches.memory.Memory mem)</pre> |
| <div class="block">Returns an ReqSketch on the heap from a Memory image of the sketch.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>mem</code> - The Memory object holding a valid image of an ReqSketch</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an ReqSketch on the heap from a Memory image of the sketch.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="builder--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>builder</h4> |
| <pre>public static final <a href="../../../../org/apache/datasketches/req/ReqSketchBuilder.html" title="class in org.apache.datasketches.req">ReqSketchBuilder</a> builder()</pre> |
| <div class="block">Returns a new ReqSketchBuilder</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a new ReqSketchBuilder</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getCDF-float:A-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getCDF</h4> |
| <pre>public double[] getCDF(float[] splitPoints)</pre> |
| <div class="block">Returns an approximation to the Cumulative Distribution Function (CDF), which is the |
| cumulative analog of the PMF, of the input stream given a set of splitPoint (values). |
| |
| <p>The resulting approximations have a probabilistic guarantee that be obtained, a priori, |
| from the <i>getRSE(int, double, boolean, long)</i> function. |
| |
| <p>If the sketch is empty this returns null.</p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>splitPoints</code> - an array of <i>m</i> unique, monotonically increasing double values |
| that divide the real number line into <i>m+1</i> consecutive disjoint intervals. |
| The definition of an "interval" is inclusive of the left splitPoint (or minimum value) and |
| exclusive of the right splitPoint, with the exception that the last interval will include |
| the maximum value. |
| It is not necessary to include either the min or max values in these split points.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an array of m+1 double values, which are a consecutive approximation to the CDF |
| of the input stream given the splitPoints. The value at array position j of the returned |
| CDF array is the sum of the returned values in positions 0 through j of the returned PMF |
| array.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getHighRankAccuracy--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getHighRankAccuracy</h4> |
| <pre>public boolean getHighRankAccuracy()</pre> |
| <div class="block">If true, the high ranks are prioritized for better accuracy. Otherwise |
| the low ranks are prioritized for better accuracy. This state is chosen during sketch |
| construction.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the high ranks accuracy state.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getMaxValue--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMaxValue</h4> |
| <pre>public float getMaxValue()</pre> |
| <div class="block">Gets the largest value seen by this sketch</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the largest value seen by this sketch</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getMinValue--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getMinValue</h4> |
| <pre>public float getMinValue()</pre> |
| <div class="block">Gets the smallest value seen by this sketch</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the smallest value seen by this sketch</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getN--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getN</h4> |
| <pre>public long getN()</pre> |
| <div class="block">Gets the total number of items offered to the sketch.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the total number of items offered to the sketch.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getPMF-float:A-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getPMF</h4> |
| <pre>public double[] getPMF(float[] splitPoints)</pre> |
| <div class="block">Returns an approximation to the Probability Mass Function (PMF) of the input stream |
| given a set of splitPoints (values). |
| |
| <p>The resulting approximations have a probabilistic guarantee that be obtained, a priori, |
| from the <i>getRSE(int, double, boolean, long)</i> function. |
| |
| <p>If the sketch is empty this returns null.</p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>splitPoints</code> - an array of <i>m</i> unique, monotonically increasing double values |
| that divide the real number line into <i>m+1</i> consecutive disjoint intervals. |
| The definition of an "interval" is inclusive of the left splitPoint (or minimum value) and |
| exclusive of the right splitPoint, with the exception that the last interval will include |
| the maximum value. |
| It is not necessary to include either the min or max values in these splitpoints.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an array of m+1 doubles each of which is an approximation |
| to the fraction of the input stream values (the mass) that fall into one of those intervals. |
| The definition of an "interval" is inclusive of the left splitPoint and exclusive of the right |
| splitPoint, with the exception that the last interval will include maximum value.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getQuantile-double-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getQuantile</h4> |
| <pre>public float getQuantile(double normRank)</pre> |
| <div class="block">Gets the approximate quantile of the given normalized rank based on the lteq criterion. |
| The normalized rank must be in the range [0.0, 1.0] (inclusive, inclusive).</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>normRank</code> - the given normalized rank</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the approximate quantile given the normalized rank.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getQuantiles-double:A-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getQuantiles</h4> |
| <pre>public float[] getQuantiles(double[] normRanks)</pre> |
| <div class="block">Gets an array of quantiles that correspond to the given array of normalized ranks.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>normRanks</code> - the given array of normalized ranks.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the array of quantiles that correspond to the given array of normalized ranks. |
| See <i>getQuantile(double)</i></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getRank-float-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getRank</h4> |
| <pre>public double getRank(float value)</pre> |
| <div class="block">Computes the normalized rank of the given value in the stream. |
| The normalized rank is the fraction of values less than the given value; |
| or if lteq is true, the fraction of values less than or equal to the given value.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>value</code> - the given value</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the normalized rank of the given value in the stream.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getRanks-float:A-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getRanks</h4> |
| <pre>public double[] getRanks(float[] values)</pre> |
| <div class="block">Gets an array of normalized ranks that correspond to the given array of values.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>values</code> - the given array of values.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the array of normalized ranks that correspond to the given array of values. |
| See <i>getRank(float)</i></dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getRankLowerBound-double-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getRankLowerBound</h4> |
| <pre>public double getRankLowerBound(double rank, |
| int numStdDev)</pre> |
| <div class="block">returns an approximate lower bound rank of the given noramalized rank.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>rank</code> - the given rank, a value between 0 and 1.0.</dd> |
| <dd><code>numStdDev</code> - the number of standard deviations. Must be 1, 2, or 3.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an approximate lower bound rank.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getRankUpperBound-double-int-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getRankUpperBound</h4> |
| <pre>public double getRankUpperBound(double rank, |
| int numStdDev)</pre> |
| <div class="block">Returns an approximate upper bound rank of the given rank.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>rank</code> - the given rank, a value between 0 and 1.0.</dd> |
| <dd><code>numStdDev</code> - the number of standard deviations. Must be 1, 2, or 3.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an approximate upper bound rank.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getRetainedItems--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getRetainedItems</h4> |
| <pre>public int getRetainedItems()</pre> |
| <div class="block">Gets the number of retained items of this sketch</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the number of retained entries of this sketch</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getRSE-int-double-boolean-long-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getRSE</h4> |
| <pre>public double getRSE(int k, |
| double rank, |
| boolean hra, |
| long totalN)</pre> |
| <div class="block">Returns an a priori estimate of relative standard error (RSE, expressed as a number in [0,1]). |
| Derived from Lemma 12 in https://arxiv.org/abs/2004.01668v2, but the constant factors were |
| modified based on empirical measurements.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>k</code> - the given value of k</dd> |
| <dd><code>rank</code> - the given normalized rank, a number in [0,1].</dd> |
| <dd><code>hra</code> - if true High Rank Accuracy mode is being selected, otherwise, Low Rank Accuracy.</dd> |
| <dd><code>totalN</code> - an estimate of the total number of items submitted to the sketch.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an a priori estimate of relative standard error (RSE, expressed as a number in [0,1]).</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getSerializationBytes--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getSerializationBytes</h4> |
| <pre>public int getSerializationBytes()</pre> |
| <div class="block">Gets the number of bytes when serialized.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the number of bytes when serialized.</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">Returns true if this sketch is empty.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>empty flag</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isEstimationMode--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isEstimationMode</h4> |
| <pre>public boolean isEstimationMode()</pre> |
| <div class="block">Returns true if this sketch is in estimation mode.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>estimation mode flag</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="isLessThanOrEqual--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isLessThanOrEqual</h4> |
| <pre>public boolean isLessThanOrEqual()</pre> |
| <div class="block">Returns the current comparison criterion. If true the value comparison criterion is |
| ≤, otherwise it will be the default, which is <.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the current comparison criterion</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="iterator--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>iterator</h4> |
| <pre>public <a href="../../../../org/apache/datasketches/req/ReqIterator.html" title="class in org.apache.datasketches.req">ReqIterator</a> iterator()</pre> |
| <div class="block">Returns an iterator for all the items in this sketch.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>an iterator for all the items in this sketch.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="merge-org.apache.datasketches.req.ReqSketch-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>merge</h4> |
| <pre>public <a href="../../../../org/apache/datasketches/req/ReqSketch.html" title="class in org.apache.datasketches.req">ReqSketch</a> merge(<a href="../../../../org/apache/datasketches/req/ReqSketch.html" title="class in org.apache.datasketches.req">ReqSketch</a> other)</pre> |
| <div class="block">Merge other sketch into this one. The other sketch is not modified.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>other</code> - sketch to be merged into this one.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="reset--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>reset</h4> |
| <pre>public <a href="../../../../org/apache/datasketches/req/ReqSketch.html" title="class in org.apache.datasketches.req">ReqSketch</a> reset()</pre> |
| <div class="block">Resets this sketch by removing all data and setting all data related variables to their |
| virgin state. |
| The parameters k, highRankAccuracy, reqDebug and LessThanOrEqual will not change.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="setLessThanOrEqual-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setLessThanOrEqual</h4> |
| <pre>public <a href="../../../../org/apache/datasketches/req/ReqSketch.html" title="class in org.apache.datasketches.req">ReqSketch</a> setLessThanOrEqual(boolean ltEq)</pre> |
| <div class="block">Sets the chosen criterion for value comparison</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>ltEq</code> - (Less-than-or Equals) If true, the sketch will use the ≤ criterion for comparing |
| values. Otherwise, the criterion is strictly <, the default. |
| This can be set anytime prior to a <i>getRank(float)</i> or <i>getQuantile(double)</i> or |
| equivalent query.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>this</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="toByteArray--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>toByteArray</h4> |
| <pre>public byte[] toByteArray()</pre> |
| <div class="block">Returns a byte array representation of this sketch.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a byte array representation of this sketch.</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">Returns a summary of the key parameters of the sketch.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a summary of the key parameters of the sketch.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="update-float-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>update</h4> |
| <pre>public void update(float item)</pre> |
| <div class="block">Updates this sketch with the given item.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>item</code> - the given item</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="viewCompactorDetail-java.lang.String-boolean-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>viewCompactorDetail</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> viewCompactorDetail(<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> fmt, |
| boolean allData)</pre> |
| <div class="block">A detailed, human readable view of the sketch compactors and their data. |
| Each compactor string is prepended by the compactor lgWeight, the current number of retained |
| items of the compactor and the current nominal capacity of the compactor.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>fmt</code> - the format string for the data items; example: "%4.0f".</dd> |
| <dd><code>allData</code> - all the retained items for the sketch will be output by |
| compactory level. Otherwise, just a summary will be output.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>a detailed view of the compactors and their data</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/ReqSketch.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/req/ReqIterator.html" title="class in org.apache.datasketches.req"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/datasketches/req/ReqSketchBuilder.html" title="class in org.apache.datasketches.req"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/datasketches/req/ReqSketch.html" target="_top">Frames</a></li> |
| <li><a href="ReqSketch.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>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </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> |