Macaulay2 Engine
Loading...
Searching...
No Matches
monsort.hpp File Reference

QuickSorter<Sorter> — ring-agnostic in-place sort over a duck-typed adapter. More...

#include <cstdio>
#include <cstdlib>
#include "newdelete.hpp"
#include "interface/m2-types.h"
#include <ctime>

Go to the source code of this file.

Classes

class  QuickSorter< Sorter >

Macros

#define pivot_index()
#define swap(a, b, t)
#define SWAP(a, b)
#define THRESH   6
#define NSTACK   50

Detailed Description

QuickSorter<Sorter> — ring-agnostic in-place sort over a duck-typed adapter.

Note
AI-generated documentation. Verify against the source before relying on it.

Declares the templated QuickSorter, an in-place sort algorithm parameterised on a Sorter adapter that supplies Sorter::value (the element type) and Sorter::compare(value, value) returning a signed integer in the standard (neg, 0, pos) shape. The point of the template is to keep the comparator local to each call site so the compiler can inline it; consumers write their own tiny adapter rather than passing a function pointer or std::function.

Used wherever the engine needs to sort a monomial-keyed sequence with call-site-specific semantics: F4 column ordering by leading monomial, frame entries by Schreyer order in resolution code, deterministic output ordering for printers and serialisers. The adapter pattern lets each site bring its own comparison rule (lex, grevlex, Schreyer-tiebreak, ...) without paying a virtual-dispatch tax in the inner loop.

See also
newdelete.hpp

Definition in file monsort.hpp.