Karim BELABAS on Thu, 25 Oct 2001 11:41:44 +0200 (MEST)

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

 Re: Problems with nfhilbert() in CVS (pari 2.2.2)

```On Thu, 25 Oct 2001, Martin Aumueller wrote:
> When using nfhilbert() in the local case for a prime dividing 2 I
> discovered the following two types of problems:
>
> To trigger the first kind I type this into gp:
>
> 	nf=nfinit(X^2+1)
> 	nfhilbert(nf,[1,-2]~,[1,-2]~,idealprimedec(nf,2)[1])
>
> I get this:
>
> 	  ***   the PARI stack overflows !
> 	  current stack size: 4000000 (3.815 Mbytes)
> 	  [hint] you can increase GP stack with allocatemem()
>
> Now I continue:
>
> 	allocatemem(300000000);
> 	nfhilbert(nf,[1,-2]~,[1,-2]~,idealprimedec(nf,2)[1])
>
> The answer is:
>
> 	  ***   bug in GP (Segmentation Fault), please report
>
>
> And the second kind of problem is seen when typing:
>
> 	nf=nfinit(X^2+3)
> 	nfhilbert(nf,[3,0]~,[3,0]~,idealprimedec(nf,2)[1])
>
> But now pari says to me:
>
> 	  ***   [Mod(3, X^2 + 3), 0]~ not a nfelt.
>
>
> I checked the above with today's pari 2.2.2 from CVS. I didn't yet
> have the time to explore this any further, but as soon as I do I
> will have a closer look. But perhaps someone is more familiar
> with the code to come up with a quick solution.

Hi,

for some reason, this routine (nfhilbertp, prime dividing 2) expected its
input arguments in 'alg' (e.g t_POLMOD) format [ the generic routine didn't
care ], and did not check it was indeed the case. The following patch makes
it accept generic 'number field elements'.

It fixes both problems (applies to stable and unstable releases).

Thanks,

Karim.

Index: src/basemath/buch4.c
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/basemath/buch4.c,v
retrieving revision 1.15
diff -c -r1.15 buch4.c
*** src/basemath/buch4.c	2001/10/01 12:11:30	1.15
--- src/basemath/buch4.c	2001/10/25 09:33:23
***************
*** 361,367 ****
{
ulong av = avma;
long rep;
!   GEN pol = coefs_to_pol(3, lift(a), zero, lift(b));
/* varn(nf.pol) = 0, pol is not a valid GEN  [as in Pol([x,x], x)].
* But it is only used as a placeholder, hence it is not a problem */

--- 361,371 ----
{
ulong av = avma;
long rep;
!   GEN pol;
!
!   if (typ(a) != t_POLMOD) a = basistoalg(nf, a);
!   if (typ(b) != t_POLMOD) b = basistoalg(nf, b);
!   pol = coefs_to_pol(3, lift(a), zero, lift(b));
/* varn(nf.pol) = 0, pol is not a valid GEN  [as in Pol([x,x], x)].
* But it is only used as a placeholder, hence it is not a problem */

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