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

◆ gbvector_sort()

void GBRing::gbvector_sort ( const FreeModule * F,
gbvector *& f )

Definition at line 750 of file gbring.cpp.

751{
752 // Divide f into two lists of equal length, sort each,
753 // then add them together. This allows the same monomial
754 // to appear more than once in 'f'.
755
756 if (f == nullptr || f->next == nullptr) return;
757 gbvector *f1 = nullptr;
758 gbvector *f2 = nullptr;
759 while (f != nullptr)
760 {
761 gbvector *t = f;
762 f = f->next;
763 t->next = f1;
764 f1 = t;
765
766 if (f == nullptr) break;
767 t = f;
768 f = f->next;
769 t->next = f2;
770 f2 = t;
771 }
772
773 gbvector_sort(F, f1);
774 gbvector_sort(F, f2);
775 gbvector_add_to(F, f1, f2);
776 f = f1;
777}
void gbvector_add_to(const FreeModule *F, gbvector *&f, gbvector *&g)
Definition gbring.cpp:668
void gbvector_sort(const FreeModule *F, gbvector *&f)
Definition gbring.cpp:750
gbvector * next
Definition gbring.hpp:80

References gbvector_add_to(), gbvector_sort(), and gbvector::next.

Referenced by gbvector_sort().