Macaulay2 Engine
Loading...
Searching...
No Matches
monoid.h File Reference

Engine-boundary C API for constructing and inspecting Monoid objects. More...

Go to the source code of this file.

Typedefs

typedef const deg_tconst_monomial

Functions

const MonoidrawTrivialMonoid ()
const MonoidrawMonoid (const MonomialOrdering *mo, const Ring *deg_ring, M2_ArrayString names, M2_arrayint degrees, M2_arrayint heftvec)
int rawMonoidNumberOfBlocks (const Monoid *M)
unsigned int rawMonoidHash (const Monoid *M)
M2_string rawMonoidToString (const Monoid *M)
M2_arrayint to_degree_vector (const Monoid *M, const_monomial d)

Detailed Description

Engine-boundary C API for constructing and inspecting Monoid objects.

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

Declares the extern "C" entry points the M2 interpreter calls to build the monoid of monomials underneath every polynomial ring. rawTrivialMonoid() returns the cached single-instance trivial monoid (the comment confirms it "always returns the same object"); rawMonoid(mo, deg_ring, names, degrees, heftvec) is the workhorse constructor that takes a MonomialOrdering, a const Ring* deg_ring (the polynomial ring in which multi-degrees of the new monoid will live — typically the trivial-monoid-based base case or a previously-built degree ring, not a Monoid*), the variable names, a flat degree vector, and a heft vector, and returns a fresh Monoid* or null if the inputs are inconsistent (the in-source TODO flags this NULL-return path as needing an update). rawMonoidNumberOfBlocks, rawMonoidHash (sequentially assigned, hooks d/basic.d), rawMonoidToString (debug, d/actors4.d), and the interface helper to_degree_vector cover the per-monoid read accessors the interpreter needs after construction.

The deg_t = int32_t and const_monomial = const deg_t* typedefs declared here are the engine-wide format for degree slots and packed monomials passed back through this surface. Multi-degrees are recursive: each Monoid carries a deg_ring whose own underlying monoid is what its degree slots index into, and the chain bottoms out at the trivial monoid; M2 builds the chain by repeatedly invoking rawMonoid against the previously-built degree ring.

See also
monoid.cpp
monomial-ordering.h
engine-includes.hpp

Definition in file monoid.h.