createF4Res The only function to create an (F4) resolution computation The constructor for this class is private. This function provides all of the logic, and throws an exception if there is a problem.
32{
33
34
35
36
37
38
39
40 (void) strategy;
41 const PolynomialRing* origR =
43 if (origR == nullptr)
44 {
45 ERROR(
"expected polynomial ring");
46 return nullptr;
47 }
49 {
50 ERROR(
"cannot use res(...,FastNonminimal=>true) for quotient rings");
51 return nullptr;
52 }
54 {
55 ERROR(
"cannot use res(...,FastNonminimal=>true) over Weyl algebras");
56 return nullptr;
57 }
59 {
61 "cannot use res(...,FastNonminimal=>true) over non-commutative "
62 "algebras");
63 return nullptr;
64 }
65
66
67
68
69
70
71
72
73
74
75
77 {
78 ERROR(
"expected the degree of each variable to be positive");
79 return nullptr;
80 }
81
82
83
91
95 motype);
96 ResPolyRing* R;
98 {
100 }
101 else
102 {
103 R =
new ResPolyRing(K, MI, origR->
getMonoid());
104 }
105 auto result =
new F4ResComputation(origR, R, groebnerBasisMatrix, max_level, numThreads, parallelizeByDegree);
106
107
108
109 const FreeModule* F = groebnerBasisMatrix->
rows();
110 int maxdeg = 0;
112 {
114 for (
int j = 1; j < F->
rank(); j++)
116 }
117
118
119
121 for (
int i = 0; i < F->
rank(); i++)
122 {
124 frame.monomialBlock().allocate(MI->max_monomial_size());
125 MI->one(i, elem);
127 }
129
130
132 M2_arrayint pos = leadterms->
sort(1 ,
133 -1 );
134
135 std::vector<ResPolynomial> input_polys;
136 for (
int i = 0; i < groebnerBasisMatrix->
n_cols(); i++)
137 {
138 ResPolynomial f;
140 input_polys.emplace_back(std::move(f));
141 }
142
143
144 for (
int j = 0; j < F->
rank(); j++)
145 {
146
147 for (int i = 0; i < pos->len; i++)
148 {
149 int loc = pos->array[i];
150 ResPolynomial& f = input_polys[loc];
151 if (f.
len == 0)
continue;
152 if (MI->get_component(f.
monoms.data()) != j)
continue;
154 frame.monomialBlock().allocate(MI->max_monomial_size());
155 MI->copy(f.
monoms.data(), elem);
156
157 if (!
frame.insertLevelOne(
159 {
161 "input polynomials/vectors were computed in a non-compatible "
162 "monomial order");
163
164 return nullptr;
165 }
166 }
167 }
169
170
171 delete leadterms;
172
174}
F4ResComputation(const PolynomialRing *origR, ResPolyRing *R, const Matrix *gbmatrix, int max_level, int numThreads, bool parallelizeByDegree)
int primary_degree(int i) const
const Ring * get_ring() const
ring_elem elem(int i, int j) const
const FreeModule * rows() const
Matrix * lead_term(int n=-1) const
M2_arrayint sort(int degorder, int monorder) const
const FreeModule * cols() const
bool primary_degrees_of_vars_positive() const
std::vector< int > getPrimaryDegreeVector() const
const MonomialOrdering * getMonomialOrdering() const
std::vector< int > getFirstWeightVector() const
virtual bool is_solvable_algebra() const
virtual const Monoid * getMonoid() const
bool is_quotient_ring() const
virtual const Ring * getCoefficients() const
virtual bool is_weyl_algebra() const
const SkewMultiplication & getSkewInfo() const
bool is_skew_commutative() const
static void from_M2_vec(const ResPolyRing &R, const FreeModule *F, vec v, ResPolynomial &result)
std::vector< res_monomial_word > monoms
virtual const PolynomialRing * cast_to_PolynomialRing() const
VALGRIND_MAKE_MEM_DEFINED & result(result)
int moIsLex(const MonomialOrdering *mo)
int moIsGRevLex(const MonomialOrdering *mo)
res_monomial_word * res_packed_monomial