|
Macaulay2 Engine
|
Coefficient-ring-erased arithmetic dispatcher used by F4, GB, and resolution code. More...
#include "m2tbb.hpp"#include "NCAlgebras/Range.hpp"#include "newdelete.hpp"#include "MemoryBlock.hpp"#include "ringelem.hpp"#include "aring-glue.hpp"#include <variant>#include <type_traits>Go to the source code of this file.
Classes | |
| class | ElementArray |
| Type-erased owning handle to a dense coefficient vector held by a ConcreteVectorArithmetic<Ring>. More... | |
| class | VectorArithmeticStats |
| Lightweight counter attached to a ConcreteVectorArithmetic<Ring> for tracking how many coefficient additions a reduction performed. More... | |
| class | ConcreteVectorArithmetic< RingType > |
| class | VectorArithmetic |
| Runtime dispatcher that hides the concrete coefficient ring behind a std::variant of ConcreteVectorArithmetic<Ring>* pointers. More... | |
Coefficient-ring-erased arithmetic dispatcher used by F4, GB, and resolution code.
VectorArithmetic is the engine's dispatcher for the inner loop shared across F4-style code paths — the accumulator[col] += coeff * scaling operation that runs many times per S-pair. It holds a std::variant named CVA_Type over ConcreteVectorArithmetic<RingType>* for each supported coefficient ring (ARingZZpFlint, ARingZZpFFPACK, ARingZZp, ARingQQGMP, ARingGFM2, ARingGFFlint, ARingGFFlintBig, CoefficientRingR, CoefficientRingZZp, DummyRing); the constructor switches on R->ringID() to instantiate the matching variant slot, and every public method uses std::visit so the body sees a ConcreteVectorArithmetic<R>* and the native add / multiply inlines. Storage is the opaque ElementArray wrapper declared alongside, and the VectorArithmeticStats companion counts mNumAdditions for profiling.
The point of the indirection is cross-ring reuse: f4/, gb-f4/, schreyer-resolution/, and NCAlgebras/NCF4 all hit this dispatcher rather than coding against any particular ring, so teaching the engine a new coefficient backend is a matter of implementing it as an aring, adding a ConcreteVectorArithmetic<...> specialisation, threading the new type into CVA_Type, and exposing construction through interface/aring.h.
Definition in file VectorArithmetic.hpp.