ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
PartitionedEliasFano.h File Reference

The partitioned Elias-Fano representation of Ottaviano and Venturini: a strictly increasing sequence \( x_0 < \cdots < x_{n-1} \) of integers of \( [ 0 , u ) \) cut into blocks of \( B = 128 \) items, each one coded in the cheapest of three ways relative to the end of the block before, so that a sequence with clusters (the lists of an inverted index) takes far fewer bits than the \( 2 + \lceil \log_2( u / n ) \rceil \) per item of Elias-Fano [see EliasFano.h], which ignores its regularities, with the same access() and nextGEQ(). More...

#include "ADS/Contract.h"
#include "ADS/external/MappedFile.h"
#include "ADS/succinct/BitVector.h"
#include <algorithm>
#include <array>
#include <bit>
#include <cstddef>
#include <cstdint>
#include <span>
#include <string_view>
#include <vector>
#include "ADS/succinct/impl/PartitionedEliasFano.tpp"

Go to the source code of this file.

Classes

class  ADS::PartitionedEliasFano
 a static strictly increasing sequence of integers in blocks, each coded as full, as a vector of bits or by Elias-Fano, with access() and nextGEQ() More...

Namespaces

namespace  ADS

Detailed description

The partitioned Elias-Fano representation of Ottaviano and Venturini: a strictly increasing sequence \( x_0 < \cdots < x_{n-1} \) of integers of \( [ 0 , u ) \) cut into blocks of \( B = 128 \) items, each one coded in the cheapest of three ways relative to the end of the block before, so that a sequence with clusters (the lists of an inverted index) takes far fewer bits than the \( 2 + \lceil \log_2( u / n ) \rceil \) per item of Elias-Fano [see EliasFano.h], which ignores its regularities, with the same access() and nextGEQ().

The block \( j \) holds the items of places \( [ j B , ( j + 1 ) B ) \), \( m \) of them, relative to \( b_j = x_{j B - 1} + 1 \) (0 for the first block): the values \( v = x - b_j \) are in \( [ 0 , u_j ) \) with \( u_j = x_{\mathrm{last}} - b_j + 1 \), and the block is

  • full, with no bit, if \( u_j = m \) (every value is there);
  • a vector of \( u_j \) bits, the bit \( v \) for the value \( v \), if \( u_j \) is at most the bits of Elias-Fano;
  • else Elias-Fano with \( \ell = \lfloor \log_2( u_j / m ) \rfloor \), in \( m \ell + m + \lfloor ( u_j - 1 ) / 2^\ell \rfloor + 1 \) bits;

the kind is a function of \( ( m , u_j ) \). For each block a record of one word (two if the fields do not fit in one) holds \( b_j \) and the place of its code, both relative to those of the first block of its superblock of 16 blocks, the place of the 1 of rank 64 in its code (the high part or the vector) and its kind with \( \ell \) (8 bits, so that a query computes no logarithm); each superblock keeps its \( b \) and its place in full, and a table of buckets gives, for each \( t \), the last superblock whose \( b \) is below \( t 2^s \), one bucket per superblock or so; so

  • access( i ) reads the record of the block of \( i \) and the words of its superblock and selects the item in the code of the block from its start or from the 1 of rank 64, in the 4 words that follow with no branch on the word (at most \( 3 B \) bits of high part, or a vector of \( u_j \le B ( \ell + 3 ) \) bits, since it is chosen only when not longer than Elias-Fano, and a scan beyond the 4 words when the 1 is not there);
  • nextGEQ( x ) finds the last block with \( b_j \le x \), whose last item is at least \( x \), by the bucket of \( x \), which bounds the superblocks to search (one or two on uniform items), and by a count with no branch of the 15 records after the first of the superblock, and the item in that block by the high part (the 0 of the bucket of \( x \)) or by the sideways sums of the vector up to \( x \), both from the 1 of rank 64 when \( x \) is beyond it.

Ottaviano and Venturini also choose the ends of the blocks by an approximate dynamic program on the cost of the codes, which gains a further 10% or so on the lists of an index; the blocks here have the fixed size of their uniform partition.

The contracts [see Contract.h]: the sequence is strictly increasing (an audit) and below \( u \), and access() needs \( i < n \); the audit of the construction is that access() gives back each item, and the postcondition of nextGEQ() is that the items before the place are \( < x \) and the one at it is not. The functions are defined in PartitionedEliasFano.tpp.

See also
G. Ottaviano, R. Venturini, Partitioned Elias-Fano indexes, Proc. 37th SIGIR, 273-282, 2014, doi:10.1145/2600428.2609615
S. Vigna, Quasi-succinct indices, Proc. 6th WSDM, 83-92, 2013, doi:10.1145/2433396.2433409
G. E. Pibiri, R. Venturini, Techniques for inverted index compression, ACM Computing Surveys 53(6), 125, 2020, doi:10.1145/3415148
Author
Donato Meoli
Dipartimento di Informatica
Università di Pisa