next up previous
Next: About this document ... Up: Documented Private Function Previous: Documented Private Function

Function for handling polynomials

Polynomials are represented as pairs {x, l} where x is a mp_ptr pointing to the beginning of the polynomial and l is a mp_size_t called the length of the polynomial and defined as the degree plus one.

Note that because of the preallocation of memory, theses routines cannot handle polynomials of length larger than twice the degree of the polynomial defining the field minus one.

void mpffn_pol_add(mp_ptr r, mp_srcptr x, mp_srcptr y, mp_size_t lt, const mpffn_field *ff)
Set {r, lt} to {x, lt} + {y, lt} in $ \mathbb {F}$p[X].
void mpffn_pol_copy(mp_ptr r, mp_srcptr x, mp_size_t l, const mpffn_field *ff)
Set {r, l} to {x, l} in $ \mathbb {F}$p[X].
void mpffn_pol_diveuc(mp_ptr q, mp_ptr r, mp_srcptr x, mp_size_t lx, mp_srcptr y, mp_size_t ly, const mpffn_field *ff)
Set q and r so that {x, lx} = {y, ly}{q, lx - ly + 1} + {r, ly - 1}. This function assumes lx - ly + 1 > 0.
mp_size_t mpffn_pol_length(mp_srcptr x, mp_size_t lt, const mpffn_field *ff)
return one plus the degree of the polynomial of {x, lt}.
void mpffn_pol_mul(mp_ptr r, mp_srcptr x, mp_size_t lx, mp_srcptr y, mp_size_t ly, const mpffn_field *ff)
Set {r, lx + ly - 1} to {x, lx}×{y, ly} in $ \mathbb {F}$p[X].
void mpffn_pol_mul_mpn(mp_ptr r, mp_srcptr x, mp_size_t lt, mp_srcptr y, const mpffn_field *ff)
Set {r, lt} to {x, lt}×{y,ff->size_p} in $ \mathbb {F}$p[X], where {y,ff->size_p} is understood as a mpn operand.
void mpffn_pol_mul_ui(mp_ptr r, mp_srcptr x, mp_size_t lt, unsigned long int y, const mpffn_field *ff)
Set {r, lt} to {x, lty in $ \mathbb {F}$p[X].
void mpffn_pol_neg(mp_ptr r, mp_srcptr x, mp_size_t lt, const mpffn_field *ff)
Set {r, lt} to - {x, lt} in $ \mathbb {F}$p[X].
size_t mpffn_pol_out_str(FILE *STREAM, int base, mp_srcptr x, mp_size_t l, const mpffn_field *ff)
Output {x, l} on stdio stream STREAM, in GP format. This function is currently only for debugging purpose. Return the number of bytes written, or if an error occurred, return 0.
void mpffn_pol_recip(mp_ptr r, mp_srcptr x, mp_size_t l, const mpffn_field *ff)
Set {r, l} to {x, l} written backward: If P = {x, l}, set {r, l} to XlP(1/X).
int mpffn_pol_sgn(mp_srcptr x, mp_size_t l, const mpffn_field *ff)
Return 1 if {x, l} $ \neq$ 0, 0 if x = 0.
void mpffn_pol_sub(mp_ptr r, mp_srcptr x, mp_srcptr y, mp_size_t lt, const mpffn_field *ff)
Set {r, lt} to {x, lt} - {y, lt} in $ \mathbb {F}$p[X].
void mpffn_pol_zero(mp_ptr r, mp_size_t l, const mpffn_field *ff)
Set r to 0 in ff.

mp_size_t mpffn_length(mp_srcptr x, const mpffn_field *ff)
return one plus the degree of the underlying polynomial of x.
void mpffn_pol_montgomery(mp_ptr r, mp_srcptr x, mp_size_t l, const mpffn_field *ff)
Compute x/polrecip(P) + O(xn)
next up previous
Next: About this document ... Up: Documented Private Function Previous: Documented Private Function
Bill Allombert 2003-07-01