fq_nmod_poly_factor.h – factorisation of univariate polynomials over finite fields (word-size characteristic)¶
Types, macros and constants¶
-
type fq_nmod_poly_factor_struct¶
-
type fq_nmod_poly_factor_t¶
Memory Management¶
-
void fq_nmod_poly_factor_init(fq_nmod_poly_factor_t fac, const fq_nmod_ctx_t ctx)¶
Initialises
facfor use. Anfq_nmod_poly_factor_trepresents a polynomial in factorised form as a product of polynomials with associated exponents.
-
void fq_nmod_poly_factor_clear(fq_nmod_poly_factor_t fac, const fq_nmod_ctx_t ctx)¶
Frees all memory associated with
fac.
-
void fq_nmod_poly_factor_realloc(fq_nmod_poly_factor_t fac, slong alloc, const fq_nmod_ctx_t ctx)¶
Reallocates the factor structure to provide space for precisely
allocfactors.
-
void fq_nmod_poly_factor_fit_length(fq_nmod_poly_factor_t fac, slong len, const fq_nmod_ctx_t ctx)¶
Ensures that the factor structure has space for at least
lenfactors. This function takes care of the case of repeated calls by always at least doubling the number of factors the structure can hold.
Basic Operations¶
-
void fq_nmod_poly_factor_set(fq_nmod_poly_factor_t res, const fq_nmod_poly_factor_t fac, const fq_nmod_ctx_t ctx)¶
Sets
resto the same factorisation asfac.
-
void fq_nmod_poly_factor_print_pretty(const fq_nmod_poly_factor_t fac, const char *var, const fq_nmod_ctx_t ctx)¶
Pretty-prints the entries of
facto standard output.
-
void fq_nmod_poly_factor_print(const fq_nmod_poly_factor_t fac, const fq_nmod_ctx_t ctx)¶
Prints the entries of
facto standard output.
-
void fq_nmod_poly_factor_insert(fq_nmod_poly_factor_t fac, const fq_nmod_poly_t poly, slong exp, const fq_nmod_ctx_t ctx)¶
Inserts the factor
polywith multiplicityexpinto the factorisationfac.If
facalready containspoly, thenexpsimply gets added to the exponent of the existing entry.
-
void fq_nmod_poly_factor_concat(fq_nmod_poly_factor_t res, const fq_nmod_poly_factor_t fac, const fq_nmod_ctx_t ctx)¶
Concatenates two factorisations.
This is equivalent to calling
fq_nmod_poly_factor_insert()repeatedly with the individual factors offac.Does not support aliasing between
resandfac.
-
void fq_nmod_poly_factor_pow(fq_nmod_poly_factor_t fac, slong exp, const fq_nmod_ctx_t ctx)¶
Raises
facto the powerexp.
-
ulong fq_nmod_poly_remove(fq_nmod_poly_t f, const fq_nmod_poly_t p, const fq_nmod_ctx_t ctx)¶
Removes the highest possible power of
pfromfand returns the exponent.
Irreducibility Testing¶
-
int fq_nmod_poly_is_irreducible(const fq_nmod_poly_t f, const fq_nmod_ctx_t ctx)¶
Returns 1 if the polynomial
fis irreducible, otherwise returns 0.
-
int fq_nmod_poly_is_irreducible_ddf(const fq_nmod_poly_t f, const fq_nmod_ctx_t ctx)¶
Returns 1 if the polynomial
fis irreducible, otherwise returns 0. Uses fast distinct-degree factorisation.
-
int fq_nmod_poly_is_irreducible_ben_or(const fq_nmod_poly_t f, const fq_nmod_ctx_t ctx)¶
Returns 1 if the polynomial
fis irreducible, otherwise returns 0. Uses Ben-Or’s irreducibility test.
-
int _fq_nmod_poly_is_squarefree(const fq_nmod_struct *f, slong len, const fq_nmod_ctx_t ctx)¶
Returns 1 if
(f, len)is squarefree, and 0 otherwise. As a special case, the zero polynomial is not considered squarefree. There are no restrictions on the length.
-
int fq_nmod_poly_is_squarefree(const fq_nmod_poly_t f, const fq_nmod_ctx_t ctx)¶
Returns 1 if
fis squarefree, and 0 otherwise. As a special case, the zero polynomial is not considered squarefree.
Factorisation¶
Root Finding¶
-
void fq_nmod_poly_roots(fq_nmod_poly_factor_t r, const fq_nmod_poly_t f, int with_multiplicity, const fq_nmod_ctx_t ctx)¶
Fill \(r\) with factors of the form \(x - r_i\) where the \(r_i\) are the distinct roots of a nonzero \(f\) in \(F_q\). If \(with\_multiplicity\) is zero, the exponent \(e_i\) of the factor \(x - r_i\) is \(1\). Otherwise, it is the largest \(e_i\) such that \((x-r_i)^e_i\) divides \(f\). This function throws if \(f\) is zero, but is otherwise always successful.