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

◆ remainder() [1/2]

void ReducedGB_ZZ::remainder ( gbvector *& f,
bool use_denom,
ring_elem & denom )
virtual

Implements ReducedGB.

Definition at line 193 of file reducedgb-ZZ.cpp.

194{
195 gbvector *zero = nullptr;
196 gbvector head;
197 gbvector *frem = &head;
198 (void) use_denom;
199 (void) denom;
200 frem->next = nullptr;
201 gbvector *h = f;
202 exponents_t EXP = ALLOCATE_EXPONENTS(R->exponent_byte_size());
203
204 gbvector *r;
205 POLY g;
206 while (!R->gbvector_is_zero(h))
207 {
208 int w;
209 R->gbvector_get_lead_exponents(F, h, EXP);
210 int x = h->comp;
211 enum divisor_type typ = find_divisor(EXP, x, w);
212 switch (typ)
213 {
214 case DIVISOR_RING:
215 r = const_cast<gbvector *>(originalR->quotient_gbvector(w));
216 if (R->gbvector_reduce_lead_term_ZZ(F, Fsyz, h, zero, r, zero))
217 continue;
218 break;
219 case DIVISOR_MODULE:
220 g = polys[w];
221 if (M2_gbTrace >= 4)
222 {
223 buffer o;
224 R->gbvector_text_out(o, F, h);
225 o << newline << " divisor " << w << " is ";
226 R->gbvector_text_out(o, F, g.f);
227 o << newline;
228 emit(o.str());
229 }
230 if (R->gbvector_reduce_lead_term_ZZ(F, Fsyz, h, zero, g.f, zero))
231 continue;
232 break;
233 case DIVISOR_NONE:
234 break;
235 }
236 frem->next = h;
237 frem = frem->next;
238 h = h->next;
239 frem->next = nullptr;
240 }
241 h = head.next;
242 f = h;
243}
exponents::Exponents exponents_t
enum divisor_type find_divisor(exponents_t exp, int comp, int &result_loc)
const FreeModule * Fsyz
Definition reducedgb.hpp:67
GBRing * R
Definition reducedgb.hpp:64
const PolynomialRing * originalR
Definition reducedgb.hpp:65
const FreeModule * F
Definition reducedgb.hpp:66
char * str()
Definition buffer.hpp:72
int zero
char newline[]
Definition m2-types.cpp:49
int M2_gbTrace
Definition m2-types.cpp:52
#define ALLOCATE_EXPONENTS(byte_len)
Definition monoid.hpp:62
volatile int x
#define POLY(q)
Definition poly.cpp:23
gbvector * f
Definition gbring.hpp:98
gbvector * next
Definition gbring.hpp:80
int comp
Definition gbring.hpp:82
void emit(const char *s)
Definition text-io.cpp:41

References ALLOCATE_EXPONENTS, gbvector::comp, DIVISOR_MODULE, DIVISOR_NONE, DIVISOR_RING, emit(), ReducedGB::F, POLY::f, find_divisor(), ReducedGB::Fsyz, M2_gbTrace, newline, gbvector::next, ReducedGB::originalR, POLY, ReducedGB::R, buffer::str(), x, and zero.