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

◆ isNontrivialSuperword()

auto WordTable::isNontrivialSuperword ( Word word,
int index1,
int index2 ) const->bool

Definition at line 191 of file WordTable.cpp.

192{
193 // this command is only called on an overlap between the words mMonomials[index1]
194 // and mMonomials[index2].
195 std::vector<int> start_indices;
196 for (auto i = 0; i < mMonomials.size(); ++i)
197 {
198 start_indices.clear();
199 subwordPositions(mMonomials[i], word, start_indices);
200 for (auto j : start_indices)
201 {
202 if (i != index1 && i != index2) return true;
203 // these commands handle when the overlap is *trivially* a multiple of one of
204 // the monomials in index1 or index2
205 if (j == 0 && i != index1) return true;
206 if (j == word.size() - mMonomials[index2].size() && i != index2) return true;
207 }
208 }
209 return false;
210}
std::vector< int > word
static void subwordPositions(Word word1, Word word2, std::vector< int > &result_start_indices)
Definition WordTable.cpp:38
std::vector< Word > mMonomials

References mMonomials, subwordPositions(), and word.

Referenced by TEST().