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

Two SimpleARing-style coefficient adapters: CoefficientRingZZp and CoefficientRingR. More...

#include "aring.hpp"
#include "ringelem.hpp"
#include "ZZ.hpp"

Go to the source code of this file.

Classes

class  CoefficientRingZZp
 Discrete-log Z/p adapter that represents non-zero residues by their exponent index relative to a generator. More...
class  CoefficientRingR
 Generic CoefficientRing adapter that wraps an arbitrary const Ring* and forwards every operation to it. More...
class  CoefficientRingR::Element
 Managed scalar value: an M2::ElementImpl<ring_elem> that initialises itself through the parent CoefficientRingR. More...
class  CoefficientRingR::ElementArray
 Fixed-size, owned array of ElementTypes for the linear-algebra templates that want a flat buffer they can operator[] into. More...

Detailed Description

Two SimpleARing-style coefficient adapters: CoefficientRingZZp and CoefficientRingR.

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

Declares CoefficientRingZZp, the engine's discrete-log Z/p implementation: a SimpleARing<CoefficientRingZZp> CRTP class that represents each non-zero residue as its exponent index relative to a generator and uses parallel log_table / exp_table arrays of size p to move between the index world and the residue world. Multiplication and division of non-zero elements become modulus_add / modulus_sub on the indices modulo p - 1 with no table lookup; addition and subtraction first hop to residues via exp_table, do a modulus_add / modulus_sub mod p, and hop back via log_table. Inversion of a non-zero index a is p - 1 - a and negate shifts by (p - 1) / 2 (the index of -1). The class is used for the small primes that the matching M2 raw entry point accepts (2 <= p <= 32749, per interface/aring.h).

Also declares CoefficientRingR, the generic adapter that wraps an arbitrary const Ring* in the same operation surface — forwarding add / mult / subtract / invert / ... to the wrapped ring's methods, and exposing Element (a M2::ElementImpl subclass) and ElementArray helpers for managed temporaries. This is the catch-all implementation used wherever code that expects a CoefficientRing interface needs to talk to a ring that doesn't have a faster specialisation.

See also
aring.hpp
aring-glue.hpp
ZZp.hpp

Definition in file coeffrings.hpp.