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

◆ TEST() [1/4]

TEST ( PolyRing ,
create1  )

Definition at line 75 of file PolyRingTest.cpp.

76{
77 // Creaating a polynomial ring from C++.
78 // Plan: this should be a simple constructor call!
79
80 // Create coefficient ring
81 const Ring* kk = rawARingZZpFlint(101); // or IM2_Ring_ZZ(), IM2_Ring_QQ(), and others...
82 EXPECT_TRUE(kk != nullptr);
83
84 // Now create the monomial order. This one is a pain in the butt!
85 std::vector<std::string> varnames { "a", "b", "c", "d" };
86 std::vector<int> degs {1,1,1,1};
87 std::vector<int> heft {1};
88
90 const Monoid* M = Monoid::create(
91 mo,
92 degreeRing(1),
93 varnames,
94 degs,
95 heft
96 );
97 EXPECT_TRUE(M != nullptr);
98
99 const Ring* R = PolyRing::create(kk, M);
100
101 EXPECT_TRUE(R != nullptr);
102 buffer o;
103 R->text_out(o);
104 std::cout << "ring is " << o.str() << std::endl;
105}
static Monoid * create(const MonomialOrdering *mo, const PolynomialRing *DR, const std::vector< std::string > &names, const std::vector< int > &degs, const std::vector< int > &hefts)
Definition monoid.cpp:61
Engine-side commutative monomial monoid: variable names, ordering, multidegree machinery,...
Definition monoid.hpp:89
static const PolyRing * create(const Ring *K, const Monoid *M)
Definition poly.cpp:101
virtual void text_out(buffer &o) const =0
xxx xxx xxx
Definition ring.hpp:102
char * str()
Definition buffer.hpp:72
const Ring * rawARingZZpFlint(unsigned long p)
Definition aring.cpp:51
MonomialOrdering * rawGRevLexMonomialOrdering(M2_arrayint degs, int packing)
Front-end-side description of a monomial ordering as a list of mon_part blocks.
const PolynomialRing * degreeRing(const std::vector< std::string > &names)
M2_arrayint stdvector_to_M2_arrayint(const std::vector< T > &v)
Definition util.hpp:79

References Monoid::create(), PolyRing::create(), degreeRing(), rawARingZZpFlint(), rawGRevLexMonomialOrdering(), stdvector_to_M2_arrayint(), buffer::str(), and Ring::text_out().