a static vector of bits with its counts inside its lines, rank with one access to the memory
More...
#include <ADS/succinct/InterleavedRankSelect.h>
|
| | InterleavedRankSelect (void) |
| | the directory of no bit
|
| | InterleavedRankSelect (const BitVector &b) |
| | the directory of the bits \( b \), laid out with them
|
| | InterleavedRankSelect (std::span< const Word > w, std::size_t n) |
| | the directory of the \( n \) bits of the words \( w \), laid out with them
|
| std::size_t | size (void) const |
| | the number of bits, \( m \)
|
| std::size_t | ones (void) const |
| | the number of 1s
|
| std::size_t | zeros (void) const |
| | the number of 0s
|
| bool | operator[] (std::size_t i) const |
| | the bit \( i \)
|
| std::size_t | rank1 (std::size_t i) const |
| | the number of 1s in the places \( [ 0 , i ) \)
|
| std::size_t | rank0 (std::size_t i) const |
| | the number of 0s in the places \( [ 0 , i ) \), i.e., \( i - \mathrm{rank}_1( i ) \)
|
| std::size_t | select1 (std::size_t k) const |
| | the place of the \( k \)-th 1
|
| std::size_t | select0 (std::size_t k) const |
| | the place of the \( k \)-th 0, by the select of select1() above on the complemented words
|
| std::size_t | directoryBits (void) const |
| | the bits of the counts in the lines, of the superblocks and of the samples, beyond the \( m \) bits
|
| template<class A> |
| void | persist (A &a) |
| | the members written to, or read from, the archive \( a \) [see Persistence.h]
|
|
| static constexpr std::uint64_t | persistTag (void) |
| | the parameters of the layout of the lines, in a file
|
|
| static constexpr std::string_view | persistName = "InterleavedRankSelect" |
| | the name of the structure in a file [see Persistence.h]
|
a static vector of bits with its counts inside its lines, rank with one access to the memory
◆ InterleavedRankSelect() [1/3]
| ADS::InterleavedRankSelect::InterleavedRankSelect |
( |
void | | ) |
|
|
inline |
◆ InterleavedRankSelect() [2/3]
| ADS::InterleavedRankSelect::InterleavedRankSelect |
( |
const BitVector & | b | ) |
|
|
explicit |
the directory of the bits \( b \), laid out with them
◆ InterleavedRankSelect() [3/3]
| ADS::InterleavedRankSelect::InterleavedRankSelect |
( |
std::span< const Word > | w, |
|
|
std::size_t | n ) |
the directory of the \( n \) bits of the words \( w \), laid out with them
- Precondition
- w.size() \( \ge \lceil n / 64 \rceil \)
◆ directoryBits()
| std::size_t ADS::InterleavedRankSelect::directoryBits |
( |
void | | ) |
const |
|
nodiscard |
the bits of the counts in the lines, of the superblocks and of the samples, beyond the \( m \) bits
◆ ones()
| std::size_t ADS::InterleavedRankSelect::ones |
( |
void | | ) |
const |
|
inlinenodiscard |
◆ operator[]()
| bool ADS::InterleavedRankSelect::operator[] |
( |
std::size_t | i | ) |
const |
|
nodiscard |
the bit \( i \)
- Precondition
- \( i < \) size()
◆ persist()
template<class A>
| void ADS::InterleavedRankSelect::persist |
( |
A & | a | ) |
|
the members written to, or read from, the archive \( a \) [see Persistence.h]
◆ persistTag()
| constexpr std::uint64_t ADS::InterleavedRankSelect::persistTag |
( |
void | | ) |
|
|
inlinestaticnodiscardconstexpr |
the parameters of the layout of the lines, in a file
◆ rank0()
| std::size_t ADS::InterleavedRankSelect::rank0 |
( |
std::size_t | i | ) |
const |
|
inlinenodiscard |
the number of 0s in the places \( [ 0 , i ) \), i.e., \( i - \mathrm{rank}_1( i ) \)
- Precondition
- \( i \le \) size()
◆ rank1()
| std::size_t ADS::InterleavedRankSelect::rank1 |
( |
std::size_t | i | ) |
const |
|
nodiscard |
the number of 1s in the places \( [ 0 , i ) \)
In pseudocode (the rank of SPIDER, beyond the book), \( L_\ell \) the line \( \ell \), its count \( h_\ell \) in its first 16 bits, and \( S \) the counts of the superblocks:
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{function}\ \mathrm{rank1}( i ) \cr
2 & \quad \ell \gets \lfloor i / 496 \rfloor \cr
3 & \quad \textbf{return}\ S[ \lfloor \ell / 128 \rfloor ] + h_\ell +
\text{the 1s of } L_\ell \text{ in its bits } [ 16 , 16 + i \bmod
496 )
\end{array}}
\]
- Precondition
- \( i \le \) size()
◆ select0()
| std::size_t ADS::InterleavedRankSelect::select0 |
( |
std::size_t | k | ) |
const |
|
nodiscard |
the place of the \( k \)-th 0, by the select of select1() above on the complemented words
- Precondition
- \( 1 \le k \le \) zeros()
- Postcondition
- the bit there is 0 and rank0() of it is \( k - 1 \)
◆ select1()
| std::size_t ADS::InterleavedRankSelect::select1 |
( |
std::size_t | k | ) |
const |
|
nodiscard |
the place of the \( k \)-th 1
In pseudocode (the select of SPIDER, beyond the book), for the bits \( b = 1 \) (the words complemented for the 0s), the samples \( ( \ell_j , c_j ) \) and \( \mathrm{before}( \ell ) \) the bits \( b \) before the line \( \ell \):
\[\class{pseudocode}{\begin{array}{r@{\quad}l}
1 & \textbf{function}\ \mathrm{select}( k ) \cr
2 & \quad j \gets \lfloor ( k - 1 ) / 8192 \rfloor \cr
3 & \quad \ell \gets \min\{ \ell_{j+1} , \ell_j + \lfloor ( k - 1 - c_j
) ( \ell_{j+1} - \ell_j ) / ( c_{j+1} - c_j ) \rfloor \} \cr
4 & \quad \textbf{while}\ \ell > \ell_j\ \textbf{and}\ \mathrm{before}(
\ell ) \ge k\ \textbf{do}\ \ell \gets \ell - 1 \cr
5 & \quad \textbf{while}\ \ell < \ell_{j+1}\ \textbf{and}
\ \mathrm{before}( \ell + 1 ) < k\ \textbf{do}\ \ell \gets \ell + 1
\cr
6 & \quad r \gets k - \mathrm{before}( \ell ) \cr
7 & \quad \textbf{foreach}\ \text{word } x \text{ of } L_\ell \text{,}
\text{ its count cleared}\ \textbf{do} \cr
8 & \qquad \textbf{if}\ r \le \mathrm{popcount}( x )
\ \textbf{then return}\ \text{the place of } x +
\mathrm{selectInWord}(
x , r - 1 ) \cr
9 & \qquad r \gets r - \mathrm{popcount}( x )
\end{array}}
\]
- Precondition
- \( 1 \le k \le \) ones()
- Postcondition
- the bit there is 1 and rank1() of it is \( k - 1 \)
◆ size()
| std::size_t ADS::InterleavedRankSelect::size |
( |
void | | ) |
const |
|
inlinenodiscard |
the number of bits, \( m \)
◆ zeros()
| std::size_t ADS::InterleavedRankSelect::zeros |
( |
void | | ) |
const |
|
inlinenodiscard |
◆ persistName
| std::string_view ADS::InterleavedRankSelect::persistName = "InterleavedRankSelect" |
|
staticconstexpr |
The documentation for this class was generated from the following file: