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...
#include <ADS/succinct/PartitionedEliasFano.h>
|
| | PartitionedEliasFano (void)=default |
| | the empty sequence
|
| | PartitionedEliasFano (std::span< const std::uint64_t > x) |
| | the sequence \( x \), with the universe \( x_{n-1} + 1 \)
|
| | PartitionedEliasFano (std::span< const std::uint64_t > x, std::uint64_t u) |
| | the sequence \( x \) in \( [ 0 , u ) \)
|
| std::size_t | size (void) const |
| | the number of items, \( n \)
|
| bool | empty (void) const |
| | whether there is no item
|
| std::uint64_t | universe (void) const |
| | the bound \( u \) of the items
|
| std::uint64_t | access (std::size_t i) const |
| | the item \( i \)
|
| std::uint64_t | operator[] (std::size_t i) const |
| | the item \( i \), as access()
|
| std::size_t | nextGEQ (std::uint64_t x) const |
| | the place of the first item \( \ge x \), size() if none
|
| bool | contains (std::uint64_t x) const |
| | whether \( x \) is in the sequence, by nextGEQ()
|
| std::array< std::size_t, 3 > | kinds (void) const |
| | the numbers of the full blocks, of those coded as vectors and of those coded by Elias-Fano
|
| std::size_t | sizeInBits (void) const |
| | the bits of the codes, of the records, of the superblocks and of the buckets
|
| template<class A> |
| void | persist (A &a) |
| | the members written to, or read from, the archive \( a \) [see Persistence.h]
|
| const_iterator | begin (void) const |
| | the iterator on the first item
|
| const_iterator | end (void) const |
| | the iterator past the last item
|
| const_iterator | cbegin (void) const |
| | the same as begin()
|
| const_iterator | cend (void) const |
| | the same as end()
|
|
| static constexpr std::uint64_t | persistTag (void) |
| | the items of a block, in a file
|
|
| static constexpr std::string_view | persistName = "PartitionedEliasFano" |
| | the name of the structure in a file [see Persistence.h]
|
| static constexpr std::uint32_t | persistVersion = 2 |
| | the version of the layout in a file: 2, that of the records of whole words and of the buckets
|
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()
◆ const_iterator
Initial value:
the random-access constant iterator on the items T of the owner O, read by ( *o )[ i ]
Definition BitVector.h:372
the constant iterator, random access
◆ const_reference
an item, returned by value
◆ difference_type
the type of the distance of two places
◆ iterator
◆ reference
an item, returned by value
◆ size_type
◆ value_type
◆ PartitionedEliasFano() [1/3]
| ADS::PartitionedEliasFano::PartitionedEliasFano |
( |
void | | ) |
|
|
default |
◆ PartitionedEliasFano() [2/3]
| ADS::PartitionedEliasFano::PartitionedEliasFano |
( |
std::span< const std::uint64_t > | x | ) |
|
|
explicit |
the sequence \( x \), with the universe \( x_{n-1} + 1 \)
- Precondition
- \( x \) is strictly increasing (an audit)
◆ PartitionedEliasFano() [3/3]
| ADS::PartitionedEliasFano::PartitionedEliasFano |
( |
std::span< const std::uint64_t > | x, |
|
|
std::uint64_t | u ) |
the sequence \( x \) in \( [ 0 , u ) \)
In pseudocode (Ottaviano and Venturini with the uniform partition, beyond the book), each block coded relative to the end of the one before:
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{procedure}\ \mathrm{build}( x , u ) \cr
2 & \quad \textbf{foreach}\ \text{block } j \text{ of } m \le 128
\text{ items}\ \textbf{do} \cr
3 & \qquad b_j \gets x_{128 j - 1} + 1\ \text{(0 for } j = 0
\text{)};\ u_j \gets x_{\mathrm{last}} - b_j + 1 \cr
4 & \qquad \ell \gets \lfloor \log_2( u_j / m ) \rfloor;\ e \gets m \ell
+ m + \lfloor ( u_j - 1 ) / 2^\ell \rfloor + 1 \cr
5 & \qquad \textbf{if}\ u_j = m\ \textbf{then}\ \text{no code (full)} \cr
6 & \qquad \textbf{else if}\ u_j \le e\ \textbf{then}\ \text{the }
u_j \text{ bits with a 1 at each } x - b_j \cr
7 & \qquad \textbf{else}\ \text{the Elias-Fano code of the values } x -
b_j \text{ with } \ell \text{ low bits} \cr
8 & \qquad \text{the record of } j \text{: } b_j \text{ and the place }
\text{of its code (relative to its superblock), the place of its}
\cr
& \qquad \text{1 of rank 64, its kind and } \ell \cr
9 & \quad \text{for each } t \text{, the last superblock whose } b
\text{ is below } t 2^s
\end{array}}
\]
- Precondition
- \( x \) is strictly increasing (an audit), \( x_{n-1} < u \), \( n < 2^{43} \) (fewer than \( 2^{32} \) superblocks)
◆ access()
| std::uint64_t ADS::PartitionedEliasFano::access |
( |
std::size_t | i | ) |
const |
|
nodiscard |
the item \( i \)
In pseudocode (Ottaviano and Venturini, beyond the book), the block \( j \) of the item \( i \), its \( m \) items, its code from the place \( p \) and \( k \) the rank of \( i \) in it:
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{function}\ \mathrm{access}( i ) \cr
2 & \quad j \gets \lfloor i / 128 \rfloor;\ k \gets i \bmod 128;\ b
\gets b_j \text{, from the record of } j \text{ and its}
\text{ superblock} \cr
3 & \quad \textbf{if}\ j \text{ is full }\ \textbf{then return}\ b + k \cr
4 & \quad \textbf{if}\ j \text{ is a vector }\ \textbf{then return}\ b +
( \mathrm{select}_1( p , k ) - p ) \cr
5 & \quad h \gets p + m \ell\quad \triangleright\ \text{the start of the }
\text{high part} \cr
6 & \quad \textbf{return}\ b + ( \mathrm{select}_1( h , k ) - h - k )
\cdot 2^\ell + \text{the low bits of } k \cr
& \quad \triangleright\ \mathrm{select}_1 \text{ from the 1 of rank 64}
\text{ of the record if } k \ge 64
\end{array}}
\]
- Precondition
- \( i < \) size()
◆ begin()
the iterator on the first item
◆ cbegin()
◆ cend()
◆ contains()
| bool ADS::PartitionedEliasFano::contains |
( |
std::uint64_t | x | ) |
const |
|
nodiscard |
whether \( x \) is in the sequence, by nextGEQ()
◆ empty()
| bool ADS::PartitionedEliasFano::empty |
( |
void | | ) |
const |
|
inlinenodiscard |
◆ end()
the iterator past the last item
◆ kinds()
| std::array< std::size_t, 3 > ADS::PartitionedEliasFano::kinds |
( |
void | | ) |
const |
|
nodiscard |
the numbers of the full blocks, of those coded as vectors and of those coded by Elias-Fano
◆ nextGEQ()
| std::size_t ADS::PartitionedEliasFano::nextGEQ |
( |
std::uint64_t | x | ) |
const |
|
nodiscard |
the place of the first item \( \ge x \), size() if none
In pseudocode (Ottaviano and Venturini, beyond the book), \( H \) the table of buckets, \( H[ t ] \) the last superblock whose \( b \) is below \( t 2^s \) (0 if none), and \( c_q \) the \( b \) of the superblock \( q \):
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{function}\ \mathrm{nextGEQ}( x ) \cr
2 & \quad \textbf{if}\ n = 0\ \textbf{or}\ x > \text{the last item }
\ \textbf{then return}\ n \cr
3 & \quad t \gets \lfloor x / 2^s \rfloor;\ q \gets \text{the last }
\text{superblock of } [ H[ t ] , H[ t + 1 ] ] \text{ with } c_q \le x
\cr
4 & \quad j \gets 16 q + | \{ 16 q < j' < 16 q + 16 : b_{j'} \le x \} |
\quad \triangleright\ \text{the last } j \text{ with } b_j \le x
\cr
5 & \quad \triangleright\ \text{the last item of } j \text{ is}
\text{ at least } x \text{, since } b_{j+1} > x \cr
6 & \quad v \gets x - b_j \cr
7 & \quad \textbf{if}\ j \text{ is full }\ \textbf{then}\ k \gets v \cr
8 & \quad \textbf{else if}\ j \text{ is a vector }\ \textbf{then}\ k
\gets \text{the 1s of its first } v \text{ bits} \cr
9 & \quad \textbf{else}\ k \gets \text{the place of } v \text{ in its }
\text{code, as in } \mathrm{nextGEQ} \text{ of Elias-Fano} \cr
10 & \quad \textbf{return}\ 128 j + k
\end{array}}
\]
- Postcondition
- the items before it are \( < x \), the one at it is \( \ge x \)
◆ operator[]()
| std::uint64_t ADS::PartitionedEliasFano::operator[] |
( |
std::size_t | i | ) |
const |
|
inlinenodiscard |
◆ persist()
template<class A>
| void ADS::PartitionedEliasFano::persist |
( |
A & | a | ) |
|
the members written to, or read from, the archive \( a \) [see Persistence.h]
◆ persistTag()
| constexpr std::uint64_t ADS::PartitionedEliasFano::persistTag |
( |
void | | ) |
|
|
inlinestaticnodiscardconstexpr |
the items of a block, in a file
◆ size()
| std::size_t ADS::PartitionedEliasFano::size |
( |
void | | ) |
const |
|
inlinenodiscard |
the number of items, \( n \)
◆ sizeInBits()
| std::size_t ADS::PartitionedEliasFano::sizeInBits |
( |
void | | ) |
const |
|
nodiscard |
the bits of the codes, of the records, of the superblocks and of the buckets
◆ universe()
| std::uint64_t ADS::PartitionedEliasFano::universe |
( |
void | | ) |
const |
|
inlinenodiscard |
the bound \( u \) of the items
◆ persistName
| std::string_view ADS::PartitionedEliasFano::persistName = "PartitionedEliasFano" |
|
staticconstexpr |
◆ persistVersion
| std::uint32_t ADS::PartitionedEliasFano::persistVersion = 2 |
|
staticconstexpr |
the version of the layout in a file: 2, that of the records of whole words and of the buckets
The documentation for this class was generated from the following file: