"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/basemath/arith1.c" between
pari-2.13.0.tar.gz and pari-2.13.1.tar.gz

About: PARI/GP is a computer algebra system designed for fast computations in number theory (factorizations, algebraic number theory, elliptic curves...), but also contains a large number of other mathematical functions.

arith1.c  (pari-2.13.0):arith1.c  (pari-2.13.1)
skipping to change at line 1163 skipping to change at line 1163
{ {
q = powiu(p, (s+1)>>1); q = powiu(p, (s+1)>>1);
Q0 = mulii(Q0, q); continue; Q0 = mulii(Q0, q); continue;
} }
/* d > 0 */ /* d > 0 */
if (odd(t)) return NULL; if (odd(t)) return NULL;
t2 = t >> 1; t2 = t >> 1;
if (i > 1) if (i > 1)
{ /* p > 2 */ { /* p > 2 */
if (kronecker(D0, p) == -1) return NULL; if (kronecker(D0, p) == -1) return NULL;
q = powiu(p,s-t2); q = powiu(p, s - t2);
f = Zp_sqrt(D0, p, d); f = Zp_sqrt(D0, p, d);
if (!f) return NULL; /* p was not actually prime... */ if (!f) return NULL; /* p was not actually prime... */
if (t2) f = mulii(powiu(p,t2), f); if (t2) f = mulii(powiu(p,t2), f);
mf = Fp_neg(f, q); mf = Fp_neg(f, q);
} }
else else
{ /* p = 2 */ { /* p = 2 */
if (d == 1) { Q0 = int2n(1+t2); F0 = NULL; continue; } if (d <= 3)
if (d == 2)
{ {
if (Mod4(D0) != 1) return NULL; if (d == 3 && Mod8(D0) != 1) return NULL;
if (d == 2 && Mod4(D0) != 1) return NULL;
Q0 = int2n(1+t2); F0 = NULL; continue; Q0 = int2n(1+t2); F0 = NULL; continue;
} }
/* d > 2 */
if (Mod8(D0) != 1) return NULL; if (Mod8(D0) != 1) return NULL;
q = int2n(d-1+t2); q = int2n(d - 1 + t2);
f = shifti(Z2_sqrt(D0, d), t2); f = Z2_sqrt(D0, d);
if (t2) f = shifti(f, t2);
mf = Fp_neg(f, q); mf = Fp_neg(f, q);
} }
gel(Q,j) = q; gel(Q,j) = q;
gel(F,j) = f; gel(F,j) = f;
gel(mF,j)= mf; j++; gel(mF,j)= mf; j++;
} }
setlg(Q,j); setlg(Q,j);
setlg(F,j); setlg(F,j);
setlg(mF,j); setlg(mF,j);
if (is_pm1(Q0)) A = leafcopy(F); if (is_pm1(Q0)) A = leafcopy(F);
skipping to change at line 3669 skipping to change at line 3669
if (!signe(y)) { set_avma(av); return gen_0; } if (!signe(y)) { set_avma(av); return gen_0; }
} }
if (lgefint(K) == 3) return gerepileuptoint(av, Fp_powu(y, K[2], N)); if (lgefint(K) == 3) return gerepileuptoint(av, Fp_powu(y, K[2], N));
base_is_2 = 0; base_is_2 = 0;
sy = abscmpii(y, shifti(N,-1)) > 0; sy = abscmpii(y, shifti(N,-1)) > 0;
if (sy) y = subii(N,y); if (sy) y = subii(N,y);
sA = sy && mod2(K); sA = sy && mod2(K);
if (lgefint(y) == 3) switch(y[2]) if (lgefint(y) == 3) switch(y[2])
{ {
case 1: return sA ? gen_m1 : gen_1; case 1: set_avma(av); return sA ? subis(N,1): gen_1;
case 2: base_is_2 = 1; break; case 2: base_is_2 = 1; break;
} }
/* TODO: Move this out of here and use for general modular computations */ /* TODO: Move this out of here and use for general modular computations */
use_montgomery = Fp_select_red(&y, 0UL, N, lN, &D, &E); use_montgomery = Fp_select_red(&y, 0UL, N, lN, &D, &E);
if (base_is_2) if (base_is_2)
y = gen_pow_fold_i(y, K, E, D.sqr, D.mul2); y = gen_pow_fold_i(y, K, E, D.sqr, D.mul2);
else else
y = gen_pow_i(y, K, E, D.sqr, D.mul); y = gen_pow_i(y, K, E, D.sqr, D.mul);
if (use_montgomery) if (use_montgomery)
 End of changes. 6 change blocks. 
8 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)