fac_ui rewrote.

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Wed Dec 7 20:20:39 CET 2011


Ciao!

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 even factor is handled by mpz_fac_ui, that uses two thresholds to
decide the algorithm to be used: FAC_ODD_THRESHOLD, and FAC_DSC_THRESHOLD.

The thresholds are currently hard-coded, but this obviously is suboptimal.

The code needs:
FAC_ODD_THRESHOLD < FAC_DSC_THRESHOLD < FAC_DSC_THRESHOLD_LIMIT = 1024

Unfortunately there is no threshold in any mpz implementation yet, or I
can not find any... I suppose that tune/Makefile.am should be modified to
recompile mpz/fac_ui.c for tuning, but I do not know how to do this.

Can someone help my in this tuning process?

Thanks,
Marco

-- 
http://bodrato.it/software/combinatorics.html






More information about the gmp-devel mailing list