25 Meta m(
"lcpcomp_comp",
"plcppeaks",
"using peaks of PLCP array");
33 template<
typename text_t>
44 const auto& sa = text.require_sa();
45 const auto& isa = text.require_isa();
47 auto plcp = text.release_plcp();
50 const size_t n = sa.size();
52 len_t last_replacement_pos = 0;
53 for(
len_t i = 0; i+1 < n; ) {
54 if( (i == last_replacement_pos || plcp[i] > plcp[i-1]) && plcp[i] > plcp[i+1] && plcp[i] >= threshold) {
55 DCHECK_NE(isa[i], 0u);
56 const len_t& target_position = i;
57 const len_t factor_length = plcp[target_position];
58 DCHECK_LT(target_position+factor_length,n);
59 const len_t source_position = sa[isa[target_position]-1];
73 last_replacement_pos = i-1;
Contains the text compression and encoding framework.
Algorithm(Algorithm const &)=default
static ds::dsflags_t textds_flags()
fast_t< len_compact_t > len_t
Type to represent an length value.
A very naive selection strategy for LCPComp.
void emplace_back(len_t fpos, len_t fsrc, len_t flen)
static auto wrap(const char *title, F func) -> typename std::result_of< F(StatPhase &)>::type
Executes a lambda as a single statistics phase.
void factorize(text_t &text, size_t threshold, lzss::FactorBuffer &factors)
Interface for algorithms.