fac_ui rewrote.
Torbjorn Granlund
tg at gmplib.org
Wed Dec 7 20:30:47 CET 2011
bodrato at mail.dm.unipi.it writes:
I'm starting to integrate the new factorial code I wrote one year ago into
the library.
Currently I simply replaced the previous mpz/fac_ui.c file with a new one.
The code contains three implementations for the factorial:
mpz_bc_fac_1(x,n), computes the product of 2..n with almost balanced
products;
mpz_bc_oddfac_1(x,n), likewise computes n! with every even factor removed;
mpz_dsc_oddfac_1(x,n), computes the odd part of n!, asymptotically fast.
The speedup with the new code is better than I had anticipated. Cool!
There is a step (for the old and new code) at about n=20. Only for
640<n<4200 the speedup is small.
Would you consider migrating this to mpn at some point, or is there a
reason to keep it at mpz? (This is no urgency, and I just want to hear
your opinon.)
--
Torbjörn
More information about the gmp-devel
mailing list