Macaulay2 Engine
Loading...
Searching...
No Matches
flint.h File Reference

Engine-boundary C API exposing FLINT's integer primality and factorisation services. More...

Go to the source code of this file.

Functions

M2_bool rawZZisPrime (gmp_ZZ a)
M2_bool rawZZisProbablePrime (gmp_ZZ a)
gmp_arrayZZ rawZZfactor (gmp_ZZ a)

Detailed Description

Engine-boundary C API exposing FLINT's integer primality and factorisation services.

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

Declares the three extern "C" entry points the M2 interpreter routes to FLINT for big-integer number theory: rawZZisPrime (exact primality via fmpz_is_prime — errors out via ERROR if FLINT returns a negative status), rawZZisProbablePrime (probable-primality via FLINT's fmpz_is_probabprime, which combines several tests internally), and rawZZfactor (full integer factorisation through fmpz_factor). Inputs arrive as gmp_ZZ; the implementation handles the GMP-to-FLINT fmpz_set_mpz / fmpz_clear round-trip internally so the interpreter never sees fmpz_t. rawZZfactor returns a gmp_arrayZZ of total length 2*num_factors + 1 shaped [sign, prime_1, mult_1, prime_2, mult_2, ...] — the leading element is the input's sign, not a prime.

FLINT is consumed pervasively inside the engine (see the aring-*-flint and dmat-*-flint families), but this header is the only place where FLINT-backed services are exposed directly to the interpreter; everything else stays private to its owning class.

See also
flint.cpp
factory.h
engine-includes.hpp

Definition in file flint.h.