Bill Allombert on Thu, 17 Mar 2005 10:53:32 +0100

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: modular square roots

On Sun, Mar 13, 2005 at 12:05:58AM +0100, Bill Allombert wrote:
> We normally use Tonelli-Shanks, but we use Cipolla algorithm if e=v_2(p)
> is large: see
> src/basemath/arith1.c: line 1312
>   /* If `e' is "too big", use Cipolla algorithm ! [GTL] */
>     if (e*(e-1) > 20 + 8 * bit_accuracy(lgefint(p)))    
> Would you propose a different criterion ?

Gonzalo Tornaria told me that this criterion was optimal for random
values of the radicand in average, but it was not for -1 and powers of

So eventually we could special case -1 and use another criterion in that

I just commited a change proposed by Gonzalo that should make things
a bit faster for -1.