613{
615 gc_vector<int> vp;
616 gc_vector<int> thisvp;
617
619
621 {
622 buffer o;
623 o <<
"Computing pairs with first = " <<
p->me <<
newline;
625 }
626 M->divide(
p->base_monom,
p->first->base_monom, PAIRS_mon);
627 M->to_varpower(PAIRS_mon, vp);
628
629
630
631
632 if (
P->is_skew_commutative())
633 {
636
637 int nskew =
P->n_skew_commutative_vars();
638 for (int v = 0; v < nskew; v++)
639 {
640 int w =
P->skew_variable(v);
641 if (exp[w] > 0)
642 {
643 thisvp.resize(0);
645 Bag *b =
new Bag(
static_cast<void *
>(
nullptr), thisvp);
646 elems.push_back(b);
647 }
648 }
650 }
651
652
653
654 if (
P->is_quotient_ring())
655 {
656 const MonomialIdeal *Rideal =
P->get_quotient_monomials();
657 for (
Bag& a : *Rideal)
658 {
659
660
661
662 thisvp.resize(0);
665 continue;
666 Bag *b =
new Bag(
static_cast<void *
>(
nullptr), thisvp);
667 elems.push_back(b);
668 }
669 }
670
671
672
673 MonomialIdeal *mi_orig =
p->first->mi;
674 for (
Bag& a : *mi_orig)
675 {
676 Bag *b =
new Bag(a.basis_ptr());
678 elems.push_back(b);
679 }
680
681
682
683
684
685 mi_orig->insert_minimal(
new Bag(
p, vp));
686
688 MonomialIdeal *mi =
new MonomialIdeal(
P, elems, rejects,
mi_stash);
689 for (auto& b : rejects)
690 delete b;
691
693
695 {
696 res_pair *second = reinterpret_cast<res_pair *>(a.basis_ptr());
698
702 }
703 delete mi;
704}
exponents::Exponents exponents_t
static void quotient(ConstExponents a, ConstExponents b, Vector &result)
static bool is_equal(ConstExponents a, ConstExponents b)
static void to_expvector(int n, ConstExponents a, exponents::Exponents result)
static void var(Exponent v, Exponent e, Vector &result)
void debug_out(int disp=1) const
gc_vector< int > & monom()
res_pair * new_res_pair()
void insert_res_pair(int level, res_pair *p)
#define ALLOCATE_MONOMIAL(byte_len)
const mpreal exp(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
typename std::vector< T, gc_allocator< T > > gc_vector
a version of the STL vector, which allocates its backing memory with gc.
#define newarray_atomic(T, len)