blob: 6dacc5c44525860d2de0cdfe629478b5ecbc8fb6 [file]
<!DOCTYPE HTML>
<html lang>
<head>
<!-- Generated by javadoc (25) -->
<title>QuantilesAPI (datasketches-java 9.0.1-SNAPSHOT API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="declaration: package: org.apache.datasketches.quantilescommon, interface: QuantilesAPI">
<meta name="generator" content="javadoc/ClassWriter">
<link rel="stylesheet" type="text/css" href="../../../../resource-files/jquery-ui.min.css">
<link rel="stylesheet" type="text/css" href="../../../../resource-files/stylesheet.css">
<script type="text/javascript" src="../../../../script-files/script.js"></script>
<script type="text/javascript" src="../../../../script-files/jquery-3.7.1.min.js"></script>
<script type="text/javascript" src="../../../../script-files/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">const pathtoroot = "../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="nav-content">
<div class="nav-menu-button"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span></button></div>
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../index.html">Overview</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="class-use/QuantilesAPI.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="../../../../search.html">Search</a></li>
<li><a href="../../../../help-doc.html#class">Help</a></li>
</ul>
</div>
</div>
<div class="sub-nav">
<div class="nav-content">
<ol class="sub-nav-list">
<li><a href="package-summary.html">org.apache.datasketches.quantilescommon</a></li>
<li><a href="QuantilesAPI.html" class="current-selection">QuantilesAPI</a></li>
</ol>
<div class="nav-list-search"><input type="text" id="search-input" disabled placeholder="Search documentation (type /)" aria-label="Search in documentation" autocomplete="off" spellcheck="false"><input type="reset" id="reset-search" disabled value="Reset"></div>
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="main-grid">
<nav role="navigation" class="toc" aria-label="Table of contents">
<div class="toc-header">Contents&nbsp;<input type="text" class="filter-input" disabled placeholder="Filter contents (type .)" aria-label="Filter table of contents" autocomplete="off" spellcheck="false"><input type="reset" class="reset-filter" disabled tabindex="-1" value="Reset"></div>
<ol class="toc-list" tabindex="-1">
<li><a href="#" tabindex="0">Description</a></li>
<li><a href="#field-summary" tabindex="0">Field Summary</a></li>
<li><a href="#method-summary" tabindex="0">Method Summary</a></li>
<li><a href="#field-detail" tabindex="0">Field Details</a>
<ol class="toc-list">
<li><a href="#EMPTY_MSG" tabindex="0">EMPTY_MSG</a></li>
<li><a href="#UNSUPPORTED_MSG" tabindex="0">UNSUPPORTED_MSG</a></li>
<li><a href="#NOT_SINGLE_ITEM_MSG" tabindex="0">NOT_SINGLE_ITEM_MSG</a></li>
<li><a href="#MEM_REQ_SVR_NULL_MSG" tabindex="0">MEM_REQ_SVR_NULL_MSG</a></li>
<li><a href="#TGT_IS_READ_ONLY_MSG" tabindex="0">TGT_IS_READ_ONLY_MSG</a></li>
<li><a href="#SELF_MERGE_MSG" tabindex="0">SELF_MERGE_MSG</a></li>
</ol>
</li>
<li><a href="#method-detail" tabindex="0">Method Details</a>
<ol class="toc-list">
<li><a href="#getK()" tabindex="0">getK()</a></li>
<li><a href="#getN()" tabindex="0">getN()</a></li>
<li><a href="#getNormalizedRankError(boolean)" tabindex="0">getNormalizedRankError(boolean)</a></li>
<li><a href="#getNumRetained()" tabindex="0">getNumRetained()</a></li>
<li><a href="#getRankLowerBound(double)" tabindex="0">getRankLowerBound(double)</a></li>
<li><a href="#getRankUpperBound(double)" tabindex="0">getRankUpperBound(double)</a></li>
<li><a href="#isEmpty()" tabindex="0">isEmpty()</a></li>
<li><a href="#isEstimationMode()" tabindex="0">isEstimationMode()</a></li>
<li><a href="#isReadOnly()" tabindex="0">isReadOnly()</a></li>
<li><a href="#reset()" tabindex="0">reset()</a></li>
<li><a href="#toString()" tabindex="0">toString()</a></li>
</ol>
</li>
</ol>
<button class="hide-sidebar"><span>Hide sidebar&nbsp;</span><img src="../../../../resource-files/left.svg" alt="Hide sidebar"></button><button class="show-sidebar"><img src="../../../../resource-files/right.svg" alt="Show sidebar"><span>&nbsp;Show sidebar</span></button></nav>
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<h1 title="Interface QuantilesAPI" class="title">Interface QuantilesAPI</h1>
</div>
<section class="class-description" id="class-description">
<dl class="notes">
<dt>All Known Subinterfaces:</dt>
<dd><code><a href="QuantilesDoublesAPI.html" title="interface in org.apache.datasketches.quantilescommon">QuantilesDoublesAPI</a>, <a href="QuantilesFloatsAPI.html" title="interface in org.apache.datasketches.quantilescommon">QuantilesFloatsAPI</a>, <a href="QuantilesGenericAPI.html" title="interface in org.apache.datasketches.quantilescommon">QuantilesGenericAPI</a>&lt;T&gt;, <a href="QuantilesLongsAPI.html" title="interface in org.apache.datasketches.quantilescommon">QuantilesLongsAPI</a></code></dd>
</dl>
<dl class="notes">
<dt>All Known Implementing Classes:</dt>
<dd><code><a href="../quantiles/CompactQuantilesDoublesSketch.html" title="class in org.apache.datasketches.quantiles">CompactQuantilesDoublesSketch</a>, <a href="../kll/KllDoublesSketch.html" title="class in org.apache.datasketches.kll">KllDoublesSketch</a>, <a href="../kll/KllFloatsSketch.html" title="class in org.apache.datasketches.kll">KllFloatsSketch</a>, <a href="../kll/KllItemsSketch.html" title="class in org.apache.datasketches.kll">KllItemsSketch</a>, <a href="../kll/KllLongsSketch.html" title="class in org.apache.datasketches.kll">KllLongsSketch</a>, <a href="../kll/KllSketch.html" title="class in org.apache.datasketches.kll">KllSketch</a>, <a href="../quantiles/QuantilesDoublesSketch.html" title="class in org.apache.datasketches.quantiles">QuantilesDoublesSketch</a>, <a href="../quantiles/QuantilesItemsSketch.html" title="class in org.apache.datasketches.quantiles">QuantilesItemsSketch</a>, <a href="../req/ReqSketch.html" title="class in org.apache.datasketches.req">ReqSketch</a>, <a href="../quantiles/UpdatableQuantilesDoublesSketch.html" title="class in org.apache.datasketches.quantiles">UpdatableQuantilesDoublesSketch</a></code></dd>
</dl>
<hr>
<div class="horizontal-scroll">
<div class="type-signature"><span class="modifiers">public interface </span><span class="element-name type-name-label">QuantilesAPI</span></div>
<div class="block">This is a stochastic streaming sketch that enables near-real time analysis of the
approximate distribution of items from a very large stream in a single pass, requiring only
that the items are comparable.
The analysis is obtained using the <i>getQuantile()</i> function or the
inverse functions getRank(), getPMF() (the Probability Mass Function), and getCDF()
(the Cumulative Distribution Function).
<p>Given an input stream of <i>N</i> items, the <i>natural rank</i> of any specific
item is defined as its index <i>(1 to N)</i> in the hypothetical sorted stream of all
<i>N</i> input items.</p>
<p>The <i>normalized rank</i> (<i>rank</i>) of any specific item is defined as its
<i>natural rank</i> divided by <i>N</i>, which is a number in the interval [0.0, 1.0].
In the Javadocs for all the quantile sketches <i>natural rank</i> is seldom used
so any reference to just <i>rank</i> should be interpreted as <i>normalized rank</i>.</p>
<p>Inputs into a quantile sketch are called "items" that can be either generic or specific
primitives, like <i>float</i> or <i>double</i> depending on the sketch implementation.
In order to keep its size small, sketches don't retain all the items offered and retain only
a small fraction of all the items, thus purging most of the items. The items retained are
then sorted and associated with a rank. At this point we call the retained items <i>quantiles</i>.
Thus, all quantiles are items, but only a few items become quantiles. Depending on the context
the two terms can be interchangeable.</p>
<p>All quantile sketches are configured with a parameter <i>k</i>, which affects the size of
the sketch and its estimation error.</p>
<p>In the research literature, the estimation error is commonly called <i>epsilon</i>
(or <i>eps</i>) and is a fraction between zero and one.
Larger sizes of <i>k</i> result in a smaller epsilon, but also a larger sketch.
The epsilon error is always with respect to the rank domain. Estimating the confidence interval
in the quantile domain can be done by first computing the error in the rank domain and then
translating that to the quantile domain. The sketch provides methods to assist with that.</p>
<p>The relationship between the normalized rank and the corresponding quantiles can be viewed
as a two dimensional monotonic plot with the normalized rank on one axis and the
corresponding quantiles on the other axis. Let <i>q := quantile</i> and <i>r := rank</i> then both
<i>q = getQuantile(r)</i> and <i>r = getRank(q)</i> are monotonically increasing functions.
If the y-axis is used for the rank domain and the x-axis for the quantile domain,
then <i>y = getRank(x)</i> is also the single point Cumulative Distribution Function (CDF).</p>
<p>The functions <i>getQuantile()</i> translate ranks into corresponding quantiles.
The functions <i>getRank(), getCDF(), and getPMF() (Probability Mass Function)</i>
perform the opposite operation and translate quantiles into ranks (or cumulative probabilities,
or probability masses, depending on the context).</p>
<p>As an example, consider a large stream of one million items such as packet sizes coming into a network node.
The absolute rank of any specific item size is simply its index in the hypothetical sorted
array of such items.
The normalized rank is the natural rank divided by the stream size, or <i>N</i>,
in this case one million.
The quantile corresponding to the normalized rank of 0.5 represents the 50th percentile or median
of the distribution, obtained from getQuantile(0.5). Similarly, the 95th percentile is obtained from
getQuantile(0.95).</p>
<p>From the min and max quantiles, for example, say 1 and 1000 bytes,
you can obtain the PMF from getPMF(100, 500, 900) that will result in an array of
4 probability masses such as {.4, .3, .2, .1}, which means that
<ul>
<li>40% of the mass was &lt; 100,</li>
<li>30% of the mass was &ge; 100 and &lt; 500,</li>
<li>20% of the mass was &ge; 500 and &lt; 900, and</li>
<li>10% of the mass was &ge; 900.</li>
</ul>
A frequency histogram can be obtained by simply multiplying these probability masses by getN(),
which is the total count of items received.
The <i>getCDF()</i> works similarly, but produces the cumulative distribution instead.
<p>The accuracy of this sketch is a function of the configured <i>k</i>, which also affects
the overall size of the sketch. Accuracy of this quantile sketch is always with respect to
the normalized rank.
<p>The <i>getPMF()</i> function has about 13 to 47% worse rank error (depending
on <i>k</i>) than the other queries because the mass of each "bin" of the PMF has
"double-sided" error from the upper and lower edges of the bin as a result of a subtraction
of random variables where the errors from the two edges can sometimes add.</p>
<p>A <i>getQuantile(rank)</i> query has the following probabilistic guarantees:</p>
<ul>
<li>Let <i>q = getQuantile(r)</i> where <i>r</i> is the rank between zero and one.</li>
<li>The quantile <i>q</i> will be a quantile from the input stream.</li>
<li>Let <i>trueRank</i> be the true rank of <i>q</i> derived from the hypothetical sorted
stream of all <i>N</i> quantiles.</li>
<li>Let <i>eps = getNormalizedRankError(false)</i>[*].</li>
<li>Then <i>r - eps &le; trueRank &le; r + eps</i>.
Note that the error is on the rank, not the quantile.</li>
</ul>
<p>A <i>getRank(quantile)</i> query has the following probabilistic guarantees:</p>
<ul>
<li>Let <i>r = getRank(q)</i> where <i>q</i> is a quantile between the min and max quantiles of
the input stream.</li>
<li>Let <i>trueRank</i> be the true rank of <i>q</i> derived from the hypothetical sorted
stream of all <i>N</i> quantiles.</li>
<li>Let <i>eps = getNormalizedRankError(false)</i>[*].</li>
<li>Then <i>r - eps &le; trueRank &le; r + eps</i>.</li>
</ul>
<p>A <i>getPMF()</i> query has the following probabilistic guarantees:</p>
<ul>
<li>Let <i>{r<sub>1</sub>, r<sub>2</sub>, ..., r<sub>m+1</sub>}
= getPMF(v<sub>1</sub>, v<sub>2</sub>, ..., v<sub>m</sub>)</i> where
<i>q<sub>1</sub>, q<sub>2</sub>, ..., q<sub>m</sub></i> are monotonically increasing quantiles
supplied by the user that are part of the monotonic sequence
<i>q<sub>0</sub> = min, q<sub>1</sub>, q<sub>2</sub>, ..., q<sub>m</sub>, q<sub>m+1</sub> = max</i>,
and where <i>min</i> and <i>max</i> are the actual minimum and maximum quantiles of the input
stream automatically included in the sequence by the <i>getPMF(...)</i> function.
<li>Let <i>r<sub>i</sub> = mass<sub>i</sub></i> = estimated mass between
<i>v<sub>i-1</sub></i> and <i>q<sub>i</sub></i> where <i>q<sub>0</sub> = min</i>
and <i>q<sub>m+1</sub> = max</i>.</li>
<li>Let <i>trueMass</i> be the true mass between the quantiles of <i>q<sub>i</sub>,
q<sub>i+1</sub></i> derived from the hypothetical sorted stream of all <i>N</i> quantiles.</li>
<li>Let <i>eps = getNormalizedRankError(true)</i>[*].</li>
<li>Then <i>mass - eps &le; trueMass &le; mass + eps</i>.</li>
<li><i>r<sub>1</sub></i> includes the mass of all points between <i>min = q<sub>0</sub></i> and
<i>q<sub>1</sub></i>.</li>
<li><i>r<sub>m+1</sub></i> includes the mass of all points between <i>q<sub>m</sub></i> and
<i>max = q<sub>m+1</sub></i>.</li>
</ul>
<p>A <i>getCDF(...)</i> query has the following probabilistic guarantees:</p>
<ul>
<li>Let <i>{r<sub>1</sub>, r<sub>2</sub>, ..., r<sub>m+1</sub>}
= getCDF(q<sub>1</sub>, q<sub>2</sub>, ..., q<sub>m</sub>)</i> where
<i>q<sub>1</sub>, q<sub>2</sub>, ..., q<sub>m</sub>)</i> are monotonically increasing quantiles
supplied by the user that are part of the monotonic sequence
<i>{q<sub>0</sub> = min, q<sub>1</sub>, q<sub>2</sub>, ..., q<sub>m</sub>, q<sub>m+1</sub> = max}</i>,
and where <i>min</i> and <i>max</i> are the actual minimum and maximum quantiles of the input
stream automatically included in the sequence by the <i>getCDF(...)</i> function.
<li>Let <i>r<sub>i</sub> = mass<sub>i</sub></i> = estimated mass between
<i>q<sub>0</sub> = min</i> and <i>q<sub>i</sub></i>.</li>
<li>Let <i>trueMass</i> be the true mass between the true ranks of <i>q<sub>i</sub>,
q<sub>i+1</sub></i> derived from the hypothetical sorted stream of all <i>N</i> quantiles.</li>
<li>Let <i>eps = getNormalizedRankError(true)</i>[*].</li>
<li>then <i>mass - eps &le; trueMass &le; mass + eps</i>.</li>
<li><i>r<sub>1</sub></i> includes the mass of all points between <i>min = q<sub>0</sub></i> and
<i>q<sub>1</sub></i>.</li>
<li><i>r<sub>m+1</sub></i> includes the mass of all points between <i>min = q<sub>0</sub></i> and
<i>max = q<sub>m+1</sub></i>.</li>
</ul>
<p>Because errors are independent, we can make some estimates of the size of the confidence bounds
for the <em>quantile</em> returned from a call to <em>getQuantile()</em>, but not error bounds.
These confidence bounds may be quite large for certain distributions.</p>
<ul>
<li>Let <i>q = getQuantile(r)</i>, the estimated quantile of rank <i>r</i>.</li>
<li>Let <i>eps = getNormalizedRankError(false)</i>[*].</li>
<li>Let <i>q<sub>lo</sub></i> = estimated quantile of rank <i>(r - eps)</i>.</li>
<li>Let <i>q<sub>hi</sub></i> = estimated quantile of rank <i>(r + eps)</i>.</li>
<li>Then <i>q<sub>lo</sub> &le; q &le; q<sub>hi</sub></i>.</li>
</ul>
<p>This sketch is order and distribution insensitive</p>
<p>This algorithm intentionally inserts randomness into the sampling process for items that
ultimately get retained in the sketch. Thus, the results produced by this algorithm are not
deterministic. For example, if the same stream is inserted into two different instances of this
sketch, the answers obtained from the two sketches should be close, but may not be be identical.</p>
<p>Similarly, there may be directional inconsistencies. For example, if a quantile obtained
from getQuantile(rank) is input into the reverse query
getRank(quantile), the resulting rank should be close, but may not exactly equal the original rank.</p>
<p>Please visit our website: <a href="https://datasketches.apache.org">DataSketches Home Page</a>
and specific Javadocs for more information.</p>
<p>[*] Note that obtaining epsilon may require using a similar function but with more parameters
based on the specific sketch implementation.</p></div>
<dl class="notes">
<dt>Author:</dt>
<dd>Lee Rhodes, Kevin Lang, Alexander Saydakov</dd>
<dt>See Also:</dt>
<dd>
<ul class="tag-list-long">
<li><a href="https://datasketches.apache.org/docs/QuantilesAll/SketchingQuantilesAndRanksTutorial.html">
Sketching Quantiles and Ranks, Tutorial</a></li>
<li><a href="QuantileSearchCriteria.html" title="enum class in org.apache.datasketches.quantilescommon"><code>QuantileSearchCriteria</code></a></li>
</ul>
</dd>
</dl>
</div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- =========== FIELD SUMMARY =========== -->
<li>
<section class="field-summary" id="field-summary">
<h2>Field Summary</h2>
<div class="caption"><span>Fields</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Field</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>static final <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second even-row-color"><code><a href="#EMPTY_MSG" class="member-name-link">EMPTY_MSG</a></code></div>
<div class="col-last even-row-color">
<div class="block">The sketch must not be empty for this operation.</div>
</div>
<div class="col-first odd-row-color"><code>static final <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second odd-row-color"><code><a href="#MEM_REQ_SVR_NULL_MSG" class="member-name-link">MEM_REQ_SVR_NULL_MSG</a></code></div>
<div class="col-last odd-row-color">
<div class="block">MemoryRequestServer must not be null.</div>
</div>
<div class="col-first even-row-color"><code>static final <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second even-row-color"><code><a href="#NOT_SINGLE_ITEM_MSG" class="member-name-link">NOT_SINGLE_ITEM_MSG</a></code></div>
<div class="col-last even-row-color">
<div class="block">Sketch does not have just one item.</div>
</div>
<div class="col-first odd-row-color"><code>static final <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second odd-row-color"><code><a href="#SELF_MERGE_MSG" class="member-name-link">SELF_MERGE_MSG</a></code></div>
<div class="col-last odd-row-color">
<div class="block">A sketch cannot merge with itself.</div>
</div>
<div class="col-first even-row-color"><code>static final <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second even-row-color"><code><a href="#TGT_IS_READ_ONLY_MSG" class="member-name-link">TGT_IS_READ_ONLY_MSG</a></code></div>
<div class="col-last even-row-color">
<div class="block">Target sketch is Read Only, cannot write.</div>
</div>
<div class="col-first odd-row-color"><code>static final <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second odd-row-color"><code><a href="#UNSUPPORTED_MSG" class="member-name-link">UNSUPPORTED_MSG</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Unsupported operation for this Sketch Type.</div>
</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab3" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab3', 3)" class="table-tab">Abstract Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel" aria-labelledby="method-summary-table-tab0">
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>int</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#getK()" class="member-name-link">getK</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Gets the user configured parameter k, which controls the accuracy of the sketch
and its memory space usage.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>long</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#getN()" class="member-name-link">getN</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Gets the length of the input stream offered to the sketch..</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#getNormalizedRankError(boolean)" class="member-name-link">getNormalizedRankError</a><wbr>(boolean&nbsp;pmf)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Gets the approximate rank error of this sketch normalized as a fraction between zero and one.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>int</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#getNumRetained()" class="member-name-link">getNumRetained</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Gets the number of quantiles retained by the sketch.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>double</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#getRankLowerBound(double)" class="member-name-link">getRankLowerBound</a><wbr>(double&nbsp;rank)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Gets the lower bound of the rank confidence interval in which the true rank of the
given rank exists.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>double</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#getRankUpperBound(double)" class="member-name-link">getRankUpperBound</a><wbr>(double&nbsp;rank)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Gets the upper bound of the rank confidence interval in which the true rank of the
given rank exists.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#isEmpty()" class="member-name-link">isEmpty</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Returns true if this sketch is empty.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#isEstimationMode()" class="member-name-link">isEstimationMode</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Returns true if this sketch is in estimation mode.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#isReadOnly()" class="member-name-link">isReadOnly</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Returns true if this sketch is read only.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#reset()" class="member-name-link">reset</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Resets this sketch to the empty state.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#toString()" class="member-name-link">toString</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Returns a summary of the key parameters of the sketch.</div>
</div>
</div>
</div>
</div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ FIELD DETAIL =========== -->
<li>
<section class="field-details" id="field-detail">
<h2>Field Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="EMPTY_MSG">
<h3>EMPTY_MSG</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">static final</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">EMPTY_MSG</span></div>
<div class="block">The sketch must not be empty for this operation.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="../../../../constant-values.html#org.apache.datasketches.quantilescommon.QuantilesAPI.EMPTY_MSG">Constant Field Values</a></li>
</ul>
</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="UNSUPPORTED_MSG">
<h3>UNSUPPORTED_MSG</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">static final</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">UNSUPPORTED_MSG</span></div>
<div class="block">Unsupported operation for this Sketch Type.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="../../../../constant-values.html#org.apache.datasketches.quantilescommon.QuantilesAPI.UNSUPPORTED_MSG">Constant Field Values</a></li>
</ul>
</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="NOT_SINGLE_ITEM_MSG">
<h3>NOT_SINGLE_ITEM_MSG</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">static final</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">NOT_SINGLE_ITEM_MSG</span></div>
<div class="block">Sketch does not have just one item.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="../../../../constant-values.html#org.apache.datasketches.quantilescommon.QuantilesAPI.NOT_SINGLE_ITEM_MSG">Constant Field Values</a></li>
</ul>
</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="MEM_REQ_SVR_NULL_MSG">
<h3>MEM_REQ_SVR_NULL_MSG</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">static final</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">MEM_REQ_SVR_NULL_MSG</span></div>
<div class="block">MemoryRequestServer must not be null.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="../../../../constant-values.html#org.apache.datasketches.quantilescommon.QuantilesAPI.MEM_REQ_SVR_NULL_MSG">Constant Field Values</a></li>
</ul>
</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="TGT_IS_READ_ONLY_MSG">
<h3>TGT_IS_READ_ONLY_MSG</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">static final</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">TGT_IS_READ_ONLY_MSG</span></div>
<div class="block">Target sketch is Read Only, cannot write.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="../../../../constant-values.html#org.apache.datasketches.quantilescommon.QuantilesAPI.TGT_IS_READ_ONLY_MSG">Constant Field Values</a></li>
</ul>
</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="SELF_MERGE_MSG">
<h3>SELF_MERGE_MSG</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">static final</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">SELF_MERGE_MSG</span></div>
<div class="block">A sketch cannot merge with itself.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="tag-list">
<li><a href="../../../../constant-values.html#org.apache.datasketches.quantilescommon.QuantilesAPI.SELF_MERGE_MSG">Constant Field Values</a></li>
</ul>
</dd>
</dl>
</div>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="getK()">
<h3>getK</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="return-type">int</span>&nbsp;<span class="element-name">getK</span>()</div>
<div class="block">Gets the user configured parameter k, which controls the accuracy of the sketch
and its memory space usage.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the user configured parameter k, which controls the accuracy of the sketch
and its memory space usage.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getN()">
<h3>getN</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="return-type">long</span>&nbsp;<span class="element-name">getN</span>()</div>
<div class="block">Gets the length of the input stream offered to the sketch..</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the length of the input stream offered to the sketch.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getNormalizedRankError(boolean)">
<h3>getNormalizedRankError</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="return-type">double</span>&nbsp;<span class="element-name">getNormalizedRankError</span><wbr><span class="parameters">(boolean&nbsp;pmf)</span></div>
<div class="block">Gets the approximate rank error of this sketch normalized as a fraction between zero and one.
The epsilon returned is a best fit to 99 percent confidence empirically measured max error
in thousands of trials.</div>
<dl class="notes">
<dt>Parameters:</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>Returns:</dt>
<dd>if pmf is 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>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getNumRetained()">
<h3>getNumRetained</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="return-type">int</span>&nbsp;<span class="element-name">getNumRetained</span>()</div>
<div class="block">Gets the number of quantiles retained by the sketch.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>the number of quantiles retained by the sketch</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getRankLowerBound(double)">
<h3>getRankLowerBound</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="return-type">double</span>&nbsp;<span class="element-name">getRankLowerBound</span><wbr><span class="parameters">(double&nbsp;rank)</span></div>
<div class="block">Gets the lower bound of the rank confidence interval in which the true rank of the
given rank exists.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>rank</code> - the given normalized rank.</dd>
<dt>Returns:</dt>
<dd>the lower bound of the rank confidence interval in which the true rank of the
given rank exists.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="getRankUpperBound(double)">
<h3>getRankUpperBound</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="return-type">double</span>&nbsp;<span class="element-name">getRankUpperBound</span><wbr><span class="parameters">(double&nbsp;rank)</span></div>
<div class="block">Gets the upper bound of the rank confidence interval in which the true rank of the
given rank exists.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>rank</code> - the given normalized rank.</dd>
<dt>Returns:</dt>
<dd>the upper bound of the rank confidence interval in which the true rank of the
given rank exists.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="isEmpty()">
<h3>isEmpty</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="return-type">boolean</span>&nbsp;<span class="element-name">isEmpty</span>()</div>
<div class="block">Returns true if this sketch is empty.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>true if this sketch is empty.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="isEstimationMode()">
<h3>isEstimationMode</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="return-type">boolean</span>&nbsp;<span class="element-name">isEstimationMode</span>()</div>
<div class="block">Returns true if this sketch is in estimation mode.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>true if this sketch is in estimation mode.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="isReadOnly()">
<h3>isReadOnly</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="return-type">boolean</span>&nbsp;<span class="element-name">isReadOnly</span>()</div>
<div class="block">Returns true if this sketch is read only.</div>
<dl class="notes">
<dt>Returns:</dt>
<dd>true if this sketch is read only.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="reset()">
<h3>reset</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="return-type">void</span>&nbsp;<span class="element-name">reset</span>()</div>
<div class="block">Resets this sketch to the empty state.
If the sketch is <i>read only</i> this does nothing.
<p>The parameter <i>k</i> will not change.</p></div>
</div>
</section>
</li>
<li>
<section class="detail" id="toString()">
<h3>toString</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">toString</span>()</div>
<div class="block">Returns a summary of the key parameters of the sketch.</div>
<dl class="notes">
<dt>Overrides:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></dd>
<dt>Returns:</dt>
<dd>a summary of the key parameters of the sketch.</dd>
</dl>
</div>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &#169; 2015&#x2013;2025 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</main>
</div>
</body>
</html>