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

RingMap — engine representation of a ring homomorphism. More...

#include "ring.hpp"

Go to the source code of this file.

Classes

class  RingMap
 Engine-side ring homomorphism: stores, for each source-ring variable, the target-ring element it maps to. More...
struct  RingMap::var
 Per-source-variable image record: a factored representation of the target-ring element that variable maps to. More...

Detailed Description

RingMap — engine representation of a ring homomorphism.

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

Declares RingMap, an EngineObject that stores a homomorphism via the target ring R (with P set to its polynomial side and K to its coefficient ring) and an array _elem of nvars image records, one per generator of the (matrix-supplied) source. Each var record carries the pre-factored image coeff * monom * bigelem together with is_zero, coeff_is_one, monom_is_one, and bigelem_is_one flags so the inner-loop evaluator can skip trivial multiplications. A top-level is_monomial flag unlocks a much faster evaluation path when every image is a single monomial of the target. Application of a RingMap to a polynomial walks each term, substitutes the image of every variable, and accumulates the result in the target, threading coefficient maps through where source and target differ in coefficient ring (the eval_term entry point).

RingMaps are typically built ad hoc by RingMap::make(m) from a matrix giving the images of the source variables (quotient projection in qring.cpp, M2's map(S, R, ...), coercion-style maps, ring-extension morphisms) and short-lived. Composition is not a first-class operation: callers evaluate one map on the image list of another to produce a new image list.

See also
ring.hpp
qring.hpp

Definition in file ringmap.hpp.