Request: mpz_addmul_2exp

abbott at dima.unige.it abbott at dima.unige.it
Wed May 10 21:47:27 CEST 2023


Hi,

I'd like to have  mpz_addmul_2exp.
The application is evaluating a univariate polynomial with "small integer"
coefficients at x=2  (or x=2^k some k).

Outline application code:
   vector<mpz_class>  coeffs = ...
   int d = deg(...);
   mpz_class val = mpz_mul_2exp(coeffs[d], d);
   for (int i=d-1; i >= 0; --i)
      mpz_addmul_2exp(val, coeffs[i], i);

[[I know I am mixing mpz_class and mpz_t]]
If the coeffs are small, this should be nearly linear time, I hope.

Any chance?
Thanks,
John.



More information about the gmp-discuss mailing list