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

M2::ARingQQFlint — rationals backed by FLINT's fmpq with small-value inlining. More...

#include "interface/gmp-util.h"
#include <M2/gc-include.h>
#include <flint/flint.h>
#include <flint/fmpq.h>
#include <flint/fmpz.h>
#include "aring.hpp"
#include "buffer.hpp"
#include "ringelem.hpp"
#include "exceptions.hpp"
#include "ring.hpp"

Go to the source code of this file.

Classes

class  M2::ARingQQFlint
 wrapper for the flint fmpq_t integer representation More...

Namespaces

namespace  M2

Detailed Description

M2::ARingQQFlint — rationals backed by FLINT's fmpq with small-value inlining.

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

ARingQQFlint represents a rational as FLINT's fmpq data struct, a pair of fmpzs that therefore inherits the small-value inlining used by ARingZZ (aring-zz-flint.hpp): when both numerator and denominator fit in a single machine word the value lives inline, with heap allocation only on blowup. Arithmetic uses fmpq_add, fmpq_mul, ..., which canonicalise after every operation, so (1/2) + (1/2) is stored as 1 rather than 2/2. The matching GMP mpq_t-backed sibling aring-qq-gmp.hpp is what aring-qq.hpp's typedef ARingQQ currently aliases as the engine-wide default.

The FLINT-include dance routes its malloc hooks through bdwgc via M2/gc-include.h (which must precede every FLINT header), guards conversion warnings with diagnostic pragmas, and currently still pulls in ring.hpp for cross-ring promotion — the in-source comment "promote needs ring.hpp. After moving promote out, remove it here!" flags the intended refactor (promotion is meant to migrate to aring-translate.hpp). Engine consumers are dmat-qq-flint.hpp and the QQ paths in mat-linalg.hpp.

See also
aring-qq.hpp
aring-qq-gmp.hpp
aring-zz-flint.hpp
aring.hpp

Definition in file aring-qq-flint.hpp.