123#ifndef __ADS_IntegerCodes
124 #define __ADS_IntegerCodes
169[[nodiscard]]
inline std::vector< std::uint64_t >
170dGaps(
const std::vector< std::uint64_t > & x );
173[[nodiscard]]
inline std::vector< std::uint64_t >
188[[nodiscard]]
constexpr std::uint64_t
unaryLength( std::uint64_t x );
288[[nodiscard]]
constexpr std::uint64_t
riceLength( std::uint64_t x ,
int k );
346 [[nodiscard]] std::size_t
size(
void )
const;
357[[nodiscard]]
inline int
384 std::uint64_t base = 0 );
388[[nodiscard]]
inline std::vector< std::uint64_t >
407inline void encodeVByte( std::vector< std::uint8_t > & out , std::uint64_t x );
412[[nodiscard]]
inline std::uint64_t
413decodeVByte(
const std::vector< std::uint8_t > & in , std::size_t & p );
437inline void encodeDense( std::vector< std::uint32_t > & out , std::uint64_t x ,
438 std::uint32_t s , std::uint32_t c );
454[[nodiscard]]
inline std::uint64_t
455decodeDense(
const std::vector< std::uint32_t > & in , std::size_t & p ,
456 std::uint32_t s , std::uint32_t c );
460[[nodiscard]]
constexpr int denseLength( std::uint64_t x , std::uint32_t s ,
479[[nodiscard]]
inline std::uint32_t
493[[nodiscard]]
inline std::uint64_t
519 const std::vector< std::uint64_t > & x ,
520 std::uint64_t low , std::uint64_t hi );
525[[nodiscard]]
inline std::vector< std::uint64_t >
537#include "ADS/compression/impl/IntegerCodes.tpp"
The streams of bits on which the integer codes are written and read [see IntegerCodes....
The vector of bits on which the succinct structures and the integer codes of ADS are built: the bits ...
The broadword tricks of Knuth (section 7.1.3 of The Art of Computer Programming), beyond the book: op...
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
a stream of bits read forward from a place of a BitVector, which must outlive the reader
Definition BitStream.h:149
a vector of bits packed in words of 64 bits
Definition BitVector.h:479
a stream of bits written at its end, on a BitVector
Definition BitStream.h:82
void encodeGamma(BitWriter &w, std::uint64_t x)
, zeros and
void encodeInterpolative(BitWriter &w, const std::vector< std::uint64_t > &x, std::uint64_t low, std::uint64_t hi)
the interpolative code of , which and bound
void encodeDense(std::vector< std::uint32_t > &out, std::uint64_t x, std::uint32_t s, std::uint32_t c)
the -dense code of appended to out, a word per item: the continuers and then a stopper
constexpr std::uint64_t signedToNatural(std::int64_t x)
as a natural number: if , if
int pforDeltaWidth(const std::vector< std::uint64_t > &x, std::uint64_t base, double f=0.9)
the smallest whose range holds at least the fraction of the values (all of them if ),...
std::uint64_t decodeBounded(BitReader &r, std::uint64_t a, std::uint64_t b)
the integer in coded next in by encodeBounded()
std::vector< std::uint64_t > dGaps(const std::vector< std::uint64_t > &x)
the d-gaps of a non-decreasing sequence: the first item, then the differences between consecutive ite...
std::vector< std::uint64_t > prefixSums(const std::vector< std::uint64_t > &g)
the sequence of the d-gaps , i.e., their prefix sums
std::uint64_t decodeGolomb(BitReader &r, std::uint64_t b)
the integer whose Golomb's code of modulus is next in
void encodeRice(BitWriter &w, std::uint64_t x, int k)
, and the remainder in bits,
std::uint64_t decodeDelta(BitReader &r)
the integer whose is next in
void encodeGolomb(BitWriter &w, std::uint64_t x, std::uint64_t b)
Golomb's code of modulus , and the remainder in the truncated binary code, .
constexpr std::uint64_t unaryLength(std::uint64_t x)
the bits of , i.e.,
std::vector< std::uint64_t > decodePForDelta(const PForDeltaBlock &p)
the values of the block : each slot plus the base, or the next exception for an escape
std::uint64_t decodeDense(const std::vector< std::uint32_t > &in, std::size_t &p, std::uint32_t s, std::uint32_t c)
the integer coded from , moved past it
void encodeUnary(BitWriter &w, std::uint64_t x)
, zeros and a 1
void encodeBounded(BitWriter &w, std::uint64_t x, std::uint64_t a, std::uint64_t b)
in bits, the BinaryCode of chapter 11, Integer Coding, of Ferragina's book
constexpr std::uint64_t golombLength(std::uint64_t x, std::uint64_t b)
the bits of Golomb's code of of modulus
std::uint64_t decodeGamma(BitReader &r)
the integer whose is next in
void encodeVByte(std::vector< std::uint8_t > &out, std::uint64_t x)
the variable-byte code of appended to out
void encodeDelta(BitWriter &w, std::uint64_t x)
, and
constexpr int denseLength(std::uint64_t x, std::uint32_t s, std::uint32_t c)
the words of the -dense code of
constexpr std::int64_t naturalToSigned(std::uint64_t y)
the inverse of signedToNatural(): if is even, if odd
std::vector< std::uint64_t > decodeInterpolative(BitReader &r, std::size_t n, std::uint64_t low, std::uint64_t hi)
the integers coded in , by the recursion of encodeInterpolative() with decodeBounded() in place of e...
PForDeltaBlock encodePForDelta(const std::vector< std::uint64_t > &x, int b, std::uint64_t base=0)
the values in slots of bits after subtracting base
constexpr int binaryLength(std::uint64_t x)
, the bits of the binary code of ,
constexpr int deltaLength(std::uint64_t x)
the bits of ,
std::uint64_t decodeRice(BitReader &r, int k)
the integer whose is next in : , read in unary and in bits
constexpr std::uint64_t riceLength(std::uint64_t x, int k)
the bits of ,
constexpr int gammaLength(std::uint64_t x)
the bits of ,
std::uint64_t decodeUnary(BitReader &r)
the integer whose is next in : one plus the zeros before the next 1
std::uint64_t decodeVByte(const std::vector< std::uint8_t > &in, std::size_t &p)
the integer coded from , moved past it: the groups of 7 bits gathered up to the byte below
constexpr int vbyteLength(std::uint64_t x)
the bytes of the variable-byte code of , , and 1 for
std::uint32_t denseOptimalS(const std::vector< std::uint64_t > &f, int bits=8)
the number of stoppers, , that minimizes the words of the integers of frequencies ,...
a block of values coded by PForDelta
Definition IntegerCodes.h:339
BitVector slots
the slots of bits
Definition IntegerCodes.h:342
std::vector< std::uint64_t > exceptions
the values out of range
Definition IntegerCodes.h:343
std::size_t size(void) const
the number of values
std::size_t codeBits(void) const
the bits of the code, and 64 for each exception
int b
the bits of a slot
Definition IntegerCodes.h:340
std::uint64_t base
subtracted from the values in range
Definition IntegerCodes.h:341