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

M2::ARingZZGMP — aring integer ring backed straight by GMP mpz_t. More...

#include "interface/gmp-util.h"
#include "interface/random.h"
#include "aring.hpp"
#include "buffer.hpp"
#include "ringelem.hpp"
#include "exceptions.hpp"
#include "ZZ.hpp"

Go to the source code of this file.

Classes

class  M2::ARingZZGMP
 wrapper for the mpz_struct integer representation More...

Namespaces

namespace  M2

Detailed Description

M2::ARingZZGMP — aring integer ring backed straight by GMP mpz_t.

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

ARingZZGMP is a SimpleARing<ARingZZGMP> whose ElementType is GMP's __mpz_struct (the single-element form of mpz_t). Arithmetic is delegated to the corresponding GMP primitives (mpz_add, mpz_sub, mpz_mul, mpz_submul, mpz_divexact, mpz_pow_ui, ...); divide raises exc::engine_error("division not exact") when the dividend is not actually divisible. The to_ring_elem path calls interface/gmp-util.hmpz_reallocate_limbs on the exported mpz_ptr so its limbs are migrated onto the GC heap before the value is handed to legacy Ring code; in-place arithmetic on ARingZZGMP values keeps GMP's own limb storage.

ring.cpp::makeIntegerRing actually returns new RingZZ — the legacy RingZZ (ZZ.hpp) class, not a ConcreteRing<ARing*> — and RingZZ internally carries an ARingZZGMP *coeffR member that it forwards arithmetic to. The FLINT-backed sibling aring-zz-flint.hpp::ARingZZ is a parallel aring choice but not the one M2's integer ring goes through. RingZZ::makeMutableMatrix (in mat.cpp) is where ARingZZGMP becomes the matrix back end: it builds MutableMat<DMat<ARingZZGMP>> or MutableMat<SMat<ARingZZGMP>> depending on the dense flag, and mat-linalg.hpp aliases DMat<ARingZZGMP> as DMatZZGMP for the matching dense linear-algebra paths.

See also
ZZ.hpp
aring-zz-flint.hpp
aring.hpp

Definition in file aring-zz-gmp.hpp.