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

◆ isNontrivialSuperword()

auto WordWithDataTable::isNontrivialSuperword ( WordWithData word,
int index1,
int index2 ) const->bool

Definition at line 454 of file WordTable.cpp.

455{
456 // this command is only called on an overlap between the words mMonomials[index1]
457 // and mMonomials[index2].
458 std::vector<int> start_indices;
459 for (auto i = 0; i < mMonomials.size(); ++i)
460 {
461 if (mIndices[i] == -1) continue;
462 start_indices.clear();
463 subwordPositions(mMonomials[i], word, start_indices);
464 for (auto j : start_indices)
465 {
466 if (i != index1 && i != index2) return true;
467 // these commands handle when the overlap is trivially a multiple of one of
468 // the monomials in index1 or index2
469 if (j == 0 && i != index1) return true;
470 if (j == word.size() - mMonomials[index2].size() && i != index2) return true;
471 }
472 }
473 return false;
474}
std::vector< int > word
static void subwordPositions(WordWithData word1, WordWithData word2, std::vector< int > &result_start_indices)
std::vector< int > mIndices
std::vector< WordWithData > mMonomials

References mIndices, mMonomials, subwordPositions(), and word.