Jacobi/Legendre/Kronecker

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Thu Dec 20 12:38:28 CET 2012


Ciao Niels,

Il Gio, 20 Dicembre 2012 11:47 am, Niels Möller ha scritto:
> bodrato at mail.dm.unipi.it writes:
>
>> I tested some changes and I suggest the attached patch: unconditionally
>> reduce modulo b.
>
> I'm not sure. In this case, the macro expands to a function call which
> basicallly does a % b. Since division usually is expensive, I think that
> can be faster only if a is many bits larger than b, so we reduce the

You are right.

Perhaps refining the condition is a better strategy.
I propose to change (asize>1) into (asize>(alow<(blow>>16))).

The small patch is attached. It heals the regression pointed by Paul, on
my atom, and it should not slow down if a and b are close.

Regards,
m

PS: the constant 16, is the same used for a similar purpose in
mpn/generic/gcd_1.c .

-- 
http://bodrato.it/software/strassen.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jacobi.diff
Type: text/x-patch
Size: 514 bytes
Desc: not available
URL: <http://gmplib.org/list-archives/gmp-devel/attachments/20121220/993ef017/attachment.bin>


More information about the gmp-devel mailing list