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

◆ get_lead_term()

template<class FREEMODULETYPE, class VECTYPE>
const VECTYPE geobucket< FREEMODULETYPE, VECTYPE >::get_lead_term ( )
inline

Definition at line 120 of file geobucket.hpp.

121{
122 int lead_so_far = -1;
123 for (int i=0; i <= top_of_heap; i++)
124 {
125 if (heap[i] == NULL) continue;
126 if (lead_so_far < 0)
127 {
128 lead_so_far = i;
129 continue;
130 }
131 int cmp = F->compare(heap[lead_so_far], heap[i]);
132 if (cmp == GT) continue;
133 if (cmp == LT)
134 {
135 lead_so_far = i;
136 continue;
137 }
138 // At this point we have equality
139 K->add_to(heap[lead_so_far]->coeff, heap[i]->coeff);
140 VECTYPE tmp = heap[i];
141 heap[i] = tmp->next;
142 tmp->next = NULL;
143 F->remove(tmp);
144
145 if (K->is_zero(heap[lead_so_far]->coeff))
146 {
147 // Remove, and start over
149 heap[lead_so_far] = tmp->next;
150 tmp->next = NULL;
151 F->remove(tmp);
152 lead_so_far = -1;
153 i = -1;
154 }
155 }
157 if (lead_so_far < 0) return NULL;
159 return result;
160}
VECTYPE heap[GEOHEAP_SIZE]
Definition geobucket.hpp:56
FREEMODULETYPE * F
Definition geobucket.hpp:54
int top_of_heap
Definition geobucket.hpp:57
const Ring * K
Definition geobucket.hpp:55

References F, GT, heap, K, LT, mLead, result(), and top_of_heap.

Referenced by remove_lead_term().