SDSL: Succinct Data Structure Library
A C++ template library for succinct data structures
 All Classes Namespaces Files Functions Variables Typedefs Friends
Public Types | Static Public Member Functions | Static Public Attributes
sdsl::coder::ternary Class Reference

A class to encode and decode between ternary and binary code. More...

#include <ternary_coder.hpp>

List of all members.

Public Types

typedef uint64_t size_type

Static Public Member Functions

static uint8_t encoding_length (uint64_t w)
template<bool sumup, bool increment, class Iterator >
static uint64_t decode (const uint64_t *data, const size_type start_idx, size_type n, Iterator it=(Iterator) NULL)
static uint64_t decode_prefix_sum (const uint64_t *data, const size_type start_idx, size_type n)
static uint64_t decode_prefix_sum (const uint64_t *data, const size_type start_idx, const size_type end_idx, size_type n)
template<class int_vector >
static bool encode (const int_vector &v, int_vector &z)
template<class int_vector >
static bool decode (const int_vector &z, int_vector &v)
static void encode (uint64_t x, uint64_t *&z, uint8_t &offset)
 Encode one positive integer x to an int_vector at bit position start_idx.
template<class int_vector >
static uint64_t * raw_data (int_vector &v)

Static Public Attributes

static const uint16_t Trny2bin_0_16 [1<< 16]
 Array contains precomputed values for the decoding of a number in the ternary code.
static const uint16_t Trny2bin_0_16_greedy [1<< 16]
static const uint8_t min_codeword_length = 4

Detailed Description

A class to encode and decode between ternary and binary code.


Member Data Documentation

const uint16_t sdsl::coder::ternary::Trny2bin_0_16[1<< 16] [static]

Array contains precomputed values for the decoding of a number in the ternary code.

The 3 most significant bits (call it hi) contain information about how far to shift to get to the next next encoded integer. If the value of the 13 least significant bits is greater than 2187 or $ 2^{12}=4096 $ there is no complete complete decoding of an integer. So shift by 16 bits and decode the next word... otherwise shift by 2*(hi+1) to decode the next integer.


The documentation for this class was generated from the following file: