Macaulay2 Engine
Loading...
Searching...
No Matches
res-monomial-sorter.hpp File Reference

Schreyer-order column sorters for the F4 resolution Macaulay matrix. More...

#include "ExponentVector.hpp"
#include "monoid.hpp"
#include "schreyer-resolution/res-moninfo.hpp"
#include "schreyer-resolution/res-schreyer-order.hpp"
#include "schreyer-resolution/res-monomial-types.hpp"
#include "style.hpp"
#include <memtailor/Arena.h>
#include <algorithm>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

class  MonomialSorterObject
 Strict-weak comparator on integer indices into a std::vector<int*> of monomials, used by the resolution code to sort columns. More...
class  ResMonomialSorter
 Sorter that orders res_packed_monomials by their total (Schreyer) monomial, with a stable tiebreaker derived from input order. More...

Detailed Description

Schreyer-order column sorters for the F4 resolution Macaulay matrix.

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

Declares the sort kernel called once per (level, degree) cell to permute matrix columns into Schreyer order before reduction. MonomialSorterObject captures a Monoid plus a vector<int*> of encoded monomials and exposes operator()(int a, int b) as the comparator that walks the encoded order then applies the Schreyer tie-breaker stored in the first slot of each monomial; a static mNumComparisons counter tracks comparator calls for profiling.

ResMonomialSorter is the wrapper the engine calls in practice: it takes the level-1 ResSchreyerOrder and a vector of level-side res_packed_monomials, expands each column through the Schreyer "total monomial" composition var_expvec(column) * var_expvec(orderTotal[comp]) into a [tiebreaker, basecomp, encoded monomial] row in an arena-allocated buffer, and runs std::stable_sort to return an index permutation. Stable sort preserves relative order among equal monomials, which the tiebreaker relies on. The #if 0'd ResMonomialTransformer records an earlier API shape kept for reference.

See also
res-moninfo.hpp
res-schreyer-order.hpp
res-monomial-types.hpp
monoid.hpp
res-f4-computation.hpp

Definition in file res-monomial-sorter.hpp.