10 assert(mpz_sgn(m) > 0);
13 int bit_len = mpz_sizeinbase(m, 2) - 1;
16 mpz_t * coeff = malloc(size *
sizeof(*coeff));
18 mpz_init_set(coeff[0], d);
19 for (
int i = 1; i < size; i++) {
22 mpz_mod(coeff[i], coeff[i], m);
26 assert(mpz_cmp(poly->
coeff[0], d) == 0);
28 for (
int i=1; i < size; i++){
29 assert(mpz_cmp(poly->
coeff[i], m) < 0);
37 mpz_t * coeff = poly->
coeff;
39 for(i=0; i<poly->
size; i++) {
51 mpz_t * coeff = poly->
coeff;
52 int size = poly->
size;
58 for (
int k=size - 1; k >= 0; k--) {
61 mpz_add(y, y, coeff[k]);
72 mpz_init_set_ui(x, op);
void random_dev(mpz_t rop, int bit_len)
void poly_eval(mpz_t rop, poly_t *poly, mpz_t x)
void clear_poly(poly_t *poly)
poly_t * create_random_poly(mpz_t d, size_t size, mpz_t m)
void poly_eval_ui(mpz_t rop, poly_t *poly, unsigned long op)