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

◆ TEST() [5/19]

TEST ( FreeAlgebra ,
spairs  )

Definition at line 430 of file NCGroebnerTest.cpp.

431{
433 { "x", "y", "z" },
434 degreeRing(1),
435 {3,2,1},
436 {3,2,1},
437 {1}
438 );
439 FreeAlgebraElement x(A), y(A), z(A), f(A), g(A), h(A);
440 A->var(*x, 0);
441 A->var(*y, 1);
442 A->var(*z, 2);
443 f = x*y*x + z*y*z;
444 Word leadWord = A->lead_word(*f);
445 Word leadWordPrefix = A->lead_word_prefix(*f,2);
446 Word leadWordSuffix = A->lead_word_suffix(*f,1);
447 // TODO: did the offset change on our recent heft changes?
448 EXPECT_TRUE((*f).cbegin().monom().begin() + 2 == leadWord.begin() && (*f).cbegin().monom().begin() + 5 == leadWord.end());
449 EXPECT_TRUE((*f).cbegin().monom().begin() + 2 == leadWordPrefix.begin() && (*f).cbegin().monom().begin() + 4 == leadWordPrefix.end());
450 EXPECT_TRUE((*f).cbegin().monom().begin() + 3 == leadWordSuffix.begin() && (*f).cbegin().monom().begin() + 5 == leadWordSuffix.end());
451
452 PolyList polyList {&*f};
453 *g = *(NCGroebner::createOverlapPoly(*A, polyList, 0, 2, 0));
454 h = f*y*x - x*y*f;
455 EXPECT_TRUE(g == h);
456}
gc_vector< Poly * > PolyList
const RingQQ * globalQQ
Definition aring.cpp:24
void var(Poly &result, int v) const
Word lead_word_prefix(const Poly &f, int endIndex) const
Word lead_word(const Poly &f) const
static FreeAlgebra * create(const Ring *K, const std::vector< std::string > &names, const PolynomialRing *degreeRing, const std::vector< int > &degrees, const std::vector< int > &wtvecs, const std::vector< int > &heftVector)
Word lead_word_suffix(const Poly &f, int beginIndex) const
Owned Poly value paired with its FreeAlgebra*, providing natural operator-overloaded arithmetic.
Free associative algebra over a coefficient ring: the non-commutative analogue of PolynomialRing.
static auto createOverlapPoly(const FreeAlgebra &A, const PolyList &polyList, int polyIndex1, int polyIndex2, int overlapIndex) -> Poly *
const int * begin() const
Definition Word.hpp:72
const int * end() const
Definition Word.hpp:73
Non-owning view of a non-commutative word: [begin, end) of int variable indices.
Definition Word.hpp:56
volatile int x
const PolynomialRing * degreeRing(const std::vector< std::string > &names)

References Word::begin(), FreeAlgebra::create(), NCGroebner::createOverlapPoly(), degreeRing(), Word::end(), globalQQ, FreeAlgebra::lead_word(), FreeAlgebra::lead_word_prefix(), FreeAlgebra::lead_word_suffix(), FreeAlgebra::var(), and x.