Karim BELABAS on Fri, 4 Jun 1999 16:07:45 +0200 (MET DST)


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

Re: new 2.0.15 bug


[Igor:]
> ? setrand(10);thue(thueinit(x^3+2700*x-12),97)
>   ***   too many iterations in isprincipal.

It's in fact not a new bug. The new code in idealprimedec modifies the random
seed. If one resets it internally to the same value both version run to the
same result (error message, or success depending on the seed).

The errror is raised when an ideal could not be split after a certain number
of trials. I'm removing this bound completely. It has no sensible heuristic
basis anyway...

Karim.

*** src/basemath/buch2.c.orig	Thu May 27 19:06:42 1999
--- src/basemath/buch2.c	Fri Jun  4 16:04:45 1999
***************
*** 664,674 ****
  /* factor x on vectbase (modulo principal ideals) */
  static GEN
  split_ideal(GEN nf, GEN x, GEN xar, long prec, GEN vperm, long colmit,
!             long colnew, long force)
  {
    GEN id,vdir,x0,y,p1;
    long v1,v2,nbtest,bou,i, ru = lg(xar);
-   int MAXITER = force? -1: 50;
    int flag = (gexpo(gcoeff(x,1,1)) < 100);
  
    if (flag && factorgensimple(nf,x)) return xar;
--- 664,673 ----
  /* factor x on vectbase (modulo principal ideals) */
  static GEN
  split_ideal(GEN nf, GEN x, GEN xar, long prec, GEN vperm, long colmit,
!             long colnew)
  {
    GEN id,vdir,x0,y,p1;
    long v1,v2,nbtest,bou,i, ru = lg(xar);
    int flag = (gexpo(gcoeff(x,1,1)) < 100);
  
    if (flag && factorgensimple(nf,x)) return xar;
***************
*** 721,728 ****
          add_to_fact(l,v1,-ex1);
          add_to_fact(l,v2,-ex2); return (GEN)y[2];
        }
-       if (nbtest == MAXITER)
-         err(talker, "too many iterations in isprincipal");
      }
    }
  }
--- 720,725 ----
***************
*** 763,769 ****
  
    colmit=lg(mit)-1; colnew=lg(matalpha)-1;
    xar=cgetg(RU+1,t_VEC); for (i=1; i<=RU; i++) xar[i]=zero;
!   p1 = split_ideal(nf,x,xar,prec,vperm,colmit,colnew, (flall&nf_FORCE));
    if (p1 != xar) xar = cleancol(p1,N,prec);
  
    xalpha=cgetg(colmit+1,t_COL); for (i=1; i<=colmit; i++) xalpha[i]=zero;
--- 760,766 ----
  
    colmit=lg(mit)-1; colnew=lg(matalpha)-1;
    xar=cgetg(RU+1,t_VEC); for (i=1; i<=RU; i++) xar[i]=zero;
!   p1 = split_ideal(nf,x,xar,prec,vperm,colmit,colnew);
    if (p1 != xar) xar = cleancol(p1,N,prec);
  
    xalpha=cgetg(colmit+1,t_COL); for (i=1; i<=colmit; i++) xalpha[i]=zero;
__
Karim Belabas                    email: Karim.Belabas@math.u-psud.fr
Dep. de Mathematiques, Bat. 425
Universite Paris-Sud             Tel: (00 33) 1 69 15 57 48
F-91405 Orsay (France)           Fax: (00 33) 1 69 15 60 19
--
PARI/GP Home Page: http://hasse.mathematik.tu-muenchen.de/ntsw/pari/