90#ifndef __ADS_RearCoding
91 #define __ADS_RearCoding
109#include <string_view>
122using RearPair = std::pair< std::size_t , std::string >;
140[[nodiscard]]
inline std::vector< RearPair >
159[[nodiscard]]
inline std::vector< std::string >
205 std::size_t b = 16 );
208 [[nodiscard]] std::size_t
size(
void )
const;
211 [[nodiscard]]
bool empty(
void )
const;
232 [[nodiscard]] std::string
access( std::size_t i )
const;
237 [[nodiscard]] std::size_t
lookup( std::string_view Q )
const;
272 [[nodiscard]] std::size_t
prefixEnd( std::string_view P )
const;
276 [[nodiscard]] std::pair< std::size_t , std::size_t >
285 [[nodiscard]] std::size_t
bytes(
void )
const;
290 static constexpr int kMax = 11;
293 static constexpr int kWide = 12;
297 static constexpr std::size_t kHead = 16;
304 std::array< std::uint8_t , 256 > len{};
305 std::array< std::uint32_t , 256 > word{};
306 std::vector< std::uint16_t > table;
309 std::vector< std::uint32_t > multi;
313 void build(
const std::array< std::uint64_t , 256 > & f );
319 [[nodiscard]] std::uint64_t peek( std::size_t pos )
const;
321 [[nodiscard]]
unsigned decode(
const Code & c , std::size_t & pos )
const;
325 [[nodiscard]] std::size_t getLength(
const Code & c ,
326 std::size_t & pos )
const;
329 void putLength(
const Code & c , std::size_t v );
333 [[nodiscard]]
static std::uint64_t prefix8( std::string_view s );
337 [[nodiscard]]
unsigned byte( std::size_t k , std::size_t j )
const;
341 void readRest( std::string & s , std::size_t len , std::size_t & pos )
const;
350 [[nodiscard]]
unsigned follow( std::string_view Q , std::size_t & l ,
351 std::size_t a , std::size_t n ,
352 std::size_t & pos )
const;
356 [[nodiscard]] std::string head( std::size_t k , std::size_t & pos )
const;
361 [[nodiscard]] std::size_t rank( std::string_view Q ,
bool upper ,
362 bool * eq =
nullptr )
const;
365 std::size_t f_b = 16;
368 std::string f_common;
369 std::vector< std::uint64_t > f_head;
384#include "ADS/string/impl/RearCoding.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,...
The Elias-Fano representation of a non-decreasing sequence of integers in (chapters 11,...
The front coding of a sorted dictionary of strings, beyond the book: adjacent strings share a prefix,...
The code of Huffman of a string of bytes as the fast coders do it, beyond the canonical code of chapt...
The prefetch of a line of the cache, beyond the book: ADS::prefetch( p ) asks the processor to bring ...
std::size_t bytes(void) const
all the bytes: the coding, the places and the samples of the buckets, and the codes with their tables
std::size_t lexicographicPosition(std::string_view Q) const
the number of strings smaller than
bool empty(void) const
whether there is no string
std::size_t codeBytes(void) const
the bytes of the coding, with the first strings and the lengths
std::size_t bucketSize(void) const
the strings of a bucket,
RearCodedDictionary(void)=default
the empty dictionary
std::size_t size(void) const
the number of strings
RearCodedDictionary(const std::vector< std::string > &D, std::size_t b=16)
the rear coding of in buckets of strings
std::pair< std::size_t, std::size_t > prefixRange(std::string_view P) const
the range of the strings prefixed by , by lexicographicPosition() and prefixEnd()
std::size_t prefixEnd(std::string_view P) const
the number of strings smaller than , i.e., smaller than or prefixed by it, by the search of lexicogr...
std::size_t lookup(std::string_view Q) const
the place of , size() if it is not a string of the dictionary, by the search of lexicographicPosition...
std::string access(std::size_t i) const
the string , decoded from the first string of its bucket
std::vector< RearPair > rearCode(const std::vector< std::string > &D)
the rear coding of , a pair per string
std::vector< std::string > rearDecode(const std::vector< RearPair > &R)
the strings of the rear coding
std::pair< std::size_t, std::string > RearPair
a pair of the rear coding, the characters taken off the end of the string before and the rest
Definition RearCoding.h:122
BasicEliasFano< false > EliasFano
Elias-Fano with the inventories of built in the constructor, the fastest access() and nextGEQ().
Definition EliasFano.h:291