683{
684
685#if 0
686 mons = {{Z, X}, {Z, Y}, {Z, Z}, {Y, Y, X}, {Y, Y, Z},
687 {Y, X, Y, Y}, {Y, Y, Y, Y}, {Y, X, Y, X, X},
688 {Y, X, Y, X, Y}, {Y, X, Y, X, Z},
689 {Y, X, X, Y, X, X}, {Y, X, X, Y, X, Z},
690 {Y, X, X, Y, Y, Y}}
691#endif
692
693 std::vector<int> m0 {2,0};
694 std::vector<int> m1 {2,1};
695 std::vector<int> m2 {2,2};
696 std::vector<int> m3 {1,1,0};
697 std::vector<int> m4 {1,1,2};
698 std::vector<int> m5 {1,0,1,1};
699 std::vector<int> m6 {1,1,1,1};
700 std::vector<int> m7 {1,0,1,0,0};
701 std::vector<int> m8 {1,0,1,0,1};
702 std::vector<int> m9 {1,0,1,0,2};
703 std::vector<int> m10 {1,0,0,1,0,0};
704 std::vector<int> m11 {1,0,0,1,0,2};
705 std::vector<int> m12 {1,0,0,1,1,1};
706
707 std::vector<Overlap> overlaps;
708 std::vector<std::pair<int,int>> matches;
709
712 EXPECT_EQ(0, overlaps.size());
713
715 EXPECT_EQ(0, overlaps.size());
716
718 std::vector<Overlap> ans {
719 std::make_tuple(2,1,0,true),
720 std::make_tuple(2,1,1,true),
721 std::make_tuple(2,1,2,true)
722 };
723 std::sort(ans.begin(),ans.end());
724 std::sort(overlaps.begin(),overlaps.end());
725
726 EXPECT_EQ(overlaps, ans);
727 overlaps.clear();
729 EXPECT_EQ(0, overlaps.size());
730
741
742 matches.clear();
744 std::vector<std::pair<int,int>> ans2
745 {
746 std::make_pair(3,0),
747 std::make_pair(4,0),
748 std::make_pair(5,2),
749 std::make_pair(6,0),
750 std::make_pair(6,1),
751 std::make_pair(6,2),
752 std::make_pair(12,3),
753 std::make_pair(12,4)
754 };
755 std::sort(ans2.begin(),ans2.end());
756 std::sort(matches.begin(),matches.end());
757 EXPECT_EQ(ans2, matches);
758
759 matches.clear();
761 EXPECT_TRUE(W.
isNontrivialSuperword(
Word(std::vector<int> {1,1,2,1,1,2,1,1,2}), 4, 4));
762
763 matches.clear();
764 W.
subwords(
Word(std::vector<int> {2,2,0,1,1,0,1,0,1,1}), matches);
765 std::vector<std::pair<int,int>> ans3
766 {
767 {0,1},
768 {2,0},
769 {3,3},
770 {5,6},
771 {8,4}
772 };
773 std::sort(ans3.begin(),ans3.end());
774 std::sort(matches.begin(),matches.end());
775 EXPECT_EQ(ans3, matches);
776
777}
Non-owning view of a non-commutative word: [begin, end) of int variable indices.
void superwords(Word word, std::vector< std::pair< int, int > > &output) const
void subwords(Word word, std::vector< std::pair< int, int > > &output) const
auto isNontrivialSuperword(Word word, int index1, int index2) const -> bool
void leftOverlaps(std::vector< Overlap > &newLeftOverlaps) const
Index of Words (non-commutative monomials) with subword, prefix/suffix, and overlap lookup used by th...