FLINT3.7.0-dev
Module · 109 functions

fq_zech_mpoly_factor.h

#include <flint/fq_zech_mpoly_factor.h>

This module factors polynomials of fq_zech_mpoly.h. The public factorisation functions convert to fq_nmod_mpoly and call the corresponding fq_nmod_mpoly_factor function, so their semantics are those of fq_nmod_mpoly_factor. The rest of the module is a port of the smprime factoring algorithms (bivariate factorisation, Wang's leading coefficients, Hensel lifting, sparse lifting and Zassenhaus recombination) to Zech logarithm arithmetic, which nmod_mpoly_factor_irred_medprime_* uses to factor a polynomial over \mathbb{F}_p in an extension \mathbb{F}_{p^k} with p^k \le 10^6 (see Factoring over finite fields and Multivariate Hensel lifting).

Types#

A factorisation c \prod_i f_i^{e_i}, with the fields constant (an fq_zech_t), poly, exp (fmpz exponents), num and alloc.

Memory management and basic manipulation#

Initialise f as the empty product with constant 1, free it, change its allocation to alloc factors, or ensure space for len factors.

Swap two factorisations, and set a to the empty product with constant 1.

Prints the constant followed by one line *(base)^exp per factor.

Factorisation#

Set f to the factorisation of A into monic irreducible factors, with the constant equal to the leading coefficient of A, using all methods, one lifting method, or the methods in the bit mask algo (see fq_nmod_mpoly_factor_algo). The computation is done by fq_nmod_mpoly_factor_algo after conversion. Return 1 for success.

Internal functions#

Univariate and bivariate polynomials#

Dense bivariate polynomials (arrays of fq_zech_poly_struct, the entry of index i being the coefficient of x^i as a polynomial in y), arrays of bivariate polynomials, and sparse polynomials in up to three packed variables with fq_zech coefficients (polyu) or with fq_zech_poly coefficients in one more variable (polyun).

void fq_zech_bpoly_print_pretty(const fq_zech_bpoly_t A, const char * var0, const char * var1, const fq_zech_ctx_t ctx)

Memory management, assignment, coefficient access, the degrees in the main (0) and inner (1) variable, and conversion from univariate polynomials in either variable.

Arithmetic of bivariate polynomials: products and divisions, possibly truncated to order terms in the inner variable; exact division (returning 1 if exact); removal of the content g; the derivative with respect to the main variable; and the shifts x \mapsto x + \alpha and y \mapsto y + c.

void fq_zech_polyu3_degrees(slong * deg0, slong * deg1, slong * deg2, const fq_zech_polyu_t A)
void fq_zech_polyu3_print_pretty(const fq_zech_polyu_t A, const char * var0, const char * var1, const char * var2, const fq_zech_ctx_t ctx)
void fq_zech_polyu2n_print_pretty(const fq_zech_polyun_t A, const char * var0, const char * var1, const char * varlast, const fq_zech_ctx_t ctx)
void fq_zech_polyu3n_print_pretty(const fq_zech_polyun_t A, const char * var0, const char * var1, const char * var2, const char * varlast, const fq_zech_ctx_t ctx)

Memory management, consistency checks, degrees and printing of the other types.

Convert between a polynomial in the variables varx (main) and vary only and a dense bivariate polynomial.

Test whether A involves only the variable of index var, convert such a polynomial to an fq_zech_poly (returning 0 otherwise), and set A to a univariate polynomial in that variable.

Factors the bivariate B, separable in the main variable: sets c to its content and F to its irreducible factors, by evaluation of the inner variable at a point of \mathbb{F}_q (only 0 unless allow_shift), Hensel lifting and recombination by linear algebra [Lec2006]. Returns 0 if no suitable point exists.

int fq_zech_bpoly_hlift(slong r, fq_zech_bpoly_t A, fq_zech_bpoly_struct * B, const fq_zech_t alpha, slong degree_inner, const fq_zech_ctx_t ctx)

Hensel lifting of a factorisation modulo y - \alpha into two or r factors, up to degree degree_inner in y. Return 1 for success.

Multivariate lifting#

Vectors of polynomials, and precomputed data for multivariate partial fractions.

void fq_zech_mpolyv_print_pretty(const fq_zech_mpolyv_t poly, const char ** x, const fq_zech_mpoly_ctx_t ctx)

Vectors of polynomials, and conversion between B and the coefficients of its expansion in powers of xalpha = x_j - \alpha.

Sets g to the GCD of the coefficients of A and returns 1 for success.

Get, or replace by c, the leading coefficient of a polynomial viewed as a polynomial in variable 0.

int fq_zech_mpoly_hlift(slong m, fq_zech_mpoly_struct * f, slong r, const fq_zech_struct * alpha, const fq_zech_mpoly_t A, const slong * degs, const fq_zech_mpoly_ctx_t ctx)

Multivariate partial fractions and Hensel lifting, as the corresponding nmod_mpoly functions.

Wang's leading coefficient distribution [Wan1978].

Irreducible factorisation of a monic squarefree polynomial in at least three variables with evaluation points in \mathbb{F}_q, as the fq_nmod_mpoly versions. Return 1 for success, 0 if they ran out of evaluation points, and -1 for a failure that other points would not fix.

void _fq_zech_mpoly_monomial_evals(fq_zech_struct * E, const ulong * Aexps, flint_bitcnt_t Abits, slong Alen, const fq_zech_struct * alpha, slong vstart, const fq_zech_mpoly_ctx_t ctx)
int _fq_zech_mpoly_eval_rest_fq_zech_poly(fq_zech_poly_struct * E, slong * starts, slong * ends, slong * stops, ulong * es, const fq_zech_struct * Acoeffs, const ulong * Aexps, slong Alen, slong var, const fq_zech_poly_struct * alphas, const slong * offsets, const slong * shifts, slong N, ulong mask, slong nvars, const fq_zech_ctx_t ctx)

Evaluate the monomials of a polynomial at given values of some variables, and evaluate all but the first one or two variables to get univariate or bivariate images.

Steps x to the next element of \mathbb{F}_q in a fixed enumeration; returns 0 when it wraps around.

References#

  • [Lec2006] G. Lecerf. Sharp precision in Hensel lifting for bivariate polynomial factorization. Mathematics of Computation 75 (2006), 921–933.
  • [Wan1978] P. S. Wang. An improved multivariate polynomial factoring algorithm. Mathematics of Computation 32 (1978), 1215–1231. https://doi.org/10.1090/S0025-5718-1978-0568284-3
Cite this page

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