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

◆ sort()

void HermiteComputation::sort ( hm_elem *& p)
private

Definition at line 185 of file hermite.cpp.

186{
187 // Sort in ascending absolute value of lead term
188 if (p == nullptr || p->next == nullptr) return;
189 hm_elem *p1 = nullptr;
190 hm_elem *p2 = nullptr;
191 while (p != nullptr)
192 {
193 hm_elem *tmp = p;
194 p = p->next;
195 tmp->next = p1;
196 p1 = tmp;
197
198 if (p == nullptr) break;
199 tmp = p;
200 p = p->next;
201 tmp->next = p2;
202 p2 = tmp;
203 }
204
205 sort(p1);
206 sort(p2);
207 p = merge(p1, p2);
208}
hm_elem * merge(hm_elem *f, hm_elem *g)
Definition hermite.cpp:124
void sort(hm_elem *&p)
Definition hermite.cpp:185
int p
int p1
hm_elem * next
Definition hermite.hpp:44

References merge(), hm_elem::next, p, p1, and sort().

Referenced by sort(), and start_computation().