mul vs sqr
tg at swox.com
Tue Apr 20 12:31:34 CEST 2004
Paul.Zimmermann at loria.fr (Paul Zimmermann) writes:
I see that mpn_mul() starts by checking for a square:
if (up == vp && un == vn)
mpn_sqr_n (prodp, up, un);
return prodp[2 * un - 1];
This is contrary to the gmp-philosophy "use special functions
for special cases" (for example mpn_mul_2exp).
Why is mpn_sqr_n not exported?
We have tried to keep the set of exported mpn functions small, to
allow for changes. For the next major GMP release, the set of
exported mpn functions will increase a lot, and some current
non-exported functions will indeed change.
Similarly, we might want a "sqr"
function for other classes (mpz, mpf, mpq).
At these function levels, we want to simplify it for our dear
users by automatically detecting their squaring. For some reason
I cannot recall, we decided to push that detection down to
More information about the gmp-devel