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

◆ gb_sort_partition()

int GB_comp::gb_sort_partition ( int lo,
int hi )
private

Definition at line 224 of file gb-homog2.cpp.

225{
226 gb_elem *pivot = _gb[lo];
227 const gbvector *pivot_elem = pivot->f;
228 int i = lo - 1;
229 int j = hi + 1;
230 for (;;)
231 {
232 do
233 {
234 j--;
235 }
236 while (_GR->gbvector_compare(_F, _gb[j]->f, pivot_elem) > 0);
237
238 do
239 {
240 i++;
241 }
242 while (_GR->gbvector_compare(_F, _gb[i]->f, pivot_elem) < 0);
243
244 if (i < j)
245 {
246 gb_elem *tmp = _gb[j];
247 _gb[j] = _gb[i];
248 _gb[i] = tmp;
249 }
250 else
251 return j;
252 }
253}
const FreeModule * _F
Definition gb-homog2.hpp:73
GBRing * _GR
Definition gb-homog2.hpp:68
gbvector * f
Definition spair.hpp:58

References _F, _GR, and gb_elem::f.

Referenced by gb_sort().