Karim BELABAS on Fri, 19 Mar 1999 18:14:57 +0100 (MET)


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

Re: quadray() bug


[Igor:]
> looks like this function is new and haven't been thoroughly tested:
> 
> ? nfdisc(x^2-x-50)
> 201
> ? quadray(201,idealprimedec(nfinit(x^2-x-50),5))
>   ***   incorrect archimedean component in zidealstarinit.

Bad input. Output of idealprimedec is a vector of two prime ideals,
which is thought to be an idele at first (vector of two elements, the first
being a prime ideal, the second being the "archimedean component"). 

The archimedean component is then analyzed more thouroughly raising an error.

> ? quadray(201,5)
>   ***   bus error: bug in GP (please report).
> 
> ? quadray(13,5)
>   ***   not an integer argument in an arithmetic function

Patch following.

> Also, manual says that the second argument of quadray() is a
> conductor f.  I think it's also useful to mention, of what shape
> the conductor can assume (a prime, a 5-component vector representing a
> prime ideal, etc. )

It's (what PARI calls) an "idele", see ?? bnr (I'm adding "ideal" and "idele"
to the keywords recognized by the online help...)

Karim.

*** src/basemath/base3.c.orig   Wed Mar 17 09:03:14 1999
--- src/basemath/base3.c        Fri Mar 19 18:07:11 1999
***************
*** 1036,1045 ****
    p1 = addsi(-1, gpowgs(p,f));
    if (isnfscalar(x))
    {
      if (gcmp1(x) || egalii((GEN)pr[1], gdeux)) { avma = av; return gzero; }
!     if (egalii((GEN)x[1], p1)) return gerepileuptoint(av,shifti(p1,-1));
!     v = gpowgs(p,f-1); g0 = element_powmodpr(nf,g0,v,prhall);
!     return gerepileuptoint(av, mulii(v, Fp_shanks((GEN)x[1],(GEN)g0[1],p)));
    }
    p1 = racine(p1);
    if (cmpis(p1,LGBITS) >= 0) err(talker,"module too large in nfshanks");
--- 1036,1047 ----
    p1 = addsi(-1, gpowgs(p,f));
    if (isnfscalar(x))
    {
+     x = (GEN)x[1];
      if (gcmp1(x) || egalii((GEN)pr[1], gdeux)) { avma = av; return gzero; }
!     if (egalii(x, p1)) return gerepileuptoint(av,shifti(p1,-1));
!     v = divii(p1, addsi(-1,p));
!     g0 = lift_intern((GEN)element_powmodpr(nf,g0,v,prhall)[1]);
!     return gerepileuptoint(av, mulii(v, Fp_shanks(x,g0,p)));
    }
    p1 = racine(p1);
    if (cmpis(p1,LGBITS) >= 0) err(talker,"module too large in nfshanks");
(18:09)(*1) orkay-karim > odiff src/basemath/base4.c.orig
*** src/basemath/base4.c.orig   Fri Mar  5 08:51:38 1999
--- src/basemath/base4.c        Fri Mar 19 17:51:40 1999
***************
*** 104,109 ****
--- 104,110 ----
  prime_to_ideal(GEN nf, GEN vp)
  {
    long av=avma;
+   if (typ(vp) == t_INT) return gscalmat(vp, lgef(nf[1])-3);
    return gerepileupto(av, prime_to_ideal_aux(nf,vp));
  }
  

--
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/