13 static_assert(std::is_same<View::value_type, uliteral_t>::value,
"View::value_type and uliteral_t must be the same");
19 template<
typename text_t,
typename sa_t>
20 inline typename text_t::value_type
bwt(
const text_t& text,
const sa_t& sa,
const size_t i) {
21 return (sa[i] == 0u) ? text[sa.size()-1] : text[sa[i]-1];
28 template<
typename bwt_t>
30 DVLOG(2) <<
"Computing LF";
31 if(bwt_length == 0)
return nullptr;
39 DCHECK_LT(static_cast<size_t>(C[i]),bwt.size()+1 - C[i-1]);
47 for(
len_t i = 0; i < bwt_length; ++i) {
58 for(
len_t i = 0; i < bwt_length; ++i)
59 for(
len_t j = i+1; j < bwt_length; ++j) {
60 if(bwt[i] != bwt[j])
continue;
61 DCHECK_LT(LF[i], LF[j]);
67 DVLOG(2) <<
"Finished Computing LF";
76 template<
typename bwt_t>
78 const size_t bwt_length = bwt.size();
79 VLOG(2) <<
"InputSize: " << bwt_length;
84 std::string decoded_string(bwt_length-1, 0);
88 for(
len_t j = 1; j < bwt_length; ++j) {
89 decoded_string[bwt_length - j-1] = bwt[i];
97 return decoded_string;
Contains the text compression and encoding framework.
std::string decode_bwt(const bwt_t &bwt)
Decodes a BWT It is assumed that the BWT is stored in a container with access to operator[] and ...
void assert_permutation(const T &, size_t)
#define tdc_unlikely(x)
Provides a hint to the compiler that x is expected to resolve to false.
constexpr T literal2int(uliteral_t c)
Converts a literal to an integer value as if unsigned.
len_compact_t * compute_LF(const bwt_t &bwt, const size_t bwt_length)
Computes the LF table used for decoding the BWT Input is a BWT and its length.
text_t::value_type bwt(const text_t &text, const sa_t &sa, const size_t i)
Computes the value BWT[i] of a text T given its suffix array SA Runs in O(1) time since BWT[i] = SA[(...
constexpr size_t ULITERAL_MAX
The maximum value of uliteral_t.
uint32_t len_compact_t
Type to represent an bit-compact length value.
fast_t< len_compact_t > len_t
Type to represent an length value.
std::string arr_to_debug_string(const T *s, size_t length)
Builds the string representation of an array of printable values, sorrounded by square brackets ([ an...
#define IF_PARANOID(x)
x is compiled only in debug builds and when the PARANOID macro is defined.