fq_nmod_mpoly.h – multivariate polynomials over finite fields of word-sized characteristic¶
The exponents follow the
mpoly
interface. A coefficient may be referenced as afq_nmod_struct *
.
Types, macros and constants¶
-
type
fq_nmod_mpoly_ctx_struct
¶ Context structure for
fq_nmod_mpoly
.
-
type
fq_nmod_mpoly_ctx_t
¶ An array of length 1 of
fq_nmod_mpoly_ctx_struct
.
-
type
fq_nmod_mpoly_struct
¶ A structure holding a multivariate polynomial over a finite field of word-sized characteristic.
-
type
fq_nmod_mpoly_t
¶ An array of length 1 of
fq_nmod_mpoly_struct
.
Context object¶
-
void
fq_nmod_mpoly_ctx_init
(fq_nmod_mpoly_ctx_t ctx, slong nvars, const ordering_t ord, const fq_nmod_ctx_t fqctx)¶ Initialise a context object for a polynomial ring with the given number of variables and the given ordering. It will have coefficients in the finite field
fqctx
. The possibilities for the ordering areORD_LEX
,ORD_DEGLEX
andORD_DEGREVLEX
.
-
slong
fq_nmod_mpoly_ctx_nvars
(fq_nmod_mpoly_ctx_t ctx)¶ Return the number of variables used to initialize the context.
-
ordering_t
fq_nmod_mpoly_ctx_ord
(const fq_nmod_mpoly_ctx_t ctx)¶ Return the ordering used to initialize the context.
-
void
fq_nmod_mpoly_ctx_clear
(fq_nmod_mpoly_ctx_t ctx)¶ Release any space allocated by an
fq_nmod_mpoly_ctx_t
.
Memory management¶
-
void
fq_nmod_mpoly_init
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Initialise
A
for use with the given an initialised context object. Its value is set to zero.
-
void
fq_nmod_mpoly_init2
(fq_nmod_mpoly_t A, slong alloc, const fq_nmod_mpoly_ctx_t ctx)¶ Initialise
A
for use with the given an initialised context object. Its value is set to zero. It is allocated with space foralloc
terms and at leastMPOLY_MIN_BITS
bits for the exponents.
-
void
fq_nmod_mpoly_init3
(fq_nmod_mpoly_t A, slong alloc, flint_bitcnt_t bits, const fq_nmod_mpoly_ctx_t ctx)¶ Initialise
A
for use with the given an initialised context object. Its value is set to zero. It is allocated with space foralloc
terms andbits
bits for the exponents.
-
void
fq_nmod_mpoly_fit_length
(fq_nmod_mpoly_t A, slong len, const fq_nmod_mpoly_ctx_t ctx)¶ Ensure that
A
has space for at leastlen
terms.
-
void
fq_nmod_mpoly_fit_bits
(fq_nmod_mpoly_t A, flint_bitcnt_t bits, const fq_nmod_mpoly_ctx_t ctx)¶ Ensure that the exponent fields of
A
have at leastbits
bits.
-
void
fq_nmod_mpoly_realloc
(fq_nmod_mpoly_t A, slong alloc, const fq_nmod_mpoly_ctx_t ctx)¶ Reallocate
A
to have space foralloc
terms. Assumes the current length of the polynomial is not greater thanalloc
.
-
void
fq_nmod_mpoly_clear
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Release any space allocated for
A
.
Input/Output¶
The variable strings in
x
start with the variable of most significance at index0
. Ifx
isNULL
, the variables are namedx1
,x2
, ect.
-
char *
fq_nmod_mpoly_get_str_pretty
(const fq_nmod_mpoly_t A, const char **x, const fq_nmod_mpoly_ctx_t ctx)¶ Return a string, which the user is responsible for cleaning up, representing
A
, given an array of variable stringsx
.
-
int
fq_nmod_mpoly_fprint_pretty
(FILE *file, const fq_nmod_mpoly_t A, const char **x, const fq_nmod_mpoly_ctx_t ctx)¶ Print a string representing
A
tofile
.
-
int
fq_nmod_mpoly_print_pretty
(const fq_nmod_mpoly_t A, const char **x, const fq_nmod_mpoly_ctx_t ctx)¶ Print a string representing
A
tostdout
.
-
int
fq_nmod_mpoly_set_str_pretty
(fq_nmod_mpoly_t A, const char *str, const char **x, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
to the polynomial in the null-terminates stringstr
given an arrayx
of variable strings. If parsingstr
fails,A
is set to zero, and-1
is returned. Otherwise,0
is returned. The operations+
,-
,*
, and/
are permitted along with integers and the variables inx
. The character^
must be immediately followed by the (integer) exponent. If any division is not exact, parsing fails.
Basic manipulation¶
-
void
fq_nmod_mpoly_gen
(fq_nmod_mpoly_t A, slong var, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
to the variable of indexvar
, wherevar = 0
corresponds to the variable with the most significance with respect to the ordering.
-
int
fq_nmod_mpoly_is_gen
(const fq_nmod_mpoly_t A, slong var, const fq_nmod_mpoly_ctx_t ctx)¶ If \(var \ge 0\), return
1
ifA
is equal to the \(var\)-th generator, otherwise return0
. If \(var < 0\), return1
if the polynomial is equal to any generator, otherwise return0
.
-
void
fq_nmod_mpoly_set
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
toB
.
-
int
fq_nmod_mpoly_equal
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fq_nmod_mpoly_ctx_t ctx)¶ Return
1
ifA
is equal toB
, else return0
.
-
void
fq_nmod_mpoly_swap
(fq_nmod_mpoly_t A, fq_nmod_mpoly_t B, const fq_nmod_mpoly_ctx_t ctx)¶ Efficiently swap
A
andB
.
Constants¶
-
int
fq_nmod_mpoly_is_fq_nmod
(const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Return
1
ifA
is a constant, else return0
.
-
void
fq_nmod_mpoly_get_fq_nmod
(fq_nmod_t c, const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Assuming that
A
is a constant, setc
to this constant. This function throws ifA
is not a constant.
-
void
fq_nmod_mpoly_set_fq_nmod
(fq_nmod_mpoly_t A, const fq_nmod_t c, const fq_nmod_mpoly_ctx_t ctx)¶ -
void
fq_nmod_mpoly_set_ui
(fq_nmod_mpoly_t A, ulong c, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
to the constantc
.
-
void
fq_nmod_mpoly_set_fq_nmod_gen
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
to the constant given byfq_nmod_gen()
.
-
void
fq_nmod_mpoly_zero
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
to the constant0
.
-
void
fq_nmod_mpoly_one
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
to the constant1
.
-
int
fq_nmod_mpoly_equal_fq_nmod
(const fq_nmod_mpoly_t A, const fq_nmod_t c, const fq_nmod_mpoly_ctx_t ctx)¶ Return
1
ifA
is equal to the constantc
, else return0
.
-
int
fq_nmod_mpoly_is_zero
(const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Return
1
ifA
is the constant0
, else return0
.
-
int
fq_nmod_mpoly_is_one
(const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Return
1
ifA
is the constant1
, else return0
.
Degrees¶
-
int
fq_nmod_mpoly_degrees_fit_si
(const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Return
1
if the degrees ofA
with respect to each variable fit into anslong
, otherwise return0
.
-
void
fq_nmod_mpoly_degrees_fmpz
(fmpz **degs, const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ -
void
fq_nmod_mpoly_degrees_si
(slong *degs, const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Set
degs
to the degrees ofA
with respect to each variable. IfA
is zero, all degrees are set to-1
.
-
void
fq_nmod_mpoly_degree_fmpz
(fmpz_t deg, const fq_nmod_mpoly_t A, slong var, const fq_nmod_mpoly_ctx_t ctx)¶ -
slong
fq_nmod_mpoly_degree_si
(const fq_nmod_mpoly_t A, slong var, const fq_nmod_mpoly_ctx_t ctx)¶ Either return or set
deg
to the degree ofA
with respect to the variable of indexvar
. IfA
is zero, the degree is defined to be-1
.
-
int
fq_nmod_mpoly_total_degree_fits_si
(const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Return
1
if the total degree ofA
fits into anslong
, otherwise return0
.
-
void
fq_nmod_mpoly_total_degree_fmpz
(fmpz_t tdeg, const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ -
slong
fq_nmod_mpoly_total_degree_si
(const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Either return or set
tdeg
to the total degree ofA
. IfA
is zero, the total degree is defined to be-1
.
Coefficients¶
-
void
fq_nmod_mpoly_get_coeff_fq_nmod_monomial
(fq_nmod_t c, const fq_nmod_mpoly_t A, const fq_nmod_mpoly_t M, const fq_nmod_mpoly_ctx_t ctx)¶ Assuming that
M
is a monomial, setc
to the coefficient of the corresponding monomial inA
. This function thows ifM
is not a monomial.
-
void
fq_nmod_mpoly_set_coeff_fq_nmod_monomial
(fq_nmod_mpoly_t A, const fq_nmod_t c, const fq_nmod_mpoly_t M, const fq_nmod_mpoly_ctx_t ctx)¶ Assuming that
M
is a monomial, set the coefficient of the corresponding monomial inA
toc
. This function thows ifM
is not a monomial.
-
void
fq_nmod_mpoly_get_coeff_fq_nmod_fmpz
(fq_nmod_t c, const fq_nmod_mpoly_t A, fmpz *const *exp, const fq_nmod_mpoly_ctx_t ctx)¶ -
void
fq_nmod_mpoly_get_coeff_fq_nmod_ui
(fq_nmod_t c, const fq_nmod_mpoly_t A, const ulong *exp, const fq_nmod_mpoly_ctx_t ctx)¶ Set
c
to the coefficient of the monomial with exponent vectorexp
.
-
void
fq_nmod_mpoly_set_coeff_fq_nmod_fmpz
(fq_nmod_mpoly_t A, const fq_nmod_t c, fmpz *const *exp, const fq_nmod_mpoly_ctx_t ctx)¶ -
void
fq_nmod_mpoly_set_coeff_fq_nmod_ui
(fq_nmod_mpoly_t A, const fq_nmod_t c, const ulong *exp, const fq_nmod_mpoly_ctx_t ctx)¶ Set the coefficient of the monomial with exponent
exp
toc
.
-
void
fq_nmod_mpoly_get_coeff_vars_ui
(fq_nmod_mpoly_t C, const fq_nmod_mpoly_t A, const slong *vars, const ulong *exps, slong length, const fq_nmod_mpoly_ctx_t ctx)¶ Set
C
to the coefficient ofA
with respect to the variables invars
with powers in the corresponding arrayexps
. Bothvars
andexps
point to array of lengthlength
. It is assumed that \(0 < length \le nvars(A)\) and that the variables invars
are distinct.
Comparison¶
-
int
fq_nmod_mpoly_cmp
(const fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fq_nmod_mpoly_ctx_t ctx)¶ Return
1
(resp.-1
, or0
) if the monomial ofA
is greater than (resp. less than, same as) the monomial ofB
.A
andB
should both have length one with coefficient one. This function will throw otherwise.
Container operations¶
These functions deal with violations of the internal canonical representation. If a term index is negative or not strictly less than the length of the polynomial, the function will throw.
-
fq_nmod_struct *
fq_nmod_mpoly_term_coeff_ref
(fq_nmod_mpoly_t A, slong i, const fq_nmod_mpoly_ctx_t ctx)¶ Return a reference to the coefficient of index \(i\) of
A
.
-
int
fq_nmod_mpoly_is_canonical
(const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Return
1
ifA
is in canonical form. Otherwise, return0
. To be in canonical form, all of the terms must have nonzero coefficients, and the terms must be sorted from greatest to least.
-
slong
fq_nmod_mpoly_length
(const fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Return the number of terms in
A
. If the polynomial is in canonical form, this will be the number of nonzero coefficients.
-
void
fq_nmod_mpoly_resize
(fq_nmod_mpoly_t A, slong new_length, const fq_nmod_mpoly_ctx_t ctx)¶ Set the length of
A
tonew_length
. Terms are either deleted from the end, or new zero terms are appended.
-
void
fq_nmod_mpoly_get_term_coeff_fq_nmod
(fq_nmod_t c, const fq_nmod_mpoly_t A, slong i, const fq_nmod_mpoly_ctx_t ctx)¶ Set
c
to the coefficient of the term of indexi
.
-
void
fq_nmod_mpoly_set_term_coeff_ui
(fq_nmod_mpoly_t A, slong i, ulong c, const fq_nmod_mpoly_ctx_t ctx)¶ Set the coefficient of the term of index
i
toc
.
-
int
fq_nmod_mpoly_term_exp_fits_si
(const fq_nmod_mpoly_t A, slong i, const fq_nmod_mpoly_ctx_t ctx)¶ -
int
fq_nmod_mpoly_term_exp_fits_ui
(const fq_nmod_mpoly_t A, slong i, const fq_nmod_mpoly_ctx_t ctx)¶ Return
1
if all entries of the exponent vector of the term of index \(i\) fit into anslong
(resp. aulong). Otherwise, return ``0
.
-
void
fq_nmod_mpoly_get_term_exp_fmpz
(fmpz **exp, const fq_nmod_mpoly_t A, slong i, const fq_nmod_mpoly_ctx_t ctx)¶ -
void
fq_nmod_mpoly_get_term_exp_ui
(ulong *exp, const fq_nmod_mpoly_t A, slong i, const fq_nmod_mpoly_ctx_t ctx)¶ -
void
fq_nmod_mpoly_get_term_exp_si
(slong *exp, const fq_nmod_mpoly_t A, slong i, const fq_nmod_mpoly_ctx_t ctx)¶ Set
exp
to the exponent vector of the term of indexi
. The_ui
(resp._si
) version throws if any entry does not fit into aulong
(resp.slong
).
-
ulong
fq_nmod_mpoly_get_term_var_exp_ui
(const fq_nmod_mpoly_t A, slong i, slong var, const fq_nmod_mpoly_ctx_t ctx)¶ -
slong
fq_nmod_mpoly_get_term_var_exp_si
(const fq_nmod_mpoly_t A, slong i, slong var, const fq_nmod_mpoly_ctx_t ctx)¶ Return the exponent of the variable
var
of the term of indexi
. This function throws if the exponent does not fit into aulong
(resp.slong
).
-
void
fq_nmod_mpoly_set_term_exp_fmpz
(fq_nmod_mpoly_t A, slong i, fmpz *const *exp, const fq_nmod_mpoly_ctx_t ctx)¶ -
void
fq_nmod_mpoly_set_term_exp_ui
(fq_nmod_mpoly_t A, slong i, const ulong *exp, const fq_nmod_mpoly_ctx_t ctx)¶ Set the exponent of the term of index
i
toexp
.
-
void
fq_nmod_mpoly_get_term
(fq_nmod_mpoly_t M, const fq_nmod_mpoly_t A, slong i, const fq_nmod_mpoly_ctx_t ctx)¶ Set
M
to the term of indexi
inA
.
-
void
fq_nmod_mpoly_get_term_monomial
(fq_nmod_mpoly_t M, const fq_nmod_mpoly_t A, slong i, const fq_nmod_mpoly_ctx_t ctx)¶ Set
M
to the monomial of the term of indexi
inA
. The coefficient ofM
will be one.
-
void
fq_nmod_mpoly_push_term_fq_nmod_fmpz
(fq_nmod_mpoly_t A, const fq_nmod_t c, fmpz *const *exp, const fq_nmod_mpoly_ctx_t ctx)¶ -
void
fq_nmod_mpoly_push_term_fq_nmod_ui
(fq_nmod_mpoly_t A, const fq_nmod_t c, const ulong *exp, const fq_nmod_mpoly_ctx_t ctx)¶ Append a term to
A
with coefficientc
and exponent vectorexp
. This function runs in constant average time.
-
void
fq_nmod_mpoly_sort_terms
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Sort the terms of
A
into the canonical ordering dictated by the ordering inctx
. This function simply reorders the terms: It does not combine like terms, nor does it delete terms with coefficient zero. This function runs in linear time in the bit size ofA
.
-
void
fq_nmod_mpoly_combine_like_terms
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Combine adjacent like terms in
A
and delete terms with coefficient zero. If the terms ofA
were sorted to begin with, the result will be in canonical form. This function runs in linear time in the bit size ofA
.
-
void
fq_nmod_mpoly_reverse
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
to the reversal ofB
.
Random generation¶
-
void
fq_nmod_mpoly_randtest_bound
(fq_nmod_mpoly_t A, flint_rand_t state, slong length, ulong exp_bound, const fq_nmod_mpoly_ctx_t ctx)¶ Generate a random polynomial with length up to
length
and exponents in the range[0, exp_bound - 1]
. The exponents of each variable are generated by calls ton_randint(state, exp_bound)
.
-
void
fq_nmod_mpoly_randtest_bounds
(fq_nmod_mpoly_t A, flint_rand_t state, slong length, ulong exp_bounds, const fq_nmod_mpoly_ctx_t ctx)¶ Generate a random polynomial with length up to
length
and exponents in the range[0, exp_bounds[i] - 1]
. The exponents of the variable of indexi
are generated by calls ton_randint(state, exp_bounds[i])
.
-
void
fq_nmod_mpoly_randtest_bits
(fq_nmod_mpoly_t A, flint_rand_t state, slong length, mp_limb_t exp_bits, const fq_nmod_mpoly_ctx_t ctx)¶ Generate a random polynomial with length up to the given length and exponents whose packed form does not exceed the given bit count.
Addition/Subtraction¶
-
void
fq_nmod_mpoly_add_fq_nmod
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fq_nmod_t C, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
toB
plusc
.
-
void
fq_nmod_mpoly_sub_fq_nmod
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fq_nmod_t C, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
toB
minusc
.
-
void
fq_nmod_mpoly_add
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fq_nmod_mpoly_t C, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
toB
plusC
.
-
void
fq_nmod_mpoly_sub
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fq_nmod_mpoly_t C, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
toB
minusC
.
Scalar operations¶
-
void
fq_nmod_mpoly_neg
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
to \(-\).
-
void
fq_nmod_mpoly_scalar_mul_fq_nmod
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fq_nmod_t c, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
toB
timesc
.
-
void
fq_nmod_mpoly_make_monic
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
toB
divided by the leading coefficient ofB
. This throws ifB
is zero.
Differentiation¶
-
void
fq_nmod_mpoly_derivative
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, slong var, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
to the derivative ofB
with respect to the variable of indexidx
.
Evaluation¶
These functions return \(0\) when the operation would imply unreasonable arithmetic.
-
void
fq_nmod_mpoly_evaluate_all_fq_nmod
(fq_nmod_t ev, fq_nmod_mpoly_t A, fq_nmod_struct *const *vals, const fq_nmod_mpoly_ctx_t ctx)¶ Set
ev
the evaluation ofA
where the variables are replaced by the corresponding elements of the arrayvals
.
-
void
fq_nmod_mpoly_evaluate_one_fq_nmod
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, slong var, fq_nmod_t val, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
to the evaluation ofB
where the variable of indexvar
is replaced byval
.
-
int
fq_nmod_mpoly_compose_fq_nmod_poly
(fq_nmod_poly_t A, const fq_nmod_mpoly_t B, fq_nmod_poly_struct *const *C, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
to the evaluation ofB
where the variables are replaced by the corresponding elements of the arrayC
. The context object ofB
isctxB
. Return \(1\) for success and \(0\) for failure.
-
int
fq_nmod_mpoly_compose_fq_nmod_mpoly
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, fq_nmod_mpoly_struct *const *C, const fq_nmod_mpoly_ctx_t ctxB, const fq_nmod_mpoly_ctx_t ctxAC)¶ Set
A
to the evaluation ofB
where the variables are replaced by the corresponding elements of the arrayC
. BothA
and the elements ofC
have context objectctxAC
, whileB
has context objectctxB
. NeitherA
norB
is allowed to alias any other polynomial. Return \(1\) for success and \(0\) for failure.
-
void
fq_nmod_mpoly_compose_fq_nmod_mpoly_gen
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const slong *c, const fq_nmod_mpoly_ctx_t ctxB, const fq_nmod_mpoly_ctx_t ctxAC)¶ Set
A
to the evaluation ofB
where the variable of indexi
inctxB
is replaced by the variable of indexc[i]
inctxAC
. The length of the arrayC
is the number of variables inctxB
. If anyc[i]
is negative, the corresponding variable ofB
is replaced by zero. Otherwise, it is expected thatc[i]
is less than the number of variables inctxAC
.
Multiplication¶
-
void
fq_nmod_mpoly_mul
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const nmod_mpoly_t C, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
toB
timesC
.
Powering¶
These functions return \(0\) when the operation would imply unreasonable arithmetic.
-
int
fq_nmod_mpoly_pow_fmpz
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fmpz_t k, const fq_nmod_mpoly_ctx_t ctx)¶ Set \(A\) to \(B\) raised to the \(k\)-th power. Return \(1\) for success and \(0\) for failure.
-
int
fq_nmod_mpoly_pow_ui
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, ulong k, const fq_nmod_mpoly_ctx_t ctx)¶ Set \(A\) to \(B\) raised to the \(k\)-th power. Return \(1\) for success and \(0\) for failure.
Division¶
-
int
fq_nmod_mpoly_divides
(fq_nmod_mpoly_t Q, const fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fq_nmod_mpoly_ctx_t ctx)¶ If
A
is divisible byB
, setQ
to the exact quotient and return1
. Otherwise, setQ
to zero and return0
.
-
void
fq_nmod_mpoly_div
(fq_nmod_mpoly_t Q, const fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fq_nmod_mpoly_ctx_t ctx)¶ Set
Q
to the quotient ofA
byB
, discarding the remainder.
-
void
fq_nmod_mpoly_divrem
(fq_nmod_mpoly_t Q, fq_nmod_mpoly_t R, const fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fq_nmod_mpoly_ctx_t ctx)¶ Set
Q
andR
to the quotient and remainder ofA
divided byB
.
-
void
fq_nmod_mpoly_divrem_ideal
(fq_nmod_mpoly_struct **Q, fq_nmod_mpoly_t R, const fq_nmod_mpoly_t A, fq_nmod_mpoly_struct *const *B, slong len, const fq_nmod_mpoly_ctx_t ctx)¶ This function is as per
fq_nmod_mpoly_divrem()
except that it takes an array of divisor polynomialsB
and it returns an array of quotient polynomialsQ
. The number of divisor (and hence quotient) polynomials, is given bylen
.
Greatest Common Divisor¶
-
int
fq_nmod_mpoly_gcd
(fq_nmod_mpoly_t G, const fq_nmod_mpoly_t A, const fq_nmod_mpoly_t B, const fq_nmod_mpoly_ctx_t ctx)¶ Try to set
G
to the monic GCD ofA
andB
. The GCD of zero and zero is defined to be zero. If the return is1
the function was successful. Otherwise the return is0
andG
is left untouched.
Univariate Functions¶
An
fq_nmod_mpoly_univar_t
holds a univariate polynomial in some main variable withfq_nmod_mpoly_t
coefficients in the remaining variables. These functions are useful when one wants to rewrite an element of \(\mathbb{F}_q[x_1, \dots, x_m]\) as an element of \((\mathbb{F}_q[x_1, \dots, x_{v-1}, x_{v+1}, \dots, x_m])[x_v]\) and vise versa.
-
void
fq_nmod_mpoly_univar_init
(fq_nmod_mpoly_univar_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Initialize \(A\).
-
void
fq_nmod_mpoly_univar_clear
(fq_nmod_mpoly_univar_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Clear \(A\).
-
void
fq_nmod_mpoly_univar_swap
(fq_nmod_mpoly_univar_t A, fq_nmod_mpoly_univar_t B, const fq_nmod_mpoly_ctx_t ctx)¶ Swap \(A\) and \(B\).
-
void
fq_nmod_mpoly_to_univar
(fq_nmod_mpoly_univar_t A, const fq_nmod_mpoly_t B, slong var, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
to a univariate form ofB
by pulling out the variable of indexvar
. The coefficients ofA
will still belong to the contentctx
but will not depend on the variable of indexvar
.
-
void
fq_nmod_mpoly_from_univar
(fq_nmod_mpoly_t A, const fq_nmod_mpoly_univar_t B, slong var, const fq_nmod_mpoly_ctx_t ctx)¶ Set
A
to the normal form ofB
by putting in the variable of indexvar
. This function is undefined if the coefficients ofB
depend on the variable of indexvar
.
-
int
fq_nmod_mpoly_univar_degree_fits_si
(const fq_nmod_mpoly_univar_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Return \(1\) if the degree of
A
with respect to the main variable fits anslong
. Otherwise, return \(0\).
-
slong
fq_nmod_mpoly_univar_length
(const fq_nmod_mpoly_univar_t A, const fq_nmod_mpoly_ctx_t ctx)¶ Return the number of terms in
A
with respect to the main variable.
-
slong
fq_nmod_mpoly_univar_get_term_exp_si
(fq_nmod_mpoly_univar_t A, slong i, const fq_nmod_mpoly_ctx_t ctx)¶ Return the exponent of the term of index
i
ofA
.
-
void
fq_nmod_mpoly_univar_get_term_coeff
(fq_nmod_mpoly_t c, const fq_nmod_mpoly_univar_t A, slong i, const fq_nmod_mpoly_ctx_t ctx)¶ -
void
fq_nmod_mpoly_univar_swap_term_coeff
(fq_nmod_mpoly_t c, fq_nmod_mpoly_univar_t A, slong i, const fq_nmod_mpoly_ctx_t ctx)¶ Set (resp. swap)
c
to (resp. with) the coefficient of the term of indexi
ofA
.