blob: aeddd91a472800d0093c1ebc79e1a9a86651aacb [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Class EliasFanoEncoder
| Apache Lucene.NET 4.8.0-beta00013 Documentation </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Class EliasFanoEncoder
| Apache Lucene.NET 4.8.0-beta00013 Documentation ">
<meta name="generator" content="docfx 2.56.2.0">
<link rel="shortcut icon" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/favicon.ico">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.css">
<meta property="docfx:navrel" content="toc.html">
<meta property="docfx:tocrel" content="core/toc.html">
<meta property="docfx:rel" content="https://lucenenet.apache.org/docs/4.8.0-beta00009/">
</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<span id="forkongithub"><a href="https://github.com/apache/lucenenet" target="_blank">Fork me on GitHub</a></span>
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">
<img id="logo" class="svg" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/lucene-net-color.png" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search">
<ul class="level0 breadcrumb">
<li>
<a href="https://lucenenet.apache.org/docs/4.8.0-beta00009/">API</a>
<span id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</span>
</li>
</ul>
</div>
</div>
</header>
<div class="container body-content">
<div id="search-results">
<div class="search-list"></div>
<div class="sr-items">
<p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
</div>
<ul id="pagination"></ul>
</div>
</div>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder">
<h1 id="Lucene_Net_Util_Packed_EliasFanoEncoder" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder" class="text-break">Class EliasFanoEncoder
</h1>
<div class="markdown level0 summary"><p>Encode a non decreasing sequence of non negative whole numbers in the Elias-Fano encoding
that was introduced in the 1970&apos;s by Peter Elias and Robert Fano.
<p>
The Elias-Fano encoding is a high bits / low bits representation of
a monotonically increasing sequence of <code>numValues &gt; 0</code> natural numbers <code>x[i]</code>
<p>
<code>0 &lt;= x[0] &lt;= x[1] &lt;= ... &lt;= x[numValues-2] &lt;= x[numValues-1] &lt;= upperBound</code>
<p>
where <code>upperBound &gt; 0</code> is an upper bound on the last value.
<p>
The Elias-Fano encoding uses less than half a bit per encoded number more
than the smallest representation
that can encode any monotone sequence with the same bounds.
<p>
The lower <code>L</code> bits of each <code>x[i]</code> are stored explicitly and contiguously
in the lower-bits array, with <code>L</code> chosen as (<code>Log()</code> base 2):
<p>
<code>L = max(0, floor(log(upperBound/numValues)))</code>
<p>
The upper bits are stored in the upper-bits array as a sequence of unary-coded gaps (<code>x[-1] = 0</code>):
<p>
<code>(x[i]/2<strong>L) - (x[i-1]/2</strong>L)</code>
<p>
The unary code encodes a natural number <code>n</code> by <code>n</code> 0 bits followed by a 1 bit:
<code>0...01</code>.
<p>
In the upper bits the total the number of 1 bits is <code>numValues</code>
and the total number of 0 bits is:
<p>
<code>floor(x[numValues-1]/2<strong>L) &lt;= upperBound/(2</strong>max(0, floor(log(upperBound/numValues)))) &lt;= 2<em>numValues</em></code>
<p>
The Elias-Fano encoding uses at most
<p>
<code>2 + Ceil(Log(upperBound/numValues))</code>
<p>
bits per encoded number. With <code>upperBound</code> in these bounds (<code>p</code> is an integer):
<p>
<code>2<em>p &lt; x[numValues-1] &lt;= upperBound &lt;= 2</em>*(p+1)</code>
<p>
the number of bits per encoded number is minimized.
<p>
In this implementation the values in the sequence can be given as <code>long</code>,
<code>numValues = 0</code> and <code>upperBound = 0</code> are allowed,
and each of the upper and lower bit arrays should fit in a <code>long[]</code>.
<p>
An index of positions of zero&apos;s in the upper bits is also built.
<p>
this implementation is based on this article:
<p>
Sebastiano Vigna, &quot;Quasi Succinct Indices&quot;, June 19, 2012, sections 3, 4 and 9.
Retrieved from <a href="http://arxiv.org/pdf/1206.4300">http://arxiv.org/pdf/1206.4300</a> .</p>
<p><p>The articles originally describing the Elias-Fano representation are:
<p>Peter Elias, &quot;Efficient storage and retrieval by content and address of static files&quot;,
J. Assoc. Comput. Mach., 21(2):246â€&quot;260, 1974.
<p>Robert M. Fano, &quot;On the number of bits required to implement an associative memory&quot;,
Memorandum 61, Computer Structures Group, Project MAC, MIT, Cambridge, Mass., 1971.
<p>
<div class="lucene-block lucene-internal">This is a Lucene.NET INTERNAL API, use at your own risk</div></div>
<div class="markdown level0 conceptual"></div>
<div class="inheritance">
<h5>Inheritance</h5>
<div class="level0"><span class="xref">System.Object</span></div>
<div class="level1"><span class="xref">EliasFanoEncoder</span></div>
</div>
<div class="inheritedMembers">
<h5>Inherited Members</h5>
<div>
<span class="xref">System.Object.Equals(System.Object, System.Object)</span>
</div>
<div>
<span class="xref">System.Object.GetType()</span>
</div>
<div>
<span class="xref">System.Object.MemberwiseClone()</span>
</div>
<div>
<span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
</div>
</div>
<h6><strong>Namespace</strong>: <a class="xref" href="Lucene.Net.Util.Packed.html">Lucene.Net.Util.Packed</a></h6>
<h6><strong>Assembly</strong>: Lucene.Net.dll</h6>
<h5 id="Lucene_Net_Util_Packed_EliasFanoEncoder_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public class EliasFanoEncoder</code></pre>
</div>
<h3 id="constructors">Constructors
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Util_Packed_EliasFanoEncoder__ctor_System_Int64_System_Int64_.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.Packed.EliasFanoEncoder.%23ctor(System.Int64%2CSystem.Int64)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/fix/apidocs-layout/src/Lucene.Net/Util/Packed/EliasFanoEncoder.cs/#L214">View Source</a>
</span>
<a id="Lucene_Net_Util_Packed_EliasFanoEncoder__ctor_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.#ctor*"></a>
<h4 id="Lucene_Net_Util_Packed_EliasFanoEncoder__ctor_System_Int64_System_Int64_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.#ctor(System.Int64,System.Int64)">EliasFanoEncoder(Int64, Int64)</h4>
<div class="markdown level1 summary"><p>Construct an Elias-Fano encoder using <a class="xref" href="Lucene.Net.Util.Packed.EliasFanoEncoder.html#Lucene_Net_Util_Packed_EliasFanoEncoder_DEFAULT_INDEX_INTERVAL">DEFAULT_INDEX_INTERVAL</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public EliasFanoEncoder(long numValues, long upperBound)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int64</span></td>
<td><span class="parametername">numValues</span></td>
<td></td>
</tr>
<tr>
<td><span class="xref">System.Int64</span></td>
<td><span class="parametername">upperBound</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Util_Packed_EliasFanoEncoder__ctor_System_Int64_System_Int64_System_Int64_.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.Packed.EliasFanoEncoder.%23ctor(System.Int64%2CSystem.Int64%2CSystem.Int64)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/fix/apidocs-layout/src/Lucene.Net/Util/Packed/EliasFanoEncoder.cs/#L150">View Source</a>
</span>
<a id="Lucene_Net_Util_Packed_EliasFanoEncoder__ctor_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.#ctor*"></a>
<h4 id="Lucene_Net_Util_Packed_EliasFanoEncoder__ctor_System_Int64_System_Int64_System_Int64_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.#ctor(System.Int64,System.Int64,System.Int64)">EliasFanoEncoder(Int64, Int64, Int64)</h4>
<div class="markdown level1 summary"><p>Construct an Elias-Fano encoder.
After construction, call <a class="xref" href="Lucene.Net.Util.Packed.EliasFanoEncoder.html#Lucene_Net_Util_Packed_EliasFanoEncoder_EncodeNext_System_Int64_">EncodeNext(Int64)</a> <code data-dev-comment-type="paramref" class="paramref">numValues</code> times to encode
a non decreasing sequence of non negative numbers. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public EliasFanoEncoder(long numValues, long upperBound, long indexInterval)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int64</span></td>
<td><span class="parametername">numValues</span></td>
<td><p>The number of values that is to be encoded. </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Int64</span></td>
<td><span class="parametername">upperBound</span></td>
<td><p>At least the highest value that will be encoded.
For space efficiency this should not exceed the power of two that equals
or is the first higher than the actual maximum.
<p>When <code>numValues &gt;= (upperBound/3)</code>
a <a class="xref" href="Lucene.Net.Util.FixedBitSet.html">FixedBitSet</a> will take less space. </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Int64</span></td>
<td><span class="parametername">indexInterval</span></td>
<td><p>The number of high zero bits for which a single index entry is built.
The index will have at most <code>2 * numValues / indexInterval</code> entries
and each index entry will use at most <code>Ceil(Log2(3 * numValues))</code> bits,
see <a class="xref" href="Lucene.Net.Util.Packed.EliasFanoEncoder.html">EliasFanoEncoder</a>. </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.ArgumentException</span></td>
<td><p>when:
<ul><li><code data-dev-comment-type="paramref" class="paramref">numValues</code> is negative, or</li><li><code data-dev-comment-type="paramref" class="paramref">numValues</code> is non negative and <code data-dev-comment-type="paramref" class="paramref">upperBound</code> is negative, or</li><li>the low bits do not fit in a <code>long[]</code>:
<code>(L * numValues / 64) &gt; System.Int32.MaxValue</code>, or</li><li>the high bits do not fit in a <code>long[]</code>:
<code>(2 * numValues / 64) &gt; System.Int32.MaxValue</code>, or</li><li><code>indexInterval &lt; 2</code>,</li><li>the index bits do not fit in a <code>long[]</code>:
<code>(numValues / indexInterval * ceil(2log(3 * numValues)) / 64) &gt; System.Int32.MaxValue</code>.</li></ul> </p>
</td>
</tr>
</tbody>
</table>
<h3 id="fields">Fields
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Util_Packed_EliasFanoEncoder_DEFAULT_INDEX_INTERVAL.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.Packed.EliasFanoEncoder.DEFAULT_INDEX_INTERVAL%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/fix/apidocs-layout/src/Lucene.Net/Util/Packed/EliasFanoEncoder.cs/#L109">View Source</a>
</span>
<h4 id="Lucene_Net_Util_Packed_EliasFanoEncoder_DEFAULT_INDEX_INTERVAL" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.DEFAULT_INDEX_INTERVAL">DEFAULT_INDEX_INTERVAL</h4>
<div class="markdown level1 summary"><p>The default index interval for zero upper bits. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public const long DEFAULT_INDEX_INTERVAL = 256L</code></pre>
</div>
<h5 class="fieldValue">Field Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int64</span></td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="properties">Properties
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Util_Packed_EliasFanoEncoder_IndexBits.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.Packed.EliasFanoEncoder.IndexBits%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/fix/apidocs-layout/src/Lucene.Net/Util/Packed/EliasFanoEncoder.cs/#L347">View Source</a>
</span>
<a id="Lucene_Net_Util_Packed_EliasFanoEncoder_IndexBits_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.IndexBits*"></a>
<h4 id="Lucene_Net_Util_Packed_EliasFanoEncoder_IndexBits" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.IndexBits">IndexBits</h4>
<div class="markdown level1 summary"><p>Expert. The index bits. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual long[] IndexBits { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int64</span>[]</td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Util_Packed_EliasFanoEncoder_LowerBits.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.Packed.EliasFanoEncoder.LowerBits%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/fix/apidocs-layout/src/Lucene.Net/Util/Packed/EliasFanoEncoder.cs/#L335">View Source</a>
</span>
<a id="Lucene_Net_Util_Packed_EliasFanoEncoder_LowerBits_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.LowerBits*"></a>
<h4 id="Lucene_Net_Util_Packed_EliasFanoEncoder_LowerBits" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.LowerBits">LowerBits</h4>
<div class="markdown level1 summary"><p>Expert. The low bits. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual long[] LowerBits { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int64</span>[]</td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Util_Packed_EliasFanoEncoder_UpperBits.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.Packed.EliasFanoEncoder.UpperBits%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/fix/apidocs-layout/src/Lucene.Net/Util/Packed/EliasFanoEncoder.cs/#L341">View Source</a>
</span>
<a id="Lucene_Net_Util_Packed_EliasFanoEncoder_UpperBits_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.UpperBits*"></a>
<h4 id="Lucene_Net_Util_Packed_EliasFanoEncoder_UpperBits" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.UpperBits">UpperBits</h4>
<div class="markdown level1 summary"><p>Expert. The high bits. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual long[] UpperBits { get; }</code></pre>
</div>
<h5 class="propertyValue">Property Value</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int64</span>[]</td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="methods">Methods
</h3>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Util_Packed_EliasFanoEncoder_EncodeNext_System_Int64_.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.Packed.EliasFanoEncoder.EncodeNext(System.Int64)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/fix/apidocs-layout/src/Lucene.Net/Util/Packed/EliasFanoEncoder.cs/#L238">View Source</a>
</span>
<a id="Lucene_Net_Util_Packed_EliasFanoEncoder_EncodeNext_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.EncodeNext*"></a>
<h4 id="Lucene_Net_Util_Packed_EliasFanoEncoder_EncodeNext_System_Int64_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.EncodeNext(System.Int64)">EncodeNext(Int64)</h4>
<div class="markdown level1 summary"><p>Call at most <span class="xref">Lucene.Net.Util.Packed.EliasFanoEncoder.numValues</span> times to encode a non decreasing sequence of non negative numbers. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual void EncodeNext(long x)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int64</span></td>
<td><span class="parametername">x</span></td>
<td><p>The next number to be encoded. </p>
</td>
</tr>
</tbody>
</table>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Condition</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.InvalidOperationException</span></td>
<td><p>when called more than <span class="xref">Lucene.Net.Util.Packed.EliasFanoEncoder.numValues</span> times. </p>
</td>
</tr>
<tr>
<td><span class="xref">System.ArgumentException</span></td>
<td><p>when:
<ul><li><code data-dev-comment-type="paramref" class="paramref">x</code> is smaller than an earlier encoded value, or</li><li><code data-dev-comment-type="paramref" class="paramref">x</code> is larger than <span class="xref">Lucene.Net.Util.Packed.EliasFanoEncoder.upperBound</span>.</li></ul> </p>
</td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Util_Packed_EliasFanoEncoder_Equals_System_Object_.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.Packed.EliasFanoEncoder.Equals(System.Object)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/fix/apidocs-layout/src/Lucene.Net/Util/Packed/EliasFanoEncoder.cs/#L378">View Source</a>
</span>
<a id="Lucene_Net_Util_Packed_EliasFanoEncoder_Equals_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.Equals*"></a>
<h4 id="Lucene_Net_Util_Packed_EliasFanoEncoder_Equals_System_Object_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.Equals(System.Object)">Equals(Object)</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public override bool Equals(object other)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Object</span></td>
<td><span class="parametername">other</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="overrides">Overrides</h5>
<div><span class="xref">System.Object.Equals(System.Object)</span></div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Util_Packed_EliasFanoEncoder_GetDecoder.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.Packed.EliasFanoEncoder.GetDecoder%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/fix/apidocs-layout/src/Lucene.Net/Util/Packed/EliasFanoEncoder.cs/#L326">View Source</a>
</span>
<a id="Lucene_Net_Util_Packed_EliasFanoEncoder_GetDecoder_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.GetDecoder*"></a>
<h4 id="Lucene_Net_Util_Packed_EliasFanoEncoder_GetDecoder" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.GetDecoder">GetDecoder()</h4>
<div class="markdown level1 summary"><p>Returns an <a class="xref" href="Lucene.Net.Util.Packed.EliasFanoDecoder.html">EliasFanoDecoder</a> to access the encoded values.
Perform all calls to <a class="xref" href="Lucene.Net.Util.Packed.EliasFanoEncoder.html#Lucene_Net_Util_Packed_EliasFanoEncoder_EncodeNext_System_Int64_">EncodeNext(Int64)</a> before calling <a class="xref" href="Lucene.Net.Util.Packed.EliasFanoEncoder.html#Lucene_Net_Util_Packed_EliasFanoEncoder_GetDecoder">GetDecoder()</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public virtual EliasFanoDecoder GetDecoder()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="Lucene.Net.Util.Packed.EliasFanoDecoder.html">EliasFanoDecoder</a></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Util_Packed_EliasFanoEncoder_GetHashCode.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.Packed.EliasFanoEncoder.GetHashCode%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/fix/apidocs-layout/src/Lucene.Net/Util/Packed/EliasFanoEncoder.cs/#L395">View Source</a>
</span>
<a id="Lucene_Net_Util_Packed_EliasFanoEncoder_GetHashCode_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.GetHashCode*"></a>
<h4 id="Lucene_Net_Util_Packed_EliasFanoEncoder_GetHashCode" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.GetHashCode">GetHashCode()</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public override int GetHashCode()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int32</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="overrides">Overrides</h5>
<div><span class="xref">System.Object.GetHashCode()</span></div>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Util_Packed_EliasFanoEncoder_SufficientlySmallerThanBitSet_System_Int64_System_Int64_.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.Packed.EliasFanoEncoder.SufficientlySmallerThanBitSet(System.Int64%2CSystem.Int64)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/fix/apidocs-layout/src/Lucene.Net/Util/Packed/EliasFanoEncoder.cs/#L310">View Source</a>
</span>
<a id="Lucene_Net_Util_Packed_EliasFanoEncoder_SufficientlySmallerThanBitSet_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.SufficientlySmallerThanBitSet*"></a>
<h4 id="Lucene_Net_Util_Packed_EliasFanoEncoder_SufficientlySmallerThanBitSet_System_Int64_System_Int64_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.SufficientlySmallerThanBitSet(System.Int64,System.Int64)">SufficientlySmallerThanBitSet(Int64, Int64)</h4>
<div class="markdown level1 summary"><p>Provide an indication that it is better to use an <a class="xref" href="Lucene.Net.Util.Packed.EliasFanoEncoder.html">EliasFanoEncoder</a> than a <a class="xref" href="Lucene.Net.Util.FixedBitSet.html">FixedBitSet</a>
to encode document identifiers.
This indication is not precise and may change in the future.
<p>An <a class="xref" href="Lucene.Net.Util.Packed.EliasFanoEncoder.html">EliasFanoEncoder</a> is favored when the size of the encoding by the <a class="xref" href="Lucene.Net.Util.Packed.EliasFanoEncoder.html">EliasFanoEncoder</a>
(including some space for its index) is at most about 5/6 of the size of the <a class="xref" href="Lucene.Net.Util.FixedBitSet.html">FixedBitSet</a>,
this is the same as comparing estimates of the number of bits accessed by a pair of <a class="xref" href="Lucene.Net.Util.FixedBitSet.html">FixedBitSet</a>s and
by a pair of non indexed <a class="xref" href="Lucene.Net.Util.Packed.EliasFanoDocIdSet.html">EliasFanoDocIdSet</a>s when determining the intersections of the pairs.
<p>A bit set is preferred when <code>upperbound &lt;= 256</code>.
<p>It is assumed that <a class="xref" href="Lucene.Net.Util.Packed.EliasFanoEncoder.html#Lucene_Net_Util_Packed_EliasFanoEncoder_DEFAULT_INDEX_INTERVAL">DEFAULT_INDEX_INTERVAL</a> is used. </p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static bool SufficientlySmallerThanBitSet(long numValues, long upperBound)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Int64</span></td>
<td><span class="parametername">numValues</span></td>
<td><p>The number of document identifiers that is to be encoded. Should be non negative. </p>
</td>
</tr>
<tr>
<td><span class="xref">System.Int64</span></td>
<td><span class="parametername">upperBound</span></td>
<td><p>The maximum possible value for a document identifier. Should be at least <code data-dev-comment-type="paramref" class="paramref">numValues</code>. </p>
</td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.Boolean</span></td>
<td></td>
</tr>
</tbody>
</table>
<span class="small pull-right mobile-hide">
<span class="divider">|</span>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Util_Packed_EliasFanoEncoder_ToString.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.Packed.EliasFanoEncoder.ToString%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Improve this Doc</a>
</span>
<span class="small pull-right mobile-hide">
<a href="https://github.com/NightOwl888/lucenenet/blob/fix/apidocs-layout/src/Lucene.Net/Util/Packed/EliasFanoEncoder.cs/#L351">View Source</a>
</span>
<a id="Lucene_Net_Util_Packed_EliasFanoEncoder_ToString_" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.ToString*"></a>
<h4 id="Lucene_Net_Util_Packed_EliasFanoEncoder_ToString" data-uid="Lucene.Net.Util.Packed.EliasFanoEncoder.ToString">ToString()</h4>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public override string ToString()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">System.String</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="overrides">Overrides</h5>
<div><span class="xref">System.Object.ToString()</span></div>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/apache/lucenenet/new/docs/4.8.0-beta00013/websites/apidocs/apiSpec/new?filename=Lucene_Net_Util_Packed_EliasFanoEncoder.md&amp;value=---%0Auid%3A%20Lucene.Net.Util.Packed.EliasFanoEncoder%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Improve this Doc</a>
</li>
<li>
<a href="https://github.com/apache/lucenenet/blob/fix/apidocs-layout/src/Lucene.Net/Util/Packed/EliasFanoEncoder.cs/#L90" class="contribution-link">View Source</a>
</li>
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
Copyright © 2020 The Apache Software Foundation, Licensed under the <a href='http://www.apache.org/licenses/LICENSE-2.0' target='_blank'>Apache License, Version 2.0</a><br> <small>Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation. <br>All other marks mentioned may be trademarks or registered trademarks of their respective owners.</small>
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.js"></script>
</body>
</html>