"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/basemath/RgX.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.

RgX.c  (pari-2.13.0):RgX.c  (pari-2.13.1)
skipping to change at line 2385 skipping to change at line 2385
GEN W, a; GEN W, a;
long v = varn(f), n = 1; long v = varn(f), n = 1;
if (!signe(f)) pari_err_INV("RgXn_inv",f); if (!signe(f)) pari_err_INV("RgXn_inv",f);
a = ginv(gel(f,2)); a = ginv(gel(f,2));
if (e == 1) return scalarpol(a, v); if (e == 1) return scalarpol(a, v);
else if (e == 2) else if (e == 2)
{ {
GEN b; GEN b;
if (degpol(f) <= 0 || gequal0(b = gel(f,3))) return scalarpol(a, v); if (degpol(f) <= 0 || gequal0(b = gel(f,3))) return scalarpol(a, v);
av = avma; b = gneg(b); b = gneg(b);
if (!gequal1(a)) b = gmul(b, gsqr(a)); if (!gequal1(a)) b = gmul(b, gsqr(a));
W = deg1pol_shallow(b, a, v); return deg1pol(b, a, v);
return gcopy(W);
} }
av = avma;
W = scalarpol_shallow(a,v); W = scalarpol_shallow(a,v);
mask = quadratic_prec_mask(e); mask = quadratic_prec_mask(e);
av = avma; while (mask > 1)
for (;mask>1;)
{ {
GEN u, fr; GEN u, fr;
long n2 = n; long n2 = n;
n<<=1; if (mask & 1) n--; n<<=1; if (mask & 1) n--;
mask >>= 1; mask >>= 1;
fr = RgXn_red_shallow(f, n); fr = RgXn_red_shallow(f, n);
u = RgXn_mul(W, RgXn_mulhigh(fr, W, n2, n), n-n2); u = RgXn_mul(W, RgXn_mulhigh(fr, W, n2, n), n-n2);
W = RgX_sub(W, RgX_shift_shallow(u, n2)); W = RgX_sub(W, RgX_shift_shallow(u, n2));
if (gc_needed(av,2)) if (gc_needed(av,2))
{ {
skipping to change at line 2460 skipping to change at line 2459
case code(t_POLMOD, t_INTMOD): case code(t_POLMOD, t_INTMOD):
return RgXn_inv_FpXQX(x, e, pol, p); return RgXn_inv_FpXQX(x, e, pol, p);
default: return NULL; default: return NULL;
} }
} }
#undef code #undef code
GEN GEN
RgXn_inv(GEN f, long e) RgXn_inv(GEN f, long e)
{ {
pari_sp av = avma;
GEN h = RgXn_inv_fast(f, e); GEN h = RgXn_inv_fast(f, e);
if (h) return h; if (h) return h;
return RgXn_inv_i(f, e); return gerepileupto(av, RgXn_inv_i(f, e));
} }
/* Compute intformal(x^n*S)/x^(n+1) */ /* Compute intformal(x^n*S)/x^(n+1) */
static GEN static GEN
RgX_integXn(GEN x, long n) RgX_integXn(GEN x, long n)
{ {
long i, lx = lg(x); long i, lx = lg(x);
GEN y; GEN y;
if (lx == 2) return RgX_copy(x); if (lx == 2) return RgX_copy(x);
y = cgetg(lx, t_POL); y[1] = x[1]; y = cgetg(lx, t_POL); y[1] = x[1];
 End of changes. 6 change blocks. 
6 lines changed or deleted 6 lines changed or added

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