a non-decreasing sequence of integers in the Elias-Fano representation, the inventories of select of \( H \) built in the constructor if not Lazy and at the first select of each value if Lazy [see RankSelect.h]
More...
#include <ADS/succinct/EliasFano.h>
|
| | BasicEliasFano (void)=default |
| | the empty sequence
|
| | BasicEliasFano (const std::vector< std::uint64_t > &x) |
| | the sequence \( x \) in the universe \( [ 0 , x_{n-1} + 1 ) \)
|
| | BasicEliasFano (const std::vector< std::uint64_t > &x, std::uint64_t u) |
| | the sequence \( x \) in the universe \( [ 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 there is none, i.e., the number of items \( < x \)
|
| bool | contains (std::uint64_t x) const |
| | whether \( x \) is an item, by nextGEQ()
|
| int | lowWidth (void) const |
| | the number of low bits of each item, \( \ell \)
|
| const BitVector & | low (void) const |
| | the low bits, \( L \)
|
| const BasicRankSelect< Lazy > & | high (void) const |
| | the high bits, \( H \), with their directory
|
| std::size_t | codeBits (void) const |
| | the bits of \( L \) and \( H \), without the directory of \( H \)
|
| std::size_t | sizeInBits (void) const |
| | all the bits, with the directory of H
|
| std::vector< std::uint64_t > | decode (void) const |
| | the items, decoded in \( O( n ) \) time
|
| 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()
|
template<bool Lazy>
class ADS::BasicEliasFano< Lazy >
a non-decreasing sequence of integers in the Elias-Fano representation, the inventories of select of \( H \) built in the constructor if not Lazy and at the first select of each value if Lazy [see RankSelect.h]
◆ const_iterator
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
◆ BasicEliasFano() [1/3]
◆ BasicEliasFano() [2/3]
the sequence \( x \) in the universe \( [ 0 , x_{n-1} + 1 ) \)
- Precondition
- \( x \) is non-decreasing (an audit) and \( x_{n-1} < 2^{64} - 1 \), so that the universe fits in 64 bits
◆ BasicEliasFano() [3/3]
template<bool Lazy>
| ADS::BasicEliasFano< Lazy >::BasicEliasFano |
( |
const std::vector< std::uint64_t > & | x, |
|
|
std::uint64_t | u ) |
the sequence \( x \) in the universe \( [ 0 , u ) \)
In pseudocode (chapter 11, Integer Coding, of Ferragina's book, beyond the book):
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{procedure}\ \mathrm{build}( x , u ) \cr
2 & \quad \ell \gets \lceil \log_2( u / n ) \rceil\ \text{(0 if }
u \le n \text{)} \cr
3 & \quad H \gets n + \lfloor ( u - 1 ) / 2^\ell \rfloor + 1 \text{ bits }
\text{equal to 0};\ L \gets \text{an empty vector of bits} \cr
4 & \quad \textbf{for}\ i \gets 0\ \textbf{to}\ n - 1\ \textbf{do} \cr
5 & \qquad \mathrm{append}( L , x_i \bmod 2^\ell , \ell ) \cr
6 & \qquad H[ \lfloor x_i / 2^\ell \rfloor + i ] \gets 1 \cr
7 & \quad \text{build the directory of rank and select of } H
\end{array}}
\]
- Precondition
- \( x \) is non-decreasing (an audit) and its items are below \( u \)
◆ access()
the item \( i \)
In pseudocode (chapter 11, Integer Coding, of Ferragina's book, beyond the book):
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{function}\ \mathrm{access}( i ) \cr
2 & \quad h \gets \mathrm{select}_1( H , i + 1 ) - i\quad
\triangleright\ \text{the bucket of } x_i \cr
3 & \quad \textbf{return}\ h \cdot 2^\ell + L[ i \ell .. ( i + 1 ) \ell
- 1 ]
\end{array}}
\]
- Precondition
- \( i < \) size()
◆ begin()
the iterator on the first item
◆ cbegin()
◆ cend()
◆ codeBits()
the bits of \( L \) and \( H \), without the directory of \( H \)
◆ contains()
◆ decode()
the items, decoded in \( O( n ) \) time
◆ empty()
◆ end()
the iterator past the last item
◆ high()
the high bits, \( H \), with their directory
◆ low()
◆ lowWidth()
the number of low bits of each item, \( \ell \)
◆ nextGEQ()
the place of the first item \( \ge x \), size() if there is none, i.e., the number of items \( < x \)
In pseudocode (Vigna and Okanohara and Sadakane, beyond the book), \( \mathit{low}( i ) \) the low bits of the item \( i \):
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{function}\ \mathrm{nextGEQ}( x ) \cr
2 & \quad \textbf{if}\ n = 0\ \textbf{or}\ x \ge u\ \textbf{then return}
\ n \cr
3 & \quad h \gets \lfloor x / 2^\ell \rfloor;\ \mathit{pos} \gets 0
\ \text{if } h = 0 \text{, else } \mathrm{select}_0( H , h ) + 1 \cr
4 & \quad p \gets \mathit{pos} - h\quad \triangleright\ \text{the first }
\text{item of the bucket } h \cr
5 & \quad \textbf{while}\ H[ \mathit{pos} ] = 1\ \textbf{and}
\ \mathit{low}( p ) < x \bmod 2^\ell\ \textbf{do} \cr
6 & \qquad p \gets p + 1;\ \mathit{pos} \gets \mathit{pos} + 1\quad
\triangleright\ \text{past 8 items, a binary search} \cr
7 & \quad \textbf{return}\ p
\end{array}}
\]
- Postcondition
- the items before it are \( < x \), the one at it is \( \ge x \)
◆ operator[]()
◆ persist()
template<bool Lazy>
template<class A>
the members written to, or read from, the archive \( a \) [see Persistence.h]
◆ size()
the number of items, \( n \)
◆ sizeInBits()
all the bits, with the directory of H
◆ universe()
the bound \( u \) of the items
◆ persistName
Initial value: =
Lazy ? "LazyEliasFano" : "EliasFano"
the name of the structure in a file [see Persistence.h]
The documentation for this class was generated from the following file: