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

◆ TEST() [4/19]

TEST ( FreeAlgebra ,
quotientArithmetic  )

Definition at line 371 of file NCGroebnerTest.cpp.

372{
374 { "x", "y", "z" },
375 degreeRing(1),
376 {1,2,3},
377 {},
378 {1}
379 );
380 FreeAlgebraElement X(Q), Y(Q), Z(Q), F(Q), G(Q), H(Q);
381 Q->var(*X,0);
382 Q->var(*Y,1);
383 Q->var(*Z,2);
384 F = X*Y + Y*X;
385 G = X*Z + Z*X;
386 H = Y*Z + Z*Y;
387
388 auto GB = std::unique_ptr<ConstPolyList> (new ConstPolyList);
389 //auto GB = new ConstPolyList;
390 GB->push_back(&*F);
391 GB->push_back(&*G);
392 GB->push_back(&*H);
393 EXPECT_TRUE(GB->size() == 3);
394
395 FreeAlgebraQuotient* A = new FreeAlgebraQuotient(*Q, *GB, -1); // are we transferring ownership of GB?
396
397 FreeAlgebraQuotientElement x(A), y(A), z(A), f(A), g(A), h(A);
398
399 // check if things reduce properly
400 A->var(*x,0);
401 A->var(*y,1);
402 A->var(*z,2);
403 A->setZero(*f);
404 A->setZero(*g);
405 A->setZero(*h);
406 f = x*y*x*z*x*y*x*z;
407 g = x*x*x*x*y*y*z*z;
408 A->negate(*h,*g);
409 EXPECT_TRUE(f == h);
410}
gc_vector< const Poly * > ConstPolyList
const RingQQ * globalQQ
Definition aring.cpp:24
void var(Poly &result, int v) 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)
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.
void setZero(Poly &f) const
void var(Poly &result, int v) const
void negate(Poly &result, const Poly &f) const
Owned Poly value paired with its FreeAlgebraQuotient*, providing operator-overloaded arithmetic for d...
Quotient of a FreeAlgebra by a Groebner basis up to a fixed degree bound.
volatile int x
tbb::flow::graph G
const PolynomialRing * degreeRing(const std::vector< std::string > &names)

References FreeAlgebra::create(), degreeRing(), G, globalQQ, FreeAlgebraQuotient::negate(), FreeAlgebraQuotient::setZero(), FreeAlgebra::var(), FreeAlgebraQuotient::var(), and x.