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

◆ subwordPositions()

void WordTable::subwordPositions ( Word word1,
Word word2,
std::vector< int > & result_start_indices )
static

Definition at line 38 of file WordTable.cpp.

44{
45 if (word2.size() < word1.size()) return;
46 for (auto j = 0; j <= word2.size() - word1.size(); ++j)
47 {
48 bool match = true;
49 for (auto k = 0; k < word1.size(); ++k)
50 if (word1.begin()[k] != word2.begin()[j+k])
51 {
52 match = false;
53 break;
54 }
55 if (match) result_start_indices.push_back(j);
56 }
57}
const int * begin() const
Definition Word.hpp:72
int size() const
Definition Word.hpp:74

References Word::begin(), and Word::size().

Referenced by NCF4::checkOldOverlaps(), isNontrivialSuperword(), subwords(), and superwords().