mpn_powm not documented -- an oversight?

Will Galway galway at math.uiuc.edu
Mon Oct 1 23:14:02 CEST 2012


I've just run a test comparing the speed of mpz_powm(...) against that 
of mpn_powm(...).  (Not against gmp_powm--of course there is no gmp_powm 
despite my typo in my earlier message.)

Mytest was run on a Core i7-870 processor, where type mp_limb_t is a 
64-bit unsigned integer.  The test computed 2^A modulo B, for many 
64-bit values of B and with A fixed at roughly 30000.  I found 
mpn_powm(...) to be less than 10% faster than mpz_powm(...). Of course, 
other people's experience might vary, depending on the architecture 
they're using.

I'd expect the speed difference to be even less when working with 
multi-limb arguments, so I feel there is no need to make mpn_powm(...) 
"public".  It's alsoa spectacular example of just how efficient GMP is!

-- Regards, Will

On 2012-09-28 14:44, Will Galway wrote:
> Thanks for the comments Paul.  As to the usefulness of putting 
> gmp_powm into the public interface, I'd guess that it would 
> considerably speed-up my particular application, but I'll have to 
> benchmark it before knowing for sure.  If it IS much faster, I'll send 
> another report.  (If it isn't much faster, I doubt I'll bother to 
> report it.)
>
> -- Regards, Will
>
> On 2012-09-28 12:02, Zimmermann Paul wrote:
>>         Will,
>>
>>> I don't know if it's intentional or not, but I can't find an entry in
>>> the GNU MP 5.0.5 manual for the mpn_powm function, defined in
>>> mpn/powm.c.  Is this to discourage people from calling the routine?
>> I don't think so. There are many internal GMP functions which are not 
>> in the
>> public interface.
>>
>> If you believe it would be useful to have it in the public interface, 
>> just ask.
>>
>> Paul Zimmermann
>



More information about the gmp-discuss mailing list