Macaulay2 Engine
Loading...
Searching...
No Matches
aring-glue.hpp File Reference

ConcreteRing<RingType> — the templated bridge between aring and the legacy Ring API. More...

#include "aring.hpp"
#include "aring-translate.hpp"
#include "ring.hpp"
#include "mutablemat.hpp"
#include "aring-qq.hpp"

Go to the source code of this file.

Classes

class  M2::ConcreteRing< RingType >
class  M2::RingQQ
 Ring-level QQ ring, a thin specialisation of ConcreteRing<ARingQQ> that marks itself with is_QQ() and coefficient_type() == COEFF_QQ. More...

Namespaces

namespace  M2
namespace  M2::RingPromoter

Macros

#define COERCE_RING(RingType, R)

Typedefs

typedef M2::RingQQ RingQQ

Functions

template<typename SourceRing, typename TargetRing>
bool M2::RingPromoter::promoter (const Ring *R, const Ring *S, const ring_elem fR, ring_elem &resultS)
template<typename SourceRing, typename TargetRing>
bool M2::RingPromoter::lifter (const Ring *R, const Ring *S, ring_elem &result_gR, const ring_elem gS)
template<typename RingType>
bool M2::liftToInt (const RingType &R, const Ring *Rg, const ring_elem f, ring_elem &result)
template<typename RT>
std::pair< bool, long > M2::coerceToLongIntegerFcn (const RT &ring, ring_elem a)
const RingElementM2::findMinimalPolynomial (const PolynomialRing &originalR)
template<typename RT>
const RingElementM2::getLiftedRepresentation (const RT &R, const ring_elem &a)
template<typename ConcreteRT>
const RingElementM2::getGen (const ConcreteRT &R)
void initializeRationalRing ()

Variables

static const bool displayArithmeticCalls = false
const RingQQglobalQQ

Detailed Description

ConcreteRing<RingType> — the templated bridge between aring and the legacy Ring API.

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

ConcreteRing<RingType> is a Ring subclass that owns a std::unique_ptr<RingType> to a concrete aring (ARingZZ, ARingZZpFlint, ...) and implements every Ring virtual by forwarding to the aring's inline method. Because the wrapper is itself a template parameterised on RingType, the compiler inlines the forwarding calls — so the only virtual-dispatch cost lives at the outer Ring* boundary; once inside ConcreteRing<R>, all arithmetic is direct calls to the aring's hot path. The COERCE_RING(RingType, R) macro at the top is a thin dynamic_cast<const RingType*>(R) alias kept for cases where a caller already knows the runtime ring type.

This file is the single piece that lets the legacy and aring ring APIs coexist permanently: every aring becomes a usable Ring* for older engine code without losing the performance of inlined arithmetic in templated hot paths. The variadic create<Args...> factory forwards its arguments straight to the aring's constructor, so building, say, ConcreteRing<ARingZZpFlint>::create(p) is a one-liner. aring-translate.hpp is the companion for cross-ring coercion (mypromote / mylift); on the element-handle side the class re-exposes both RingType::ElementType and RingType::Element as nested typedefs so callers can grab either the raw scalar or the resource-managing wrapper. The abandoned RElementWrap<RingType> / AConcreteRing<RingType> scaffolding in aring-wrap.hpp was a never-completed alternative design, not the production element-level counterpart. The displayArithmeticCalls flag (defaults to false) is a file-static compile-time debug toggle that, when flipped to true and recompiled, has every forwarded Ring virtual fprintf(stderr, "calling <op>\n").

See also
aring.hpp
aring-translate.hpp
ring.hpp

Definition in file aring-glue.hpp.