Macaulay2 Engine
Loading...
Searching...
No Matches

◆ checkOldOverlaps()

auto NCF4::checkOldOverlaps ( Word & newLeadWord) ->void
private

Definition at line 267 of file NCF4.cpp.

268{
269 // this function flags any previous overlaps that properly
270 // contain newLeadWord as no longer necessary.
271
272 // the newest overlaps are not yet added at this point
273 std::vector<int> startIndices;
274
275 for (auto& p : mOverlapTable.overlapMap())
276 {
277 for (auto& o : p.second)
278 {
279 if (not std::get<3>(o)) continue;
280 if (std::get<1>(o) == -1) continue;
281 int overlapLen = std::get<1>(o) + mWordTable[std::get<2>(o)].size();
282 if (overlapLen <= newLeadWord.size()) continue;
283 startIndices.clear();
284 // this is not optimal. Should pass info to word table to avoid creation of another word
285 auto w = createOverlapLeadWord(o);
286 WordTable::subwordPositions(newLeadWord,w,startIndices);
287 for (auto j : startIndices)
288 {
289 if (j != 0 or j != w.size() - newLeadWord.size())
290 {
291 if (M2_gbTrace >= 3)
292 std::cout << "Reduction avoided using lazy 2nd criterion." << std::endl;
293 std::get<3>(o) = false;
294 break;
295 }
296 }
297 }
298 }
299}
Word createOverlapLeadWord(const Overlap &o)
Definition NCF4.cpp:301
WordTable mWordTable
Definition NCF4.hpp:219
OverlapTable mOverlapTable
Definition NCF4.hpp:221
int size() const
Definition Word.hpp:74
static void subwordPositions(Word word1, Word word2, std::vector< int > &result_start_indices)
Definition WordTable.cpp:38
int p
int M2_gbTrace
Definition m2-types.cpp:52

References createOverlapLeadWord(), M2_gbTrace, mOverlapTable, mWordTable, p, and WordTable::subwordPositions().

Referenced by updateOverlaps().