blob: 5a5f5cef5ff73bd7c5aa8fd89965f881e7782c5b [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>ItemsSketch (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="ItemsSketch (com.yahoo.datasketches:sketches-core 0.12.1-SNAPSHOT API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":9,"i3":9,"i4":9,"i5":10,"i6":9,"i7":10,"i8":10,"i9":10,"i10":42,"i11":10,"i12":41,"i13":9,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10,"i27":10,"i28":10,"i29":10,"i30":10,"i31":10,"i32":10};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"],32:["t6","Deprecated 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/ItemsSketch.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/quantiles/DoublesUnionBuilder.html" title="class in com.yahoo.sketches.quantiles"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketchIterator.html" title="class in com.yahoo.sketches.quantiles"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/yahoo/sketches/quantiles/ItemsSketch.html" target="_top">Frames</a></li>
<li><a href="ItemsSketch.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><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&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.quantiles</div>
<h2 title="Class ItemsSketch" class="title">Class ItemsSketch&lt;T&gt;</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.quantiles.ItemsSketch&lt;T&gt;</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - type of item</dd>
</dl>
<hr>
<br>
<pre>public final class <span class="typeNameLabel">ItemsSketch&lt;T&gt;</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 stochastic streaming sketch that enables near-real time analysis of the
approximate distribution of comparable items from a very large stream in a single pass.
The analysis is obtained using a getQuantiles(*) function or its inverse functions the
Probability Mass Function from getPMF(*) and the Cumulative Distribution Function from getCDF(*).
<p>The documentation for <a href="../../../../com/yahoo/sketches/quantiles/DoublesSketch.html" title="class in com.yahoo.sketches.quantiles"><code>DoublesSketch</code></a> applies here except that the size of an ItemsSketch
is very dependent on the Items input into the sketch, so there is no comparable size table as
for the DoublesSketch.
<p>There is more documentation available on
<a href="https://datasketches.github.io">DataSketches.GitHub.io</a>.</p></div>
<dl>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd>Kevin Lang, Alexander Saydakov</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">&nbsp;</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 <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Random.html?is-external=true" title="class or interface in java.util">Random</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#rand">rand</a></span></code>
<div class="block">Setting the seed makes the results of the sketch deterministic if the input values are
received in exactly the same order.</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><span id="t6" class="tableTab"><span><a href="javascript:show(32);">Deprecated 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><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="class in com.yahoo.sketches.quantiles">ItemsSketch</a>&lt;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#downSample-int-">downSample</a></span>(int&nbsp;newK)</code>
<div class="block">From an existing sketch, this creates a new sketch that can have a smaller value of K.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>double[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getCDF-T:A-">getCDF</a></span>(<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>[]&nbsp;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 splitPoints (values).</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="class in com.yahoo.sketches.quantiles">ItemsSketch</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getInstance-java.util.Comparator-">getInstance</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;? super T&gt;&nbsp;comparator)</code>
<div class="block">Obtains a new instance of an ItemsSketch using the DEFAULT_K.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="class in com.yahoo.sketches.quantiles">ItemsSketch</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getInstance-int-java.util.Comparator-">getInstance</a></span>(int&nbsp;k,
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;? super T&gt;&nbsp;comparator)</code>
<div class="block">Obtains a new instance of an ItemsSketch.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="class in com.yahoo.sketches.quantiles">ItemsSketch</a>&lt;T&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getInstance-com.yahoo.memory.Memory-java.util.Comparator-com.yahoo.sketches.ArrayOfItemsSerDe-">getInstance</a></span>(com.yahoo.memory.Memory&nbsp;srcMem,
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;? super T&gt;&nbsp;comparator,
<a href="../../../../com/yahoo/sketches/ArrayOfItemsSerDe.html" title="class in com.yahoo.sketches">ArrayOfItemsSerDe</a>&lt;T&gt;&nbsp;serDe)</code>
<div class="block">Heapifies the given srcMem, which must be a Memory image of a ItemsSketch</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getK--">getK</a></span>()</code>
<div class="block">Returns the configured value of K</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getKFromEpsilon-double-boolean-">getKFromEpsilon</a></span>(double&nbsp;epsilon,
boolean&nbsp;pmf)</code>
<div class="block">Gets the approximate value of <em>k</em> to use given epsilon, the normalized rank error.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getMaxValue--">getMaxValue</a></span>()</code>
<div class="block">Returns the max value of the stream</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getMinValue--">getMinValue</a></span>()</code>
<div class="block">Returns the min value of the stream</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getN--">getN</a></span>()</code>
<div class="block">Returns the length of the input stream so far.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getNormalizedRankError--">getNormalizedRankError</a></span>()</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">replaced by <a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getNormalizedRankError-boolean-"><code>getNormalizedRankError(boolean)</code></a></span></div>
</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getNormalizedRankError-boolean-">getNormalizedRankError</a></span>(boolean&nbsp;pmf)</code>
<div class="block">Gets the approximate rank error of this sketch normalized as a fraction between zero and one.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getNormalizedRankError-int-">getNormalizedRankError</a></span>(int&nbsp;k)</code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">replaced by <a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getNormalizedRankError-int-boolean-"><code>getNormalizedRankError(int, boolean)</code></a></span></div>
</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getNormalizedRankError-int-boolean-">getNormalizedRankError</a></span>(int&nbsp;k,
boolean&nbsp;pmf)</code>
<div class="block">Gets the normalized rank error given k and pmf.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>double[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getPMF-T:A-">getPMF</a></span>(<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>[]&nbsp;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="i15" class="rowColor">
<td class="colFirst"><code><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getQuantile-double-">getQuantile</a></span>(double&nbsp;fraction)</code>
<div class="block">This returns an approximation to the value of the data item
that would be preceded by the given fraction of a hypothetical sorted
version of the input stream so far.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getQuantileLowerBound-double-">getQuantileLowerBound</a></span>(double&nbsp;fraction)</code>
<div class="block">Gets the lower bound of the value interval in which the true quantile of the given rank
exists with a confidence of at least 99%.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getQuantiles-double:A-">getQuantiles</a></span>(double[]&nbsp;fractions)</code>
<div class="block">This is a more efficient multiple-query version of getQuantile().</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getQuantiles-int-">getQuantiles</a></span>(int&nbsp;evenlySpaced)</code>
<div class="block">This is also a more efficient multiple-query version of getQuantile() and allows the caller to
specify the number of evenly spaced fractional ranks.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getQuantileUpperBound-double-">getQuantileUpperBound</a></span>(double&nbsp;fraction)</code>
<div class="block">Gets the upper bound of the value interval in which the true quantile of the given rank
exists with a confidence of at least 99%.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getRank-T-">getRank</a></span>(<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&nbsp;value)</code>
<div class="block">Returns an approximation to the normalized (fractional) rank of the given value from 0 to 1
inclusive.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getRetainedItems--">getRetainedItems</a></span>()</code>
<div class="block">Computes the number of retained entries (samples) in the sketch</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#isDirect--">isDirect</a></span>()</code>&nbsp;</td>
</tr>
<tr id="i23" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#isEmpty--">isEmpty</a></span>()</code>
<div class="block">Returns true if this sketch is empty</div>
</td>
</tr>
<tr id="i24" class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#isEstimationMode--">isEstimationMode</a></span>()</code>&nbsp;</td>
</tr>
<tr id="i25" class="rowColor">
<td class="colFirst"><code><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketchIterator.html" title="class in com.yahoo.sketches.quantiles">ItemsSketchIterator</a>&lt;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#iterator--">iterator</a></span>()</code>&nbsp;</td>
</tr>
<tr id="i26" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#putMemory-com.yahoo.memory.WritableMemory-com.yahoo.sketches.ArrayOfItemsSerDe-">putMemory</a></span>(com.yahoo.memory.WritableMemory&nbsp;dstMem,
<a href="../../../../com/yahoo/sketches/ArrayOfItemsSerDe.html" title="class in com.yahoo.sketches">ArrayOfItemsSerDe</a>&lt;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&gt;&nbsp;serDe)</code>
<div class="block">Puts the current sketch into the given Memory if there is sufficient space.</div>
</td>
</tr>
<tr id="i27" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#reset--">reset</a></span>()</code>
<div class="block">Resets this sketch to a virgin state, but retains the original value of k.</div>
</td>
</tr>
<tr id="i28" class="altColor">
<td class="colFirst"><code>byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#toByteArray-com.yahoo.sketches.ArrayOfItemsSerDe-">toByteArray</a></span>(<a href="../../../../com/yahoo/sketches/ArrayOfItemsSerDe.html" title="class in com.yahoo.sketches">ArrayOfItemsSerDe</a>&lt;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&gt;&nbsp;serDe)</code>
<div class="block">Serialize this sketch to a byte array form.</div>
</td>
</tr>
<tr id="i29" class="rowColor">
<td class="colFirst"><code>byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#toByteArray-boolean-com.yahoo.sketches.ArrayOfItemsSerDe-">toByteArray</a></span>(boolean&nbsp;ordered,
<a href="../../../../com/yahoo/sketches/ArrayOfItemsSerDe.html" title="class in com.yahoo.sketches">ArrayOfItemsSerDe</a>&lt;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&gt;&nbsp;serDe)</code>
<div class="block">Serialize this sketch to a byte array form.</div>
</td>
</tr>
<tr id="i30" 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/quantiles/ItemsSketch.html#toString--">toString</a></span>()</code>
<div class="block">Returns summary information about this sketch.</div>
</td>
</tr>
<tr id="i31" 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/quantiles/ItemsSketch.html#toString-boolean-boolean-">toString</a></span>(boolean&nbsp;sketchSummary,
boolean&nbsp;dataDetail)</code>
<div class="block">Returns summary information about this sketch.</div>
</td>
</tr>
<tr id="i32" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#update-T-">update</a></span>(<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&nbsp;dataItem)</code>
<div class="block">Updates this sketch with the given double data 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">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="rand">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>rand</h4>
<pre>public static final&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Random.html?is-external=true" title="class or interface in java.util">Random</a> rand</pre>
<div class="block">Setting the seed makes the results of the sketch deterministic if the input values are
received in exactly the same order. This is only useful when performing test comparisons,
otherwise is not recommended.</div>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getInstance-java.util.Comparator-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getInstance</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="class in com.yahoo.sketches.quantiles">ItemsSketch</a>&lt;T&gt;&nbsp;getInstance(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;? super T&gt;&nbsp;comparator)</pre>
<div class="block">Obtains a new instance of an ItemsSketch using the DEFAULT_K.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - type of item</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>comparator</code> - to compare items</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a GenericQuantileSketch</dd>
</dl>
</li>
</ul>
<a name="getInstance-int-java.util.Comparator-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getInstance</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="class in com.yahoo.sketches.quantiles">ItemsSketch</a>&lt;T&gt;&nbsp;getInstance(int&nbsp;k,
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;? super T&gt;&nbsp;comparator)</pre>
<div class="block">Obtains a new instance of an ItemsSketch.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - type of item</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>k</code> - Parameter that controls space usage of sketch and accuracy of estimates.
Must be greater than 2 and less than 65536 and a power of 2.</dd>
<dd><code>comparator</code> - to compare items</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a GenericQuantileSketch</dd>
</dl>
</li>
</ul>
<a name="getInstance-com.yahoo.memory.Memory-java.util.Comparator-com.yahoo.sketches.ArrayOfItemsSerDe-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getInstance</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="class in com.yahoo.sketches.quantiles">ItemsSketch</a>&lt;T&gt;&nbsp;getInstance(com.yahoo.memory.Memory&nbsp;srcMem,
<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</a>&lt;? super T&gt;&nbsp;comparator,
<a href="../../../../com/yahoo/sketches/ArrayOfItemsSerDe.html" title="class in com.yahoo.sketches">ArrayOfItemsSerDe</a>&lt;T&gt;&nbsp;serDe)</pre>
<div class="block">Heapifies the given srcMem, which must be a Memory image of a ItemsSketch</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - type of item</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>srcMem</code> - a Memory image of a sketch.
<a href="../../../../resources/dictionary.html#mem">See Memory</a></dd>
<dd><code>comparator</code> - to compare items</dd>
<dd><code>serDe</code> - an instance of ArrayOfItemsSerDe</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a ItemsSketch on the Java heap.</dd>
</dl>
</li>
</ul>
<a name="update-java.lang.Object-">
<!-- -->
</a><a name="update-T-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>update</h4>
<pre>public&nbsp;void&nbsp;update(<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&nbsp;dataItem)</pre>
<div class="block">Updates this sketch with the given double data item</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>dataItem</code> - an item from a stream of items. NaNs are ignored.</dd>
</dl>
</li>
</ul>
<a name="getQuantile-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getQuantile</h4>
<pre>public&nbsp;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&nbsp;getQuantile(double&nbsp;fraction)</pre>
<div class="block">This returns an approximation to the value of the data item
that would be preceded by the given fraction of a hypothetical sorted
version of the input stream so far.
<p>We note that this method has a fairly large overhead (microseconds instead of nanoseconds)
so it should not be called multiple times to get different quantiles from the same
sketch. Instead use getQuantiles(). which pays the overhead only once.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>fraction</code> - the specified fractional position in the hypothetical sorted stream.
These are also called normalized ranks or fractional ranks.
If fraction = 0.0, the true minimum value of the stream is returned.
If fraction = 1.0, the true maximum value of the stream is returned.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the approximation to the value at the above fraction</dd>
</dl>
</li>
</ul>
<a name="getQuantileUpperBound-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getQuantileUpperBound</h4>
<pre>public&nbsp;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&nbsp;getQuantileUpperBound(double&nbsp;fraction)</pre>
<div class="block">Gets the upper bound of the value interval in which the true quantile of the given rank
exists with a confidence of at least 99%.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>fraction</code> - the given normalized rank as a fraction</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the upper bound of the value interval in which the true quantile of the given rank
exists with a confidence of at least 99%. Returns NaN if the sketch is empty.</dd>
</dl>
</li>
</ul>
<a name="getQuantileLowerBound-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getQuantileLowerBound</h4>
<pre>public&nbsp;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&nbsp;getQuantileLowerBound(double&nbsp;fraction)</pre>
<div class="block">Gets the lower bound of the value interval in which the true quantile of the given rank
exists with a confidence of at least 99%.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>fraction</code> - the given normalized rank as a fraction</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the lower bound of the value interval in which the true quantile of the given rank
exists with a confidence of at least 99%. Returns NaN if the sketch is empty.</dd>
</dl>
</li>
</ul>
<a name="getQuantiles-double:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getQuantiles</h4>
<pre>public&nbsp;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>[]&nbsp;getQuantiles(double[]&nbsp;fractions)</pre>
<div class="block">This is a more efficient multiple-query version of getQuantile().
<p>This returns an array that could have been generated by using getQuantile() with many different
fractional ranks, but would be very inefficient.
This method incurs the internal set-up overhead once and obtains multiple quantile values in
a single query. It is strongly recommend that this method be used instead of multiple calls
to getQuantile().</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>fractions</code> - given array of fractional positions in the hypothetical sorted stream.
These are also called normalized ranks or fractional ranks.
These fractions must be monotonic, in increasing order and in the interval
[0.0, 1.0] inclusive.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>array of approximations to the given fractions in the same order as given fractions
array. Returns null if sketch is empty</dd>
</dl>
</li>
</ul>
<a name="getQuantiles-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getQuantiles</h4>
<pre>public&nbsp;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>[]&nbsp;getQuantiles(int&nbsp;evenlySpaced)</pre>
<div class="block">This is also a more efficient multiple-query version of getQuantile() and allows the caller to
specify the number of evenly spaced fractional ranks.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>evenlySpaced</code> - an integer that specifies the number of evenly spaced fractional ranks.
This must be a positive integer greater than 0. A value of 1 will return the min value.
A value of 2 will return the min and the max value. A value of 3 will return the min,
the median and the max value, etc.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>array of approximations to the given fractions in the same order as given fractions
array.</dd>
</dl>
</li>
</ul>
<a name="getRank-java.lang.Object-">
<!-- -->
</a><a name="getRank-T-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRank</h4>
<pre>public&nbsp;double&nbsp;getRank(<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&nbsp;value)</pre>
<div class="block">Returns an approximation to the normalized (fractional) rank of the given value from 0 to 1
inclusive.
<p>The resulting approximation has a probabilistic guarantee that be obtained from the
getNormalizedRankError(false) function.
<p>If the sketch is empty this returns NaN.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>value</code> - to be ranked</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an approximate rank of the given value</dd>
</dl>
</li>
</ul>
<a name="getPMF-java.lang.Object:A-">
<!-- -->
</a><a name="getPMF-T:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPMF</h4>
<pre>public&nbsp;double[]&nbsp;getPMF(<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>[]&nbsp;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 from the
getNormalizedRankError(true) 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 item values
that divide the ordered space 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="getCDF-java.lang.Object:A-">
<!-- -->
</a><a name="getCDF-T:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCDF</h4>
<pre>public&nbsp;double[]&nbsp;getCDF(<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>[]&nbsp;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 splitPoints (values).
<p>The resulting approximations have a probabilistic guarantee that be obtained from the
getNormalizedRankError(false) 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 item values
that divide the ordered space 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 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="getK--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getK</h4>
<pre>public&nbsp;int&nbsp;getK()</pre>
<div class="block">Returns the configured value of K</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the configured value of K</dd>
</dl>
</li>
</ul>
<a name="getMinValue--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMinValue</h4>
<pre>public&nbsp;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&nbsp;getMinValue()</pre>
<div class="block">Returns the min value of the stream</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the min value of the stream</dd>
</dl>
</li>
</ul>
<a name="getMaxValue--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getMaxValue</h4>
<pre>public&nbsp;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&nbsp;getMaxValue()</pre>
<div class="block">Returns the max value of the stream</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the max value of the stream</dd>
</dl>
</li>
</ul>
<a name="getN--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getN</h4>
<pre>public&nbsp;long&nbsp;getN()</pre>
<div class="block">Returns the length of the input stream so far.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the length of the input stream so far</dd>
</dl>
</li>
</ul>
<a name="getNormalizedRankError--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNormalizedRankError</h4>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
public&nbsp;double&nbsp;getNormalizedRankError()</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">replaced by <a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getNormalizedRankError-boolean-"><code>getNormalizedRankError(boolean)</code></a></span></div>
<div class="block">Get the rank error normalized as a fraction between zero and one.
The error of this sketch is specified as a fraction of the normalized rank of the hypothetical
sorted stream of items presented to the sketch.
<p>Suppose the sketch is presented with N values. The raw rank (0 to N-1) of an item
would be its index position in the sorted version of the input stream. If we divide the
raw rank by N, it becomes the normalized rank, which is between 0 and 1.0.
<p>For example, choosing a K of 227 yields a normalized rank error of about 1%.
The upper bound on the median value obtained by getQuantile(0.5) would be the value in the
hypothetical ordered stream of values at the normalized rank of 0.51.
The lower bound would be the value in the hypothetical ordered stream of values at the
normalized rank of 0.49.
<p>The error of this sketch cannot be translated into an error (relative or absolute) of the
returned quantile values.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the rank error normalized as a fraction between zero and one.</dd>
</dl>
</li>
</ul>
<a name="getNormalizedRankError-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNormalizedRankError</h4>
<pre>public&nbsp;double&nbsp;getNormalizedRankError(boolean&nbsp;pmf)</pre>
<div class="block">Gets the approximate rank error of this sketch normalized as a fraction between zero and one.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>pmf</code> - if true, returns the "double-sided" normalized rank error for the getPMF() function.
Otherwise, it is the "single-sided" normalized rank error for all the other queries.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>if pmf is true, returns the normalized rank error for the getPMF() function.
Otherwise, it is the "single-sided" normalized rank error for all the other queries.</dd>
</dl>
</li>
</ul>
<a name="getNormalizedRankError-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNormalizedRankError</h4>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html?is-external=true" title="class or interface in java.lang">@Deprecated</a>
public static&nbsp;double&nbsp;getNormalizedRankError(int&nbsp;k)</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">replaced by <a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getNormalizedRankError-int-boolean-"><code>getNormalizedRankError(int, boolean)</code></a></span></div>
<div class="block">Static method version of <a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getNormalizedRankError--"><code>getNormalizedRankError()</code></a></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>k</code> - the configuration parameter of a ItemsSketch</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the rank error normalized as a fraction between zero and one.</dd>
</dl>
</li>
</ul>
<a name="getNormalizedRankError-int-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNormalizedRankError</h4>
<pre>public static&nbsp;double&nbsp;getNormalizedRankError(int&nbsp;k,
boolean&nbsp;pmf)</pre>
<div class="block">Gets the normalized rank error given k and pmf.
Static method version of the <a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html#getNormalizedRankError-boolean-"><code>getNormalizedRankError(boolean)</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>k</code> - the configuation parameter</dd>
<dd><code>pmf</code> - if true, returns the "double-sided" normalized rank error for the getPMF() function.
Otherwise, it is the "single-sided" normalized rank error for all the other queries.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>if pmf is true, the normalized rank error for the getPMF() function.
Otherwise, it is the "single-sided" normalized rank error for all the other queries.</dd>
</dl>
</li>
</ul>
<a name="getKFromEpsilon-double-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getKFromEpsilon</h4>
<pre>public static&nbsp;int&nbsp;getKFromEpsilon(double&nbsp;epsilon,
boolean&nbsp;pmf)</pre>
<div class="block">Gets the approximate value of <em>k</em> to use given epsilon, the normalized rank error.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>epsilon</code> - the normalized rank error between zero and one.</dd>
<dd><code>pmf</code> - if true, this function returns the value of <em>k</em> assuming the input epsilon
is the desired "double-sided" epsilon for the getPMF() function. Otherwise, this function
returns the value of <em>k</em> assuming the input epsilon is the desired "single-sided"
epsilon for all the other queries.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the value of <i>k</i> given a value of epsilon.</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">Returns 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="isDirect--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isDirect</h4>
<pre>public&nbsp;boolean&nbsp;isDirect()</pre>
</li>
</ul>
<a name="isEstimationMode--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isEstimationMode</h4>
<pre>public&nbsp;boolean&nbsp;isEstimationMode()</pre>
</li>
</ul>
<a name="reset--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>reset</h4>
<pre>public&nbsp;void&nbsp;reset()</pre>
<div class="block">Resets this sketch to a virgin state, but retains the original value of k.</div>
</li>
</ul>
<a name="toByteArray-com.yahoo.sketches.ArrayOfItemsSerDe-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toByteArray</h4>
<pre>public&nbsp;byte[]&nbsp;toByteArray(<a href="../../../../com/yahoo/sketches/ArrayOfItemsSerDe.html" title="class in com.yahoo.sketches">ArrayOfItemsSerDe</a>&lt;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&gt;&nbsp;serDe)</pre>
<div class="block">Serialize this sketch to a byte array form.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>serDe</code> - an instance of ArrayOfItemsSerDe</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>byte array of this sketch</dd>
</dl>
</li>
</ul>
<a name="toByteArray-boolean-com.yahoo.sketches.ArrayOfItemsSerDe-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toByteArray</h4>
<pre>public&nbsp;byte[]&nbsp;toByteArray(boolean&nbsp;ordered,
<a href="../../../../com/yahoo/sketches/ArrayOfItemsSerDe.html" title="class in com.yahoo.sketches">ArrayOfItemsSerDe</a>&lt;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&gt;&nbsp;serDe)</pre>
<div class="block">Serialize this sketch to a byte array form.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>ordered</code> - if true the base buffer will be ordered (default == false).</dd>
<dd><code>serDe</code> - an instance of ArrayOfItemsSerDe</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>this sketch in a byte array form.</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>
<div class="block">Returns summary information about 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>&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-boolean-">
<!-- -->
</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(boolean&nbsp;sketchSummary,
boolean&nbsp;dataDetail)</pre>
<div class="block">Returns summary information about this sketch. Used for debugging.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>sketchSummary</code> - if true includes sketch summary</dd>
<dd><code>dataDetail</code> - if true includes data detail</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>summary information about the sketch.</dd>
</dl>
</li>
</ul>
<a name="downSample-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>downSample</h4>
<pre>public&nbsp;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="class in com.yahoo.sketches.quantiles">ItemsSketch</a>&lt;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&gt;&nbsp;downSample(int&nbsp;newK)</pre>
<div class="block">From an existing sketch, this creates a new sketch that can have a smaller value of K.
The original sketch is not modified.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>newK</code> - the new value of K that must be smaller than current value of K.
It is required that this.getK() = newK * 2^(nonnegative integer).</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new sketch.</dd>
</dl>
</li>
</ul>
<a name="getRetainedItems--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRetainedItems</h4>
<pre>public&nbsp;int&nbsp;getRetainedItems()</pre>
<div class="block">Computes the number of retained entries (samples) in the sketch</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the number of retained entries (samples) in the sketch</dd>
</dl>
</li>
</ul>
<a name="putMemory-com.yahoo.memory.WritableMemory-com.yahoo.sketches.ArrayOfItemsSerDe-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>putMemory</h4>
<pre>public&nbsp;void&nbsp;putMemory(com.yahoo.memory.WritableMemory&nbsp;dstMem,
<a href="../../../../com/yahoo/sketches/ArrayOfItemsSerDe.html" title="class in com.yahoo.sketches">ArrayOfItemsSerDe</a>&lt;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&gt;&nbsp;serDe)</pre>
<div class="block">Puts the current sketch into the given Memory if there is sufficient space.
Otherwise, throws an error.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>dstMem</code> - the given memory.</dd>
<dd><code>serDe</code> - an instance of ArrayOfItemsSerDe</dd>
</dl>
</li>
</ul>
<a name="iterator--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>iterator</h4>
<pre>public&nbsp;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketchIterator.html" title="class in com.yahoo.sketches.quantiles">ItemsSketchIterator</a>&lt;<a href="../../../../com/yahoo/sketches/quantiles/ItemsSketch.html" title="type parameter in ItemsSketch">T</a>&gt;&nbsp;iterator()</pre>
</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/ItemsSketch.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/quantiles/DoublesUnionBuilder.html" title="class in com.yahoo.sketches.quantiles"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../com/yahoo/sketches/quantiles/ItemsSketchIterator.html" title="class in com.yahoo.sketches.quantiles"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/yahoo/sketches/quantiles/ItemsSketch.html" target="_top">Frames</a></li>
<li><a href="ItemsSketch.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><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&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>