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

◆ get_lead_term()

const gbvector * gbvectorHeap::get_lead_term ( )

Definition at line 1551 of file gbring.cpp.

1552{
1553 int lead_so_far = -1;
1554 for (int i = 0; i <= top_of_heap; i++)
1555 {
1556 if (heap[i] == nullptr) continue;
1557 if (lead_so_far < 0)
1558 {
1559 lead_so_far = i;
1560 continue;
1561 }
1562 int cmp = GR->gbvector_compare(F, heap[lead_so_far], heap[i]);
1563 if (cmp == GT) continue;
1564 if (cmp == LT)
1565 {
1566 lead_so_far = i;
1567 continue;
1568 }
1569 // At this point we have equality
1570 K->add_to(heap[lead_so_far]->coeff, heap[i]->coeff);
1571 gbvector *tmp = heap[i];
1572 heap[i] = tmp->next;
1573 tmp->next = nullptr;
1574 GR->gbvector_remove(tmp);
1575
1576 if (K->is_zero(heap[lead_so_far]->coeff))
1577 {
1578 // Remove, and start over
1579 tmp = heap[lead_so_far];
1580 heap[lead_so_far] = tmp->next;
1581 tmp->next = nullptr;
1582 GR->gbvector_remove(tmp);
1583 lead_so_far = -1;
1584 i = -1;
1585 }
1586 }
1587 mLead = lead_so_far;
1588 if (lead_so_far < 0) return nullptr;
1589 gbvector *result = heap[lead_so_far];
1590 return result;
1591}
gbvector * heap[GEOHEAP_SIZE]
Definition gbring.hpp:693
const Ring * K
Definition gbring.hpp:692
const FreeModule * F
Definition gbring.hpp:691
int top_of_heap
Definition gbring.hpp:695
GBRing * GR
Definition gbring.hpp:690
VALGRIND_MAKE_MEM_DEFINED & result(result)
gbvector * next
Definition gbring.hpp:80
const int GT
Definition style.hpp:41
const int LT
Definition style.hpp:39

References F, GR, GT, heap, K, LT, mLead, gbvector::next, result(), and top_of_heap.

Referenced by gb2_comp::gb_geo_reduce(), GB_comp::gb_geo_reduce(), GBinhom_comp::gb_geo_reduce(), GBKernelComputation::geo_reduce(), MarkedGB::geo_remainder(), and remove_lead_term().