66#ifndef __ADS_InterleavedRankSelect
67 #define __ADS_InterleavedRankSelect
116 [[nodiscard]] std::size_t
size(
void )
const {
return( f_n ); }
119 [[nodiscard]] std::size_t
ones(
void )
const {
return( f_ones ); }
122 [[nodiscard]] std::size_t
zeros(
void )
const {
return( f_n - f_ones ); }
143 [[nodiscard]] std::size_t
rank1( std::size_t i )
const;
148 [[nodiscard]] std::size_t
rank0( std::size_t i )
const {
149 return( i -
rank1( i ) );
181 [[nodiscard]] std::size_t
select1( std::size_t k )
const;
187 [[nodiscard]] std::size_t
select0( std::size_t k )
const;
196 static constexpr std::string_view
persistName =
"InterleavedRankSelect";
199 [[nodiscard]]
static constexpr std::uint64_t
persistTag(
void ) {
200 return( detail::persistMix( { kData , kLines , kSample } ) );
210 static constexpr std::size_t kData = 496;
211 static constexpr std::size_t kLines = 128;
212 static constexpr std::size_t kSample = 8192;
215 void build(
const Word * w , std::size_t n );
218 [[nodiscard]] std::size_t before( std::size_t l )
const {
219 return( std::size_t( f_S[ l / kLines ] ) +
220 std::size_t( f_L[ 8 * l ] & 0xFFFF ) );
224 [[nodiscard]] std::size_t inLine( std::size_t l ,
unsigned p )
const;
227 [[nodiscard]] std::size_t
select( std::size_t k ,
bool b )
const;
230 [[nodiscard]]
bool consistent(
void )
const;
232 std::size_t f_n = 0 , f_ones = 0;
233 std::vector< Word , detail::LineAllocator< Word > > f_L;
235 std::vector< std::uint64_t , MappableAllocator< std::uint64_t > > f_S;
237 std::vector< std::uint32_t , MappableAllocator< std::uint32_t > > f_sl[ 2 ];
239 std::vector< std::uint64_t , MappableAllocator< std::uint64_t > > f_sc[ 2 ];
251#include "ADS/succinct/impl/InterleavedRankSelect.tpp"
The vector of bits on which the succinct structures and the integer codes of ADS are built: the bits ...
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
A file mapped in memory, shared by the structures that are read from it in place [see Persistence....
a vector of bits packed in words of 64 bits
Definition BitVector.h:479
std::size_t rank0(std::size_t i) const
the number of 0s in the places , i.e.,
Definition InterleavedRankSelect.h:148
InterleavedRankSelect(void)
the directory of no bit
Definition InterleavedRankSelect.h:105
bool operator[](std::size_t i) const
the bit
std::size_t zeros(void) const
the number of 0s
Definition InterleavedRankSelect.h:122
std::size_t size(void) const
the number of bits,
Definition InterleavedRankSelect.h:116
InterleavedRankSelect(std::span< const Word > w, std::size_t n)
the directory of the bits of the words , laid out with them
static constexpr std::uint64_t persistTag(void)
the parameters of the layout of the lines, in a file
Definition InterleavedRankSelect.h:199
std::size_t directoryBits(void) const
the bits of the counts in the lines, of the superblocks and of the samples, beyond the bits
InterleavedRankSelect(const BitVector &b)
the directory of the bits , laid out with them
std::size_t ones(void) const
the number of 1s
Definition InterleavedRankSelect.h:119
void persist(A &a)
the members written to, or read from, the archive [see Persistence.h]
std::size_t select1(std::size_t k) const
the place of the -th 1
static constexpr std::string_view persistName
the name of the structure in a file [see Persistence.h]
Definition InterleavedRankSelect.h:196
std::size_t rank1(std::size_t i) const
the number of 1s in the places
std::size_t select0(std::size_t k) const
the place of the -th 0, by the select of select1() above on the complemented words
int select(Word x, int r)
the place of the 1 of rank of , from 0
std::uint64_t Word
a word of 64 bits
Definition Bitwise.h:73