Karim BELABAS on Wed, 2 Jun 1999 16:42:43 +0200 (MET DST)


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

Re: idealval and galoisapply in 2.15


[Paul van Wamenlen:]
> The following computes a set of representatives for the galois group
> modulo the decomposition group for a prime above 11 in the 5'th roots
> of unity. In version 2.14 it worked, in 2.15 it fails. Also, according
> to the documentation, nfgaloisapply can take a prime ideal in primedec
> form as a third argument. But gp gives an error message.

Which message? In 2.0.15, I get, eg.

? nfgaloisapply(bnf,gal[3],PPs[1])
%1 = [11, [5, -1, -1, -1]~, 1, 1, [4, 2, 3, -3]~]

If you mean 

? nfgaloisapply(bnf,gal[3],PPs)
  ***   incorrect type in galoisapply.

then this is intended.
[Use: vector(length(PPs), i, nfgaloisapply(bnf,gal[3],PPs[i]))]

==============================================================
I notice two bugs though:

* idealval(nf,I,P) doesn't accept primes in primedec form for I.

* a typo in nfgaloisapply (!= --> ==) hence the result was not necessarily in
HNF form.

Patches follow. 

==============================================================
Some comments about the program:

> bnf = bnfinit(polcyclo(5));
> PPs = idealprimedec(bnf,11);\
> P = idealmul(bnf,1,PPs[1]);\

Better: P = idealhnf(bnf,PPs[1]);

> gal = nfgaloisconj(bnf);\

Here, it's irrelevant since the field is quite simple, but you might want to
try (and test...) nfgaloisconj(bnf, 4) which will be much quicker than the
default when it applies (and return 0 quickly if it doesn't).

> GmodD = vector(length(PPs),k,0);\
> for(i=1,length(gal),\
>    dum2 = nfgaloisapply(bnf,gal[i],P);\
>    for(j=1,length(PPs),\
>      if(idealval(bnf,dum2,PPs[j]) == 1,\
>        GmodD[j] = gal[i])));\
> GmodD

A (slightly) better approach, using the fact that two ideals are equal iff
their HNF (on a fixed basis) coincide:

{
  HNFs = Set(vector(length(PPs), i, idealhnf(bnf,PPs[i])));
  GmodD = vector(length(gal), i,
    if (setsearch(HNFs, nfgaloisapply(bnf,gal[i],P)),
      gal[i]
    )
  );
}

Karim.

*** src/basemath/base1.c.orig	Thu May 27 15:03:39 1999
--- src/basemath/base1.c	Wed Jun  2 16:33:00 1999
***************
*** 631,637 ****
        if (lg(x[1])!=N+1) err(typeer,"galoisapply");
        p1=cgetg(lx,t_MAT);
        for (j=1; j<lx; j++) p1[j]=(long)galoisapply(nf,aut,(GEN)x[j]);
!       if (lg(x)!=N+1) p1 = idealhermite(nf,p1);
        return gerepileupto(av,p1);
    }
    err(typeer,"galoisapply");
--- 631,637 ----
        if (lg(x[1])!=N+1) err(typeer,"galoisapply");
        p1=cgetg(lx,t_MAT);
        for (j=1; j<lx; j++) p1[j]=(long)galoisapply(nf,aut,(GEN)x[j]);
!       if (lx==N+1) p1 = idealhermite(nf,p1);
        return gerepileupto(av,p1);
    }
    err(typeer,"galoisapply");
*** src/basemath/base4.c.orig   Thu May 27 18:42:43 1999
--- src/basemath/base4.c        Wed Jun  2 15:59:47 1999
***************
*** 608,619 ****
  
    nf=checknf(nf); checkprimeid(vp);
    if (is_extscalar_t(tx) || tx==t_COL) return element_val(nf,ix,vp);
! 
!   if (typ(ix)==t_VEC && lg(ix)==3) ix = (GEN) ix[1];
!   N=lgef(nf[1])-3; checkid(ix,N); p=(GEN)vp[1];
! 
    denx=denom(ix); if (!gcmp1(denx)) ix=gmul(denx,ix);
    if (lg(ix) != N+1) ix=idealmat_to_hnf(nf,ix);
    for (d=gun,i=1; i<=N; i++) d=mulii(d,gcoeff(ix,i,i));
    v=ggval(d,p); vd=ggval(denx,p); e=itos((GEN)vp[3]);
    if (!v) return -vd*e;
--- 610,625 ----
  
    nf=checknf(nf); checkprimeid(vp);
    if (is_extscalar_t(tx) || tx==t_COL) return element_val(nf,ix,vp);
!   p=(GEN)vp[1]; N=lgef(nf[1])-3;
!   tx = idealtyp(&ix,&a);
    denx=denom(ix); if (!gcmp1(denx)) ix=gmul(denx,ix);
+   if (tx != id_MAT)
+     ix = idealhermite_aux(nf,ix);
+   else
+   {
+     checkid(ix,N);
      if (lg(ix) != N+1) ix=idealmat_to_hnf(nf,ix);
+   }
    for (d=gun,i=1; i<=N; i++) d=mulii(d,gcoeff(ix,i,i));
    v=ggval(d,p); vd=ggval(denx,p); e=itos((GEN)vp[3]);
    if (!v) return -vd*e;
__
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/