25 struct IntervalComparator {
26 bool operator()(
const Interval& a,
const Interval& b) {
39 Meta m(
"lcpcomp_comp",
"bulldozer");
47 template<
typename text_t>
57 auto& sa = text.require_sa();
58 auto& lcp = text.require_lcp();
64 std::vector<Interval> intervals;
66 std::vector<Interval> intervals;
67 for(
size_t i = 1; i < sa.size(); i++) {
68 if(lcp[i] >= threshold) {
69 intervals.emplace_back(sa[i], sa[i-1], lcp[i]);
70 intervals.emplace_back(sa[i-1], sa[i], lcp[i]);
79 std::sort(intervals.begin(), intervals.end(), IntervalComparator());
92 auto x = intervals.begin();
93 while(x != intervals.end()) {
97 while(l < x->l && x->q + l < n && !marked[x->q + l]) {
105 for(
size_t k = 0; k < l; k++) {
106 marked[x->p + k] = 1;
113 }
while(x != intervals.end() && x->p < p + l);
Contains the text compression and encoding framework.
void factorize(text_t &text, size_t threshold, lzss::FactorBuffer &factors)
A vector over arbitrary unsigned integer types.
Algorithm(Algorithm const &)=default
static ds::dsflags_t textds_flags()
Implements the "Bulldozer" selection strategy for LCPComp.
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.
Interface for algorithms.