|
Macaulay2 Engine
|
Ring-shaped wrapper that exposes a non-commutative FreeAlgebra to the rest of the engine. More...
#include <M2/math-include.h>#include "engine-includes.hpp"#include <memory>#include <string>#include <vector>#include "NCAlgebras/FreeAlgebra.hpp"#include "NCAlgebras/FreeMonoid.hpp"#include "Polynomial.hpp"#include "ring.hpp"#include "ringelem.hpp"Go to the source code of this file.
Classes | |
| class | M2FreeAlgebraOrQuotient |
| Abstract Ring subclass that lifts either a FreeAlgebra or a FreeAlgebraQuotient into the engine's Ring hierarchy. More... | |
| class | M2FreeAlgebra |
| Concrete Ring wrapper around an owned FreeAlgebra (no quotient). More... | |
Functions | |
| PolyList | copyPolyVector (const M2FreeAlgebraOrQuotient *A, const PolyList &polys) |
Ring-shaped wrapper that exposes a non-commutative FreeAlgebra to the rest of the engine.
The non-commutative implementation in NCAlgebras/FreeAlgebra.hpp (class FreeAlgebra : public our_new_delete) deliberately does not inherit from Ring — it wants clean templates and no virtual-dispatch overhead. But matrices, modules, resolutions, Computations, and RingMap construction all want a Ring*. M2FreeAlgebra reconciles the two by owning a std::unique_ptr<FreeAlgebra> and forwarding every Ring virtual call to the wrapped instance, so the non-commutative ring slots transparently into Matrix / MutableMatrix / RingElement slots.
The class hierarchy here is two-level: this file also declares the abstract M2FreeAlgebraOrQuotient : public Ring, which M2FreeAlgebra and M2FreeAlgebraQuotient both inherit from. That intermediate fixes is_commutative_ring() to false and pins the abstract API (freeAlgebra(), n_vars(), coefficientRing(), from_coefficient(), makeTerm(), cast_to_M2FreeAlgebraOrQuotient()) plus toPoly / fromPoly / appendFromModuleMonom / fromModuleMonom helpers that translate between ring_elem (carrying the value through the mPolyVal slot) and the shared Poly from Polynomial.hpp. This wrap-a-templated-implementation-in-a-Ring pattern mirrors aring-glue.hpp's ConcreteRing<R> for the aring family.
Definition in file M2FreeAlgebra.hpp.