25 Meta m(
"lcpcomp_comp",
"heap");
35 template<
typename text_t>
37 const size_t threshold,
45 auto& sa = text.require_sa();
46 auto& isa = text.require_isa();
47 auto lcp = text.release_lcp();
52 for(
size_t i = 1; i < lcp.size(); i++) {
53 if(lcp[i] >= threshold) ++heap_size;
58 for(
size_t i = 1; i < lcp.size(); i++) {
59 if(lcp[i] >= threshold) heap.
insert(i);
68 while(heap.size() > 0) {
70 size_t m = heap.get_max();
74 size_t fsrc = sa[m-1];
80 for(
size_t k = 0; k < flen; k++) {
81 heap.remove(isa[fpos + k]);
85 for(
size_t k = 0; k < flen && fpos > k; k++) {
86 size_t s = fpos - k - 1;
88 if(heap.contains(i)) {
89 if(s + lcp[i] > fpos) {
92 heap.decrease_key(i, l);
Contains the text compression and encoding framework.
Implements the original "Max LCP" selection strategy for LCPComp.
Algorithm(Algorithm const &)=default
void insert(len_t i)
Inserts an item into the heap.
void factorize(text_t &text, const size_t threshold, lzss::FactorBuffer &factors)
void emplace_back(len_t fpos, len_t fsrc, len_t flen)
static void log(const char *key, const T &value)
Logs a user statistic for the current phase.
static auto wrap(const char *title, F func) -> typename std::result_of< F(StatPhase &)>::type
Executes a lambda as a single statistics phase.
Represents a binary max heap backed by an external array of keys.
Interface for algorithms.
static ds::dsflags_t textds_flags()