Roland Dreier on Thu, 8 Oct 1998 15:04:53 -0500 (CDT)


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

fix for factorization over finite fields.


I tracked down (I think) the bug in factorization over finite fields that
I found earlier.  When gp found a factor of multiplicity p, it took the
pth root by simply dividing all the exponents by p without taking the pth
roots of the coefficients.  Here's my quick and dirty fix.  No doubt this
should be made safer.

*** src/basemath/polarit1.c.orig        Thu Jul 23 08:40:23 1998
--- src/basemath/polarit1.c     Thu Oct  8 15:01:24 1998
***************
*** 1595,1598 ****
--- 1595,1599 ----
    GEN ex,y,f2,f3,df1,df2,g,g1,xmod,u,v,pd,q,qq,unfp,unfq;
    GEN *t;
+   long frobinv = itos(gpowgs(pp,lgef(a)-4));

    if (typ(a)!=t_POL || typ(f)!=t_POL || gcmp0(a)) err(factmoder);
***************
*** 1616,1620 ****
        j=(lgef(f)-3)/p+3; f2=cgetg(j,t_POL);
        f2[1] = evalsigne(1) | evallgef(j) | evalvarn(vf);
!       for (i=2; i<j; i++) f2[i]=f[p*(i-2)+2];
        f=f2; df1=deriv(f,vf); f3=NULL;
      }
--- 1617,1621 ----
        j=(lgef(f)-3)/p+3; f2=cgetg(j,t_POL);
        f2[1] = evalsigne(1) | evallgef(j) | evalvarn(vf);
!       for (i=2; i<j; i++) f2[i]=gpuigs((GEN) f[p*(i-2)+2],frobinv);
        f=f2; df1=deriv(f,vf); f3=NULL;
      }

Roland