Macaulay2 Engine
Loading...
Searching...
No Matches
gbring.hpp
Go to the documentation of this file.
1#ifndef __gbring_hpp_
2#define __gbring_hpp_
3
38
39// Problems to solve:
40// a. F,Fsyz
41// b. hide Schreyer order completely
42// c. Make sure enough is here to do gbZZ
43// d. ditto for GB.c
44// e. heap: needs to be able to handle F,Fsyz both
45// and needs to be able to handle multiplication by a constant
46//
47// Schreyer order: probably don't keep polynomials in this form?
48// or in any case we should be able to change the representation easily
49// In any case, it seems like there could have been bugs before...
50//
51// Implementations of GBRing:
52// Schreyer encoded, Schreyer order, no Schreyer
53// KK or ZZ
54// [polyring,skew,weyl,solvable]
55// quotient ideal
56
57#include <M2/math-include.h>
58#include "engine-includes.hpp"
59
60#include <iostream>
61#include <string>
62
63#include "buffer.hpp"
64#include "monoid.hpp"
65#include "newdelete.hpp"
66#include "ringelem.hpp"
67#include "skew.hpp"
68#include "style.hpp"
69
71class FreeModule;
72class Ring;
73class SolvableAlgebra;
74class WeylAlgebra;
75class gbvectorHeap;
76class stash;
77
79{
82 int comp;
83 int monom[1];
84};
85
96struct POLY
97{
100};
101
102typedef int *monomial;
103
119class GBRing : public our_new_delete
120{
122 friend class WeylAlgebra;
123 friend class SkewPolynomialRing;
124
125 // The FreeModule is used for the following:
126 // (a) degree of an element
127 // (b) monomial order comparing monomials with different lead components
128 // (c) Schreyer monomials, if any.
129 // Using the original free module doesn't quite work for Schreyer orders,
130 // unless we 'flatten' the Schreyer monomials, AND if we have a flag
131 // for the monomial order...
132 // If not Schreyer order, then
133 // i. WHEN order is considered
134 // ii. is it UP or DOWN
135 protected:
137 const Monoid *M; // flattened monoid
138 const Ring *K; // flattened coefficients
139
140 bool _coeffs_ZZ; // is K == globalZZ?
141 CoefficientRingZZp *zzp; // Only set to non-null if coeff ring is ZZ/p
142
145
147
148 bool _up_order; // is the free module order up or down?
149
152 int *const
153 *_skew_monoms; // array 0.._skew.n_skew_vars()-1 of elements of monoid
154
155 // Weyl algebra information
156 // Private data goes into the subclass
157 bool is_weyl; // true if this is either a Weyl or homog Weyl algebra
159
162
163 protected:
165
167 // Pre-allocated values //
169 size_t exp_size; // byte size of exponent vectors
170 size_t monom_size; // and monomials
171
173 // Private support routines //
178 void divide_exponents(const int *exp1, const int *exp2, int *result) const;
179 // result = exp1 - exp2; No error checking is done.
180
181 void exponent_syzygy(const int *exp1, const int *exp2, int *exp3, int *exp4);
182
184 const gbvector *f,
185 ring_elem u,
186 const int *monom,
187 int comp) = 0;
188
190 const gbvector *f,
191 ring_elem u,
192 const int *monom,
193 int comp);
194
195 int skew_mult_sign(int *exp1, int *exp2) const;
196 // returns -1 if exp1 * exp2 = - sort(exp1,exp2).
197 // returns 0 if exp1, exp2 are not disjoint for skew comm variables
198 // returns 1 if exp1 * exp2 = sort(exp1,exp2).
199
200 void divide_coeff_exact_to_ZZ(gbvector *f, gmp_ZZ u) const;
201
202 void lower_content_ZZ(gbvector *f, mpz_ptr content) const;
203
205 gbvector *fsyz,
206 bool use_denom,
207 ring_elem &denom) const;
208
209 const gbvector *find_coeff(const FreeModule *F,
210 const gbvector *f,
211 const gbvector *g) const;
212
213 GBRing(const Ring *K0, const Monoid *M0);
214
215 public:
216 // Each of these handles quotients as well
217 static GBRing *create_PolynomialRing(const Ring *K, const Monoid *M);
218 static GBRing *create_SkewPolynomialRing(const Ring *K0,
219 const Monoid *M0,
220 SkewMultiplication skew0);
221 static GBRing *create_WeylAlgebra(const Ring *K0,
222 const Monoid *M0,
223 const WeylAlgebra *W0);
224 static GBRing *create_SolvableAlgebra(const Ring *K0,
225 const Monoid *M0,
226 const SolvableAlgebra *R);
227
228 virtual ~GBRing();
229
230 const Monoid *get_flattened_monoid() const { return M; }
231 const Ring *get_flattened_coefficients() const { return K; }
232 int n_vars() const { return _nvars; }
233 void memstats();
234
236 // Ring information //
238
239 // skew commutativity
240 bool is_skew_commutative() const { return _skew.n_skew_vars() > 0; }
241 int n_skew_commutative_vars() const { return _skew.n_skew_vars(); }
242 int skew_variable(int i) const { return _skew.skew_variable(i); }
243 const int *skew_monomial_var(int i) const { return _skew_monoms[i]; }
244 // Weyl algebra
245 bool is_weyl_algebra() const { return is_weyl; }
246 // returns true if this is a Weyl algebra OR a homog Weyl algebra
247
248 // Schreyer order information
249 bool is_schreyer_encoded() const { return _schreyer_encoded; }
251 // exponents support //
253
255
257
258 size_t exponent_byte_size() const { return exp_size; }
259 // use ALLOCATE_EXPONENTS(R->exponent_byte_size())
260 // to allocate on the stack an uninitialized exponent vector (#ints = nvars+2)
261 // it will be deallocated at the end of that function
262
264 // gbvector support //
266
267 const ring_elem one() { return _one; } // the element '1' in the base K.
268 void gbvector_remove(gbvector *f);
269
270 gbvector *gbvector_raw_term(ring_elem coeff, const int *monom, int comp);
271 // Returns coeff*monom*e_sub_i in a free module. If the order is a Schreyer
272 // order, the 'monom' should already be encoded.
273
274 gbvector *gbvector_term(const FreeModule *F, ring_elem coeff, int comp);
275 // Returns coeff*e_sub_i in F, the monomial is set to 1.
276 // If comp==0, F is never considered (so it can be NULL)
277
279 ring_elem coeff,
280 const int *monom,
281 int comp);
282 // Returns coeff*mon*e_comp in F. If comp==0, F is never considered (so it
283 // can be NULL)
284
286 ring_elem coeff,
287 const int *exp,
288 int comp);
289 // Returns coeff*exp*e_sub_i in F, where exp is an exponent vector.
290 // If comp==0, F is never considered (so it can be NULL)
291
292 gbvector *gbvector_zero() const { return nullptr; }
293 void gbvector_sort(const FreeModule *F,
294 gbvector *&f); // TO BE USED CAREFULLY: gbvector's should
295 // mostly be kept in monomial order. This is here when the construction
296 // doesn't satisfy this property.
297
298 bool gbvector_is_zero(const gbvector *f) const { return f == nullptr; }
299 bool gbvector_is_equal(const gbvector *f, const gbvector *g) const;
300 // f,g can be both be in F, or both in Fsyz
301
302 int gbvector_n_terms(const gbvector *f) const;
303
304#if 0
305// // Degrees, using the weight vector _degrees.
306// int exponents_weight(const int *e) const;
307//
308// int gbvector_term_weight(const FreeModule *F,
309// const gbvector *f);
310//
311// void gbvector_weight(const FreeModule *F, const gbvector *f,
312// int &result_lead,
313// int &result_lo,
314// int &result_hi);
315//
316// int gbvector_degree(const FreeModule *F,
317// const gbvector *f);
318#endif
319
320 void gbvector_multidegree(const FreeModule *F,
321 const gbvector *f,
322 int *&result_degree);
323 // Places the multidegree of the first term of the non-zero poly f into
324 // result_degree.
325
326 int gbvector_compare(const FreeModule *F,
327 const gbvector *f,
328 const gbvector *g) const;
329
330 gbvector *gbvector_lead_term(int n, const FreeModule *F, const gbvector *f);
331
333 const FreeModule *F,
334 const gbvector *leadv,
335 const gbvector *v);
336
338 const gbvector *f,
339 int *result);
340 // This copies the monomial to result. If a Schreyer order,
341 // the result will NOT be the total monomial.
342
344 const gbvector *f,
345 int *result);
346 // result[0]..result[nvars-1] are set
347
348 int gbvector_lead_component(const gbvector *f) { return f->comp; }
350 // We assume that u is non-zero, and that for each coeff c of f, u*c is
351 // non-zero
352
354 // We assume that u is non-zero, and that for each coeff c of f, u*c is
355 // non-zero
356
357 void gbvector_add_to_zzp(const FreeModule *F, gbvector *&f, gbvector *&g);
358
359 void gbvector_add_to(const FreeModule *F, gbvector *&f, gbvector *&g);
360
361 void gbvector_negate_to(gbvector *f) const;
362
364
366 // Arithmetic //
368 void find_reduction_coeffs(const FreeModule *F,
369 const gbvector *f,
370 const gbvector *g,
371 ring_elem &u,
372 ring_elem &v);
374 const gbvector *f,
375 const gbvector *g,
376 ring_elem &v);
378 const gbvector *f,
379 const gbvector *g,
380 int &comp,
381 int *&monom); // there must be enough space here
382
383 void gbvector_mult_by_term(const FreeModule *F,
384 const FreeModule *Fsyz,
385 ring_elem a,
386 const int *m, // element of M, a monomial
387 const gbvector *f,
388 const gbvector *fsyz,
390 gbvector *&esult_syz);
391 // Optionally, this reduces wrt to the defining ideal:
392 // result_syz (possibly multiplying result by a constant)
393 // or bith result,result_syz.
394 // If over a quotient ring, this might reduce result_syz wrt
395 // to the quotient ideal. This might multiply result by a scalar.
396
398 const FreeModule *Fsyz,
399 gbvector *flead,
400 gbvector *&f,
401 gbvector *&fsyz,
402 const gbvector *g,
403 const gbvector *gsyz,
404 bool use_denom,
405 ring_elem &denom);
406 // Reduce f wrt g, where leadmonom(g) divides leadmonom(f)
407 // If u leadmonom(f) = v x^A leadmonom(g) (as monomials, ignoring lower
408 // terms),
409 // then: flead := u * flead
410 // f := u*f - v*x^A*g
411 // fsyz := u*fsyz - v*x^A*gsyz
412 // If use_denom is true, then
413 // denom is set to u*denom.
414
416 const FreeModule *Fsyz,
417 gbvector *flead,
418 gbvector *&f,
419 gbvector *&fsyz,
420 const gbvector *g,
421 const gbvector *gsyz);
422 // Same as calling gbvector_reduce_lead_term with use_denom=false.
423
425 const FreeModule *Fsyz,
426 gbvector *flead,
427 gbvector *&f,
428 gbvector *&fsyz,
429 const gbvector *ginitial,
430 const gbvector *g,
431 const gbvector *gsyz,
432 bool use_denom,
433 ring_elem &denom);
434
436 const FreeModule *Fsyz,
437 gbvector *&f,
438 gbvector *&fsyz,
439 const gbvector *g,
440 const gbvector *gsyz);
441 // Never multiplies f by anything. IE before(f), after(f) are equiv. mod g.
442 // this should ONLY be used if K is globalZZ.
443 // Sets f := f - v*m*g, where the resulting lead coeff of in(before(f)) is
444 // either 0
445 // or is the balanced remainder of leadcoeff(f) by leadcoeff(g).
446 // Returns true iff this remainder is 0.
447
449 const FreeModule *Fsyz,
450 const gbvector *f,
451 const gbvector *fsyz,
452 const gbvector *g,
453 const gbvector *gsyz,
455 gbvector *&result_syz);
456
458 const FreeModule *Fsyz,
459 gbvector *&f,
460 gbvector *&fsyz,
461 gbvector *&g,
462 gbvector *&gsyz);
463
465 const FreeModule *Fsyz,
466 const gbvector *f,
467 const gbvector *fsyz,
468 const gbvector *g,
469 const gbvector *gsyz,
471 gbvector *&result_syz);
472 // If u*x^A*leadmonom(f) + v*x^B*leadmonom(g) = gcd(u,v)*monom (mod lower
473 // terms),
474 // set result := u*x^A*f + v*x^B*g
475 // resultsyz := u*x^A*fsyz + v*x^B*gyz
476 // To keep in mind:
477 // (a) Schreyer orders
478 // (b) Quotient ideal
479 // Currently: this does nothing with the quotient ring
480
482 const FreeModule *F,
483 const FreeModule *Fsyz,
484 const gbvector *fcurrent_lead,
485 const_exponents exp, // exponents of fcurrent_lead
486 gbvector *flead,
487 gbvectorHeap &f,
488 gbvectorHeap &fsyz,
489 const gbvector *g,
490 const gbvector *gsyz);
491
493 const FreeModule *F,
494 const FreeModule *Fsyz,
495 const gbvector *fcurrent_lead,
496 const_exponents exp, // exponents of fcurrent_lead
497 gbvector *flead,
498 gbvectorHeap &f,
499 gbvectorHeap &fsyz,
500 const gbvector *marked_in_g,
501 const gbvector *g,
502 const gbvector *gsyz);
503
505 gbvector *fsyz,
506 bool use_denom,
507 ring_elem &denom);
508
509 // if c = content(f,fsyz), then
510 // f = f//c
511 // fsyz = fsyz//c
512 // denom = denom*c
513 // CAUTION: denom needs to be a valid element of the
514 // coefficient ring.
515 // If coeff ring is not ZZ, but is a field, c is chosen so that
516 // f is monic (if not 0, else fsyz will be monic).
517
519 // Same as calling gbvector_remove_content with use_denom=false.
520
521 void gbvector_auto_reduce(const FreeModule *F,
522 const FreeModule *Fsyz,
523 gbvector *&f,
524 gbvector *&fsyz,
525 const gbvector *g,
526 const gbvector *gsyz);
527
529 const FreeModule *Fsyz,
530 gbvector *&f,
531 gbvector *&fsyz,
532 const gbvector *g,
533 const gbvector *gsyz);
534 // If g = a*x^A*ei + lower terms
535 // and if f = ... + b*x^A*ei + ...
536 // and if v*a + b is the balanced remainder of b by a
537 // then set f := f + v*g, fsyz := fsyz + v*gsyz
538 // No content is removed.
539
541 const FreeModule *F,
542 const gbvector *f,
543 int nterms = -1) const;
544
545 void gbvector_apply(const FreeModule *F,
546 const FreeModule *Fsyz,
547 gbvector *&f,
548 gbvector *&fsyz,
549 const gbvector *gsyz,
550 const gbvector **elems,
551 const gbvector **elems_syz,
552 const gbvector **quotients);
553 // gsyz is allowed to have negative elements. These refer to
554 // quotient ring elements. In this case, the component that
555 // is used is the lead component of f. (i.e. this is designed for
556 // cancelling lead terms).
557 // [combines: freemod::apply_quotient_ring_elements,
558 // GBZZ_comp::apply_gb_elements]
559};
560
571class GBRingPoly : public GBRing
572{
573 protected:
574 friend class GBRing;
575 GBRingPoly(const Ring *K0, const Monoid *M0) : GBRing(K0, M0) {}
576 public:
577 virtual gbvector *mult_by_term1(const FreeModule *F,
578 const gbvector *f,
579 ring_elem u,
580 const int *monom,
581 int comp);
582 virtual ~GBRingPoly();
583};
584
595class GBRingWeyl : public GBRing
596{
597 protected:
598 friend class GBRing;
599 GBRingWeyl(const Ring *K0, const Monoid *M0, const WeylAlgebra *R0);
600
601 public:
602 virtual gbvector *mult_by_term1(const FreeModule *F,
603 const gbvector *f,
604 ring_elem u,
605 const int *monom,
606 int comp);
607 virtual ~GBRingWeyl();
608};
609
620{
621 protected:
622 friend class GBRing;
623 GBRingWeylZZ(const Ring *K0, const Monoid *M0, const WeylAlgebra *R0);
624
625 public:
626 virtual gbvector *mult_by_term1(const FreeModule *F,
627 const gbvector *f,
628 ring_elem u,
629 const int *monom,
630 int comp);
631 virtual ~GBRingWeylZZ();
632};
633
644class GBRingSkew : public GBRing
645{
646 protected:
647 friend class GBRing;
648 GBRingSkew(const Ring *K0, const Monoid *M0, SkewMultiplication skew0);
649
650 public:
651 virtual gbvector *mult_by_term1(const FreeModule *F,
652 const gbvector *f,
653 ring_elem u,
654 const int *monom,
655 int comp);
656 virtual ~GBRingSkew();
657};
658
670class GBRingSolvable : public GBRing
671{
672 protected:
673 friend class GBRing;
674 GBRingSolvable(const Ring *K0, const Monoid *M0, const SolvableAlgebra *R0);
675
676 public:
677 virtual gbvector *mult_by_term1(const FreeModule *F,
678 const gbvector *f,
679 ring_elem u,
680 const int *monom,
681 int comp);
682 virtual ~GBRingSolvable();
683};
684
686// Heap routines //
689{
691 const FreeModule *F;
692 const Ring *K; // The coefficient ring
696 int mLead; // set after a call to get_lead_term.
697 // set negative after each call to add,
698 // or remove_lead_term
699 public:
702
703 GBRing *get_gb_ring() { return GR; }
704 const FreeModule *get_freemodule() { return F; }
705 void add(gbvector *p);
706 void mult_by_coeff(ring_elem a);
707
708 const gbvector *get_lead_term(); // Returns NULL if none.
709 gbvector *remove_lead_term(); // Returns NULL if none.
710
711 gbvector *value();
712 // Returns the linearized value, and resets the gbvectorHeap.
713
714 gbvector *debug_list(int i) { return heap[i]; }
715 // DO NOT USE, except for debugging purposes!
716
717 gbvector *current_value() const;
718 // Adds up all the elements and returns this value
719 // Mainly used for debugging.
720
721 void show() const;
722 // Displays the current values at each part of the heap
723 // to stdout
724};
725
726template <typename container, typename fcn>
727// void displayElements(GBRing* R, const FreeModule* F, iter a, iter b, fcn f)
728void displayElements(std::string header, GBRing *R, container a, fcn f)
729{
730 std::cout << header << std::endl;
731 long count = 0;
732 // for (auto c = a; c != b; ++c)
733 for (auto c : a)
734 {
735 buffer o;
736 const gbvector *g = f(c);
737 o << "[" << count << "] = ";
738 R->gbvector_text_out(o, nullptr, g, 3);
739 o << newline;
740 std::cout << o.str();
741 ++count;
742 }
743}
744
745#endif
746
747// Local Variables:
748// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
749// indent-tabs-mode: nil
750// End:
exponents::ConstExponents const_exponents
exponents::Exponents exponents_t
Append-only GC-backed byte buffer used throughout the engine for text output.
Discrete-log Z/p adapter that represents non-zero residues by their exponent index relative to a gene...
Engine-side free module R^n over a Ring.
Definition freemod.hpp:66
bool is_schreyer_encoded() const
Definition gbring.hpp:249
void gbvector_mult_by_coeff_to(gbvector *f, ring_elem u)
Definition gbring.cpp:557
CoefficientRingZZp * zzp
Definition gbring.hpp:141
static GBRing * create_WeylAlgebra(const Ring *K0, const Monoid *M0, const WeylAlgebra *W0)
Definition gbring.cpp:208
void exponents_delete(exponents_t e)
Definition gbring.cpp:44
gbvector * gbvector_copy(const gbvector *f)
Definition gbring.cpp:581
friend class WeylAlgebra
Definition gbring.hpp:122
const WeylAlgebra * weyl
Definition gbring.hpp:158
static GBRing * create_SkewPolynomialRing(const Ring *K0, const Monoid *M0, SkewMultiplication skew0)
Definition gbring.cpp:147
gbvector * mult_by_term(const FreeModule *F, const gbvector *f, ring_elem u, const int *monom, int comp)
Definition gbring.cpp:839
bool gbvector_reduce_lead_term_ZZ(const FreeModule *F, const FreeModule *Fsyz, gbvector *&f, gbvector *&fsyz, const gbvector *g, const gbvector *gsyz)
Definition gbring.cpp:1027
void gbvector_remove(gbvector *f)
Definition gbring.cpp:288
stash * mem
Definition gbring.hpp:144
int skew_variable(int i) const
Definition gbring.hpp:242
static GBRing * create_PolynomialRing(const Ring *K, const Monoid *M)
Definition gbring.cpp:93
ring_elem _one
Definition gbring.hpp:164
void gbvector_remove_content_ZZ(gbvector *f, gbvector *fsyz, bool use_denom, ring_elem &denom) const
Definition gbring.cpp:1315
bool is_weyl
Definition gbring.hpp:157
bool is_skew_commutative() const
Definition gbring.hpp:240
bool _schreyer_encoded
Definition gbring.hpp:136
bool _coeffs_ZZ
Definition gbring.hpp:140
void gbvector_get_lead_monomial(const FreeModule *F, const gbvector *f, int *result)
Definition gbring.cpp:528
void gbvector_add_to_zzp(const FreeModule *F, gbvector *&f, gbvector *&g)
Definition gbring.cpp:590
size_t monom_size
Definition gbring.hpp:170
bool gbvector_is_equal(const gbvector *f, const gbvector *g) const
Definition gbring.cpp:376
void gbvector_text_out(buffer &o, const FreeModule *F, const gbvector *f, int nterms=-1) const
Definition gbring.cpp:779
GBRing(const Ring *K0, const Monoid *M0)
Definition gbring.cpp:55
bool _is_skew
Definition gbring.hpp:150
int gbvector_lead_component(const gbvector *f)
Definition gbring.hpp:348
void divide_exponents(const int *exp1, const int *exp2, int *result) const
Definition gbring.cpp:807
const SolvableAlgebra * solvable
Definition gbring.hpp:161
size_t exp_size
Definition gbring.hpp:169
const int * skew_monomial_var(int i) const
Definition gbring.hpp:243
int skew_mult_sign(int *exp1, int *exp2) const
void gbvector_cancel_lead_terms(const FreeModule *F, const FreeModule *Fsyz, const gbvector *f, const gbvector *fsyz, const gbvector *g, const gbvector *gsyz, gbvector *&result, gbvector *&result_syz)
Definition gbring.cpp:1056
gbvector * gbvector_parallel_lead_terms(M2_arrayint w, const FreeModule *F, const gbvector *leadv, const gbvector *v)
Definition gbring.cpp:495
void reduce_marked_lead_term_heap(const FreeModule *F, const FreeModule *Fsyz, const gbvector *fcurrent_lead, const_exponents exp, gbvector *flead, gbvectorHeap &f, gbvectorHeap &fsyz, const gbvector *marked_in_g, const gbvector *g, const gbvector *gsyz)
Definition gbring.cpp:1640
bool gbvector_is_zero(const gbvector *f) const
Definition gbring.hpp:298
friend class SkewPolynomialRing
Definition gbring.hpp:123
void gbvector_mult_by_term(const FreeModule *F, const FreeModule *Fsyz, ring_elem a, const int *m, const gbvector *f, const gbvector *fsyz, gbvector *&result, gbvector *&esult_syz)
Definition gbring.cpp:855
int n_skew_commutative_vars() const
Definition gbring.hpp:241
friend class GBKernelComputation
Definition gbring.hpp:121
bool is_solvable
Definition gbring.hpp:160
size_t exponent_byte_size() const
Definition gbring.hpp:258
bool is_weyl_algebra() const
Definition gbring.hpp:245
gbvector * gbvector_term(const FreeModule *F, ring_elem coeff, int comp)
Definition gbring.cpp:300
SkewMultiplication _skew
Definition gbring.hpp:151
int _nvars
Definition gbring.hpp:146
gbvector * gbvector_raw_term(ring_elem coeff, const int *monom, int comp)
Definition gbring.cpp:316
void find_reduction_monomial(const FreeModule *F, const gbvector *f, const gbvector *g, int &comp, int *&monom)
Definition gbring.cpp:922
const Ring * get_flattened_coefficients() const
Definition gbring.hpp:231
void reduce_lead_term_heap(const FreeModule *F, const FreeModule *Fsyz, const gbvector *fcurrent_lead, const_exponents exp, gbvector *flead, gbvectorHeap &f, gbvectorHeap &fsyz, const gbvector *g, const gbvector *gsyz)
Definition gbring.cpp:1678
void gbvector_replace_2by2_ZZ(const FreeModule *F, const FreeModule *Fsyz, gbvector *&f, gbvector *&fsyz, gbvector *&g, gbvector *&gsyz)
Definition gbring.cpp:1114
void gbvector_remove_content(gbvector *f, gbvector *fsyz, bool use_denom, ring_elem &denom)
Definition gbring.cpp:1369
void find_reduction_coeffs(const FreeModule *F, const gbvector *f, const gbvector *g, ring_elem &u, ring_elem &v)
Definition gbring.cpp:872
void gbvector_combine_lead_terms_ZZ(const FreeModule *F, const FreeModule *Fsyz, const gbvector *f, const gbvector *fsyz, const gbvector *g, const gbvector *gsyz, gbvector *&result, gbvector *&result_syz)
Definition gbring.cpp:1174
const Monoid * get_flattened_monoid() const
Definition gbring.hpp:230
const Monoid * M
Definition gbring.hpp:137
gbvector * new_raw_term()
Definition gbring.cpp:28
gbvector * gbvector_lead_term(int n, const FreeModule *F, const gbvector *f)
Definition gbring.cpp:440
virtual ~GBRing()
Definition gbring.cpp:46
void memstats()
Definition gbring.cpp:21
void gbvector_reduce_with_marked_lead_term(const FreeModule *F, const FreeModule *Fsyz, gbvector *flead, gbvector *&f, gbvector *&fsyz, const gbvector *ginitial, const gbvector *g, const gbvector *gsyz, bool use_denom, ring_elem &denom)
Definition gbring.cpp:979
void lower_content_ZZ(gbvector *f, mpz_ptr content) const
Definition gbring.cpp:1303
void gbvector_negate_to(gbvector *f) const
Definition gbring.cpp:562
int gbvector_compare(const FreeModule *F, const gbvector *f, const gbvector *g) const
Definition gbring.cpp:413
const Ring * K
Definition gbring.hpp:138
static GBRing * create_SolvableAlgebra(const Ring *K0, const Monoid *M0, const SolvableAlgebra *R)
Definition gbring.cpp:250
void gbvector_add_to(const FreeModule *F, gbvector *&f, gbvector *&g)
Definition gbring.cpp:668
void gbvector_auto_reduce(const FreeModule *F, const FreeModule *Fsyz, gbvector *&f, gbvector *&fsyz, const gbvector *g, const gbvector *gsyz)
Definition gbring.cpp:1428
const gbvector * find_coeff(const FreeModule *F, const gbvector *f, const gbvector *g) const
Definition gbring.cpp:1409
bool _up_order
Definition gbring.hpp:148
gbvector * gbvector_copy_term(const gbvector *t)
Definition gbring.cpp:366
void gbvector_sort(const FreeModule *F, gbvector *&f)
Definition gbring.cpp:750
size_t gbvector_size
Definition gbring.hpp:143
int n_vars() const
Definition gbring.hpp:232
void gbvector_apply(const FreeModule *F, const FreeModule *Fsyz, gbvector *&f, gbvector *&fsyz, const gbvector *gsyz, const gbvector **elems, const gbvector **elems_syz, const gbvector **quotients)
Definition gbring.cpp:1251
void gbvector_multidegree(const FreeModule *F, const gbvector *f, int *&result_degree)
Definition gbring.cpp:399
void gbvector_auto_reduce_ZZ(const FreeModule *F, const FreeModule *Fsyz, gbvector *&f, gbvector *&fsyz, const gbvector *g, const gbvector *gsyz)
Definition gbring.cpp:1467
gbvector * gbvector_zero() const
Definition gbring.hpp:292
void gbvector_remove_term(gbvector *f)
Definition gbring.cpp:279
void gbvector_get_lead_exponents(const FreeModule *F, const gbvector *f, int *result)
Definition gbring.cpp:541
void exponent_syzygy(const int *exp1, const int *exp2, int *exp3, int *exp4)
Definition gbring.cpp:814
exponents_t exponents_make()
Definition gbring.cpp:38
gbvector * gbvector_term_exponents(const FreeModule *F, ring_elem coeff, const int *exp, int comp)
Definition gbring.cpp:345
void divide_coeff_exact_to_ZZ(gbvector *f, gmp_ZZ u) const
Definition gbring.cpp:1291
int gbvector_n_terms(const gbvector *f) const
Definition gbring.cpp:392
const ring_elem one()
Definition gbring.hpp:267
bool find_reduction_coeffs_ZZ(const FreeModule *F, const gbvector *f, const gbvector *g, ring_elem &v)
Definition gbring.cpp:894
void gbvector_reduce_lead_term(const FreeModule *F, const FreeModule *Fsyz, gbvector *flead, gbvector *&f, gbvector *&fsyz, const gbvector *g, const gbvector *gsyz, bool use_denom, ring_elem &denom)
Definition gbring.cpp:944
int *const * _skew_monoms
Definition gbring.hpp:153
virtual gbvector * mult_by_term1(const FreeModule *F, const gbvector *f, ring_elem u, const int *monom, int comp)=0
gbvector * gbvector_mult_by_coeff(const gbvector *f, ring_elem u)
Definition gbring.cpp:567
Polynomial-ring view tuned for the inner loop of classical Buchberger Groebner-basis computations.
Definition gbring.hpp:120
GBRingPoly(const Ring *K0, const Monoid *M0)
Definition gbring.hpp:575
virtual gbvector * mult_by_term1(const FreeModule *F, const gbvector *f, ring_elem u, const int *monom, int comp)
Definition gbring.cpp:98
virtual ~GBRingPoly()
Definition gbring.cpp:50
friend class GBRing
Definition gbring.hpp:574
virtual ~GBRingSkew()
Definition gbring.cpp:53
GBRingSkew(const Ring *K0, const Monoid *M0, SkewMultiplication skew0)
Definition gbring.cpp:128
virtual gbvector * mult_by_term1(const FreeModule *F, const gbvector *f, ring_elem u, const int *monom, int comp)
Definition gbring.cpp:154
friend class GBRing
Definition gbring.hpp:647
GBRingSolvable(const Ring *K0, const Monoid *M0, const SolvableAlgebra *R0)
Definition gbring.cpp:241
virtual gbvector * mult_by_term1(const FreeModule *F, const gbvector *f, ring_elem u, const int *monom, int comp)
Definition gbring.cpp:257
friend class GBRing
Definition gbring.hpp:673
virtual ~GBRingSolvable()
Definition gbring.cpp:54
virtual ~GBRingWeyl()
Definition gbring.cpp:51
GBRingWeyl(const Ring *K0, const Monoid *M0, const WeylAlgebra *R0)
Definition gbring.cpp:192
friend class GBRing
Definition gbring.hpp:598
virtual gbvector * mult_by_term1(const FreeModule *F, const gbvector *f, ring_elem u, const int *monom, int comp)
Definition gbring.cpp:216
virtual ~GBRingWeylZZ()
Definition gbring.cpp:52
GBRingWeylZZ(const Ring *K0, const Monoid *M0, const WeylAlgebra *R0)
Definition gbring.cpp:199
virtual gbvector * mult_by_term1(const FreeModule *F, const gbvector *f, ring_elem u, const int *monom, int comp)
Definition gbring.cpp:227
friend class GBRing
Definition gbring.hpp:622
Engine-side commutative monomial monoid: variable names, ordering, multidegree machinery,...
Definition monoid.hpp:89
xxx xxx xxx
Definition ring.hpp:102
Sign-rule helper used by every ring that has a skew-commutative subset of variables (exterior factor,...
Definition skew.hpp:54
PolyRing subclass for solvable polynomial algebras (PBW-type non-commutative rings where each pair of...
Definition solvable.hpp:57
PolyRing subclass for Weyl algebras: polynomial rings with the [d_i, x_i] = 1 derivative-variable com...
Definition weylalg.hpp:61
char * str()
Definition buffer.hpp:72
void show() const
Definition gbring.cpp:1629
gbvector * heap[GEOHEAP_SIZE]
Definition gbring.hpp:693
gbvector * remove_lead_term()
Definition gbring.cpp:1592
const FreeModule * get_freemodule()
Definition gbring.hpp:704
GBRing * get_gb_ring()
Definition gbring.hpp:703
const Ring * K
Definition gbring.hpp:692
gbvector * value()
Definition gbring.cpp:1603
ring_elem heap_coeff[GEOHEAP_SIZE]
Definition gbring.hpp:694
const FreeModule * F
Definition gbring.hpp:691
int top_of_heap
Definition gbring.hpp:695
void add(gbvector *p)
Definition gbring.cpp:1532
gbvector * current_value() const
Definition gbring.cpp:1616
gbvectorHeap(GBRing *GR, const FreeModule *F)
Definition gbring.cpp:1507
const gbvector * get_lead_term()
Definition gbring.cpp:1551
GBRing * GR
Definition gbring.hpp:690
gbvector * debug_list(int i)
Definition gbring.hpp:714
void mult_by_coeff(ring_elem a)
Definition gbring.cpp:1526
Definition mem.hpp:78
Engine-wide include prelude — a single point of truth for portability shims.
#define monomial
Definition gb-toric.cpp:11
void displayElements(std::string header, GBRing *R, container a, fcn f)
Definition gbring.hpp:728
int p
VALGRIND_MAKE_MEM_DEFINED & result(result)
char newline[]
Definition m2-types.cpp:49
mpz_srcptr gmp_ZZ
Definition m2-types.h:141
Monoid — variable count, naming, grading, and monomial order of a polynomial ring.
our_new_delete — per-class opt-in routing of new / delete through bdwgc.
ring_elem — the universal value type carried by every Ring* in the engine.
SkewMultiplication — configuration object naming the skew-commuting variables of a ring.
gbvector * fsyz
Definition gbring.hpp:99
gbvector * f
Definition gbring.hpp:98
Pairs a gbvector with its evolving syzygy gbvector.
Definition gbring.hpp:97
ring_elem coeff
Definition gbring.hpp:81
gbvector * next
Definition gbring.hpp:80
int monom[1]
Definition gbring.hpp:83
int comp
Definition gbring.hpp:82
#define GEOHEAP_SIZE
Definition style.hpp:46
Engine-wide stylistic constants: LT / EQ / GT codes, INTSIZE, GEOHEAP_SIZE.