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

◆ subwordPositions()

void WordWithDataTable::subwordPositions ( WordWithData word1,
WordWithData word2,
std::vector< int > & result_start_indices )
staticprivate

Definition at line 294 of file WordTable.cpp.

300{
301 if (word2.size() < word1.size()) return;
302 if (word2.ecartDegree() < word1.ecartDegree()) return;
303 for (auto j = 0; j <= word2.size() - word1.size(); ++j)
304 {
305 bool match = true;
306 for (auto k = 0; k < word1.size(); ++k)
307 if (word1.begin()[k] != word2.begin()[j+k])
308 {
309 match = false;
310 break;
311 }
312 if (match) result_start_indices.push_back(j);
313 }
314}
size_t size() const
Definition Word.hpp:148
const int * begin() const
Definition Word.hpp:140
int ecartDegree() const
Definition Word.hpp:145

References WordWithData::begin(), WordWithData::ecartDegree(), and WordWithData::size().

Referenced by isNontrivialSuperword(), subwords(), and superwords().