Request: mpz_addmul_2exp

abbott at abbott at
Wed May 10 21:47:27 CEST 2023


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?

More information about the gmp-discuss mailing list