FLINT3.7.0-dev

FLINT: Fast Library for Number Theory#

FLINT is a C library for number theory and computer algebra: arithmetic with integers, rationals, polynomials, matrices, finite fields, p-adic numbers, and real and complex numbers with rigorous error bounds.

The documentation has four parts:

  • The User guide explains how to build and use FLINT and the conventions shared by all modules: types, memory management, aliasing, threads, ball arithmetic and exact numbers.
  • The modules below document every public function, module by module, grouped by subject. Each module page lists all functions with their full prototypes and a short description; function pages and guides give the details, usually with a short complete program.
  • Algorithms describes the methods behind the functions, with proofs, complexity and references, starting from the generic algorithms and leading to the specialised implementations.
  • Examples and tutorials develop complete programs step by step.

Every example program in the documentation is compiled and run by make checkdoc, and its output is compared with the output shown.

Start here#

Modules#

Foundations

Word-size integers

Integers

Rational numbers

Integers mod n

Number theory

Univariate polynomials

fmpz_poly.hDense univariate polynomials over the integers, from basic arithmetic to fast multiplication, division, GCDs, resultants, evaluation, composition, power series, real root isolation and Hensel lifting.fmpz_poly_factor.hFactorisation of polynomials over the integers into irreducible factors, by squarefree factorisation, Hensel lifting and the Zassenhaus and van Hoeij recombination algorithms.fmpq_poly.hDense univariate polynomials over \mathbb{Q}, stored as an integer polynomial with a common denominator, with arithmetic, division, GCDs, power series and transcendental functions, composition, reversion and interpolation.fmpz_poly_q.hRational functions in \mathbb{Q}(x), stored as canonical quotients of integer polynomials.nmod_poly.hDense univariate polynomials over \mathbb{Z}/n\mathbb{Z} for a word-size modulus n, from basic arithmetic to fast multiplication, division, GCDs, evaluation, interpolation, composition and power series.nmod_poly_factor.hFactorisation, irreducibility and squarefreeness testing, and root finding for polynomials over \mathbb{Z}/n\mathbb{Z} with word-size modulus.n_poly.hLightweight dense and sparse polynomial containers over Z/pZ and F_q with word-size coefficients, used internally by the multivariate polynomial code.fmpz_mod_poly.hDense univariate polynomials over \mathbb{Z}/n\mathbb{Z} for a modulus of any size, with fast multiplication, division, GCDs, modular composition, evaluation and power series.fmpz_mod_poly_factor.hFactorisation, irreducibility and squarefreeness testing, and root finding for polynomials over \mathbb{Z}/n\mathbb{Z} with multiword modulus.

Multivariate polynomials

mpoly.hInfrastructure shared by all sparse multivariate polynomial modules: monomial orderings, packed exponent vectors, monomial arithmetic, heaps, and helpers for GCD and factorisation.fmpz_mpoly.hSparse multivariate polynomials over the integers, with heap, array and dense multiplication and division, square roots, GCDs, resultants and Gröbner bases.fmpz_mpoly_factor.hFactorisation of multivariate polynomials over the integers into content, squarefree and irreducible factors, with the multimodular GCD, Hensel lifting and dense bivariate machinery behind it.fmpz_mpoly_q.hMultivariate rational functions over the rationals, as reduced fractions of integer polynomials, optionally with factored denominators.fmpq_mpoly.hSparse multivariate polynomials over the rational numbers, stored as a rational content times a primitive integer polynomial.fmpq_mpoly_factor.hFactorisation of multivariate polynomials over the rational numbers, by reduction to the integers.nmod_mpoly.hSparse multivariate polynomials over \mathbb{Z}/n\mathbb{Z} for a word-size modulus n, with heap, array and Kronecker multiplication, heap division, GCDs with extension-field fallbacks for small fields, square roots and resultants.nmod_mpoly_factor.hFactorisation of multivariate polynomials over \mathbb{F}_p for a word-size prime p, into content, squarefree, separable and irreducible factors, with extension-field methods for small fields.fmpz_mod_mpoly.hSparse multivariate polynomials over \mathbb{Z}/n\mathbb{Z} for a modulus n of any size, with heap arithmetic, GCDs, square roots, resultants and naive Gröbner bases.fmpz_mod_mpoly_factor.hFactorisation of multivariate polynomials over \mathbb{F}_p for a prime p of any size, and the GCD and lifting machinery behind fmpz_mod_mpoly.fmpz_mod_mpoly_q.hMultivariate rational functions over a prime field \mathbb{F}_p, as reduced fractions of fmpz_mod_mpoly polynomials with monic denominators.fq_nmod_mpoly.hSparse multivariate polynomials over finite fields \mathbb{F}_q of word-size characteristic, with heap arithmetic, GCDs that fall back to extension fields for small q, square roots and resultants.fq_nmod_mpoly_factor.hFactorisation of multivariate polynomials over finite fields \mathbb{F}_q of word-size characteristic, with extension-field methods for small fields.fq_zech_mpoly.hSparse multivariate polynomials over small finite fields with coefficients in Zech logarithm representation; a partial port of fq_nmod_mpoly used mainly by the factoring code of nmod_mpoly.fq_zech_mpoly_factor.hFactorisation of multivariate polynomials over small finite fields in Zech logarithm representation, and the bivariate and lifting machinery used by the medprime factoring algorithms of nmod_mpoly.

Matrices

fmpz_mat.hDense matrices over the integers, with multiplication, determinants, exact solving over \mathbb{Q}, echelon forms, Hermite and Smith normal forms, characteristic polynomials and lattice reduction.fmpz_lll.hLLL reduction of integer lattices given by a basis or a Gram matrix, with floating-point Gram–Schmidt data (L² algorithm), certified reducedness tests and removals of long vectors.fmpq_mat.hDense matrices over the rational numbers, with conversions to integer matrices, multiplication, determinants, linear system solving, echelon forms and characteristic polynomials computed over the integers.nmod_mat.hDense matrices over \mathbb{Z}/n\mathbb{Z} for word-size n, with fast multiplication, LU decomposition, linear solving, echelon forms and characteristic polynomials.fmpz_mod_mat.hDense matrices over \mathbb{Z}/n\mathbb{Z} for a modulus of any size, with entries stored as fmpz residues, multiplication by exact integer products, and Gaussian elimination through the generic matrix algorithms.fmpz_poly_mat.hDense matrices of polynomials over the integers, with multiplication by Kronecker substitution, determinants by fraction-free elimination or interpolation, and exact solving with polynomial denominators.nmod_poly_mat.hDense matrices of polynomials over \mathbb{Z}/n\mathbb{Z} for word-size n, with multiplication by Kronecker substitution, evaluation and interpolation or the small-prime FFT, determinants, and exact solving by fraction-free elimination.bool_mat.hDense matrices over the Boolean semiring, with products, powers, transitive closure and graph algorithms on adjacency matrices.

Finite fields

fq_default.hFinite fields \mathbb{F}_q of any order, with the representation (Zech logarithms, word-size or multiprecision characteristic, prime field) chosen automatically.fq_default_mat.hDense matrices over any finite field \mathbb{F}_q, in the representation chosen by fq_default.fq_default_poly.hDense univariate polynomials over any finite field \mathbb{F}_q, in the representation chosen by fq_default.fq_default_poly_factor.hFactorisation, irreducibility testing and root finding for polynomials over any finite field \mathbb{F}_q, in the representation chosen by fq_default.fq.hFinite fields \mathbb{F}_{p^d} of arbitrary characteristic, with elements stored as polynomials over \mathbb{Z}/p\mathbb{Z} with multiprecision coefficients.fq_vec.hVectors over finite fields \mathbb{F}_q of arbitrary characteristic, stored as arrays of fq_struct.fq_mat.hDense matrices over finite fields \mathbb{F}_q of arbitrary characteristic, with Kronecker substitution multiplication and linear algebra through the generic gr_mat algorithms.fq_poly.hDense univariate polynomials over finite fields \mathbb{F}_q of arbitrary characteristic, with Kronecker substitution multiplication and generic fast division, GCD, composition and power series algorithms.fq_poly_factor.hFactorisation, irreducibility and squarefreeness testing and root finding for polynomials over finite fields \mathbb{F}_q of arbitrary characteristic.fq_embed.hEmbeddings of a finite field \mathbb{F}_{p^m} into \mathbb{F}_{p^n}, m \mid n, given by different defining polynomials, as matrices over \mathbb{F}_p, with projections by the trace.fq_nmod.hFinite fields \mathbb{F}_{p^d} of word-size characteristic, with elements stored as polynomials over \mathbb{Z}/p\mathbb{Z} (nmod_poly).fq_nmod_vec.hVectors over finite fields \mathbb{F}_q in the word-size characteristic.fq_nmod_mat.hDense matrices over finite fields \mathbb{F}_q in the word-size characteristic.fq_nmod_poly.hDense univariate polynomials over finite fields \mathbb{F}_q in the word-size characteristic.fq_nmod_poly_factor.hFactorisation of polynomials over finite fields \mathbb{F}_q in the word-size characteristic.fq_nmod_embed.hEmbeddings between finite fields in the word-size characteristic.fq_zech.hSmall finite fields \mathbb{F}_q, q < 2^{64}, with elements stored as discrete logarithms (Zech logarithm representation).fq_zech_vec.hVectors over finite fields \mathbb{F}_q in the Zech logarithm representation.fq_zech_mat.hDense matrices over finite fields \mathbb{F}_q in the Zech logarithm representation.fq_zech_poly.hDense univariate polynomials over finite fields \mathbb{F}_q in the Zech logarithm representation.fq_zech_poly_factor.hFactorisation of polynomials over finite fields \mathbb{F}_q in the Zech logarithm representation.fq_zech_embed.hEmbeddings between finite fields in the Zech logarithm representation.

p-adic numbers

Algebraic numbers and number fields

Real and complex numbers

mag.hUnsigned floating-point numbers with a 30-bit mantissa for fast upper and lower boundsarf.hArbitrary-precision binary floating-point numbers with correct rounding and unbounded exponentsarb.hReal numbers as midpoint-radius balls with rigorous error propagationacb.hComplex numbers as rectangles of real balls, with rigorous arithmetic and elementary and special functionsacf.hComplex floating-point numbers as pairs of arf_t, for approximate computationarb_poly.hDense univariate polynomials and truncated power series with real ball coefficients, with rigorous multiplication, division, composition, evaluation, elementary and special functions of power series, and root refinement.acb_poly.hDense univariate polynomials and truncated power series with complex ball coefficients, with rigorous arithmetic, evaluation, composition, elementary and special functions of power series, and certified complex root finding.arb_fmpz_poly.hFunctions for integer polynomials that use real and complex balls: evaluation at balls, certified real and complex root isolation, deflation, and minimal polynomials of Gaussian periods.arb_mat.hDense matrices with real ball entries: rigorous arithmetic, verified solving of linear systems and inversion, determinants, Cholesky and LDL decompositions, the matrix exponential, and approximate floating-point linear algebra for preconditioning.acb_mat.hDense matrices with complex ball entries: rigorous arithmetic, verified solving and inversion, determinants, the matrix exponential, and certified eigenvalues and eigenvectors.arb_calc.hCalculus with real functions given by ball evaluators: rigorous isolation of the simple real roots of an analytic function by bisection, and refinement by bisection or interval Newton iteration.acb_calc.hRigorous numerical integration of complex functions along straight-line paths, combining direct interval enclosures, Gauss–Legendre quadrature with error bounds from analyticity, and adaptive subdivision.arb_fpwrap.hFloating-point wrappers of the real and complex special functions: double and complex double input and output with guaranteed accuracy, obtained by ball arithmetic with automatically increasing precision.

Special functions

Floating-point arithmetic

Exact real and complex numbers

Generic rings

gr.hGeneric rings: context objects, elements, status codes and the generic interface to arithmetic in any ring.gr.hThe built-in rings and other structures of the generic interface, and their constructors.gr_generic.hThe default implementations of methods of the generic rings interface, and generic evaluation of integer polynomials.gr_special.hMathematical constants, elementary functions, combinatorial numbers and special functions over generic rings.gr_vec.hVectors over generic rings: memory management, elementwise arithmetic, dot products, sums and products, sorting and parsing.gr_mat.hDense matrices over any generic ring, with the generic algorithms for multiplication, LU and fraction-free LU decomposition, solving, determinants, ranks, echelon forms, characteristic polynomials, eigenvalues and matrix functions that FLINT's matrix modules build on.gr_poly.hDense univariate polynomials over any generic ring, with the generic algorithms for multiplication, division, GCDs, resultants, evaluation, composition, power series and factorisation over finite fields that most of FLINT's polynomial modules build on.gr_series.hGeneric rings of formal power series over any base ring - truncated power series modulo x^n, and power series with an error term O(x^n) tracked per element.gr_mpoly.hSparse multivariate polynomials over any generic ring, with heap-based multiplication and division (also multithreaded), division with remainder by ideals and pseudo-division, as a generic ring in its own right.gr_ore_poly.hDense univariate Ore polynomials (linear differential, difference, q-difference, Mahler and Frobenius operators) over generic rings, as a generic noncommutative ring.

Fast Fourier transforms

Cite this page

The FLINT team, “FLINT documentation,” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/ (generated 2026-10-20).