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

◆ insert() [2/2]

void binomial_s_pair_set::insert ( binomial_s_pair p)

Definition at line 534 of file gb-toric.cpp.

535{
536 int deg = R->degree(s.lcm);
537
538 // Statistics control
539 if (deg > _max_degree)
540 {
541 // Extend _npairs:
542 for (int i = 2 * _max_degree + 2; i < 2 * deg + 2; i++) _npairs.push_back(0);
543 _max_degree = deg;
544 }
545 _npairs[2 * deg]++;
546 _npairs[2 * deg + 1]++;
547
549 while (true)
550 {
551 if (q->next == nullptr || q->next->deg > deg)
552 {
553 // Insert new degree node
555 q1->next = q->next;
556 q1->deg = deg;
557 q1->pairs = nullptr;
558 q->next = q1;
559 break;
560 }
561 if (q->next->deg == deg) break;
562 q = q->next;
563 }
564 q = q->next;
565 insert_pair(q, s);
566 _n_elems++;
567 q->n_elems++;
568}
void insert_pair(s_pair_degree_list *q, binomial_s_pair &s)
Definition gb-toric.cpp:495
const binomial_ring * R
Definition gb-toric.hpp:196
gc_vector< int > _npairs
Definition gb-toric.hpp:204
s_pair_degree_list * _pairs
Definition gb-toric.hpp:198
void size_t s
Definition m2-mem.cpp:271

References _max_degree, _n_elems, _npairs, _pairs, binomial_s_pair_set::s_pair_degree_list::deg, insert_pair(), binomial_s_pair_set::s_pair_degree_list::n_elems, binomial_s_pair_set::s_pair_degree_list::next, binomial_s_pair_set::s_pair_degree_list::pairs, R, and s.