Karim.Belabas on Tue, 6 Feb 2001 19:32:27 +0100 (MET)


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

Re: finite field


On Thu, 21 Dec 2000, Gerhard Niklasch wrote:

> .... f=polcyclo(7);factormod(f,2);
>      g=%[1,1];xi0=Mod(x,g)*Mod(1,2);
> (23:25) gp > xi_pwr=vector(7,j,xi0^j);
> (23:27) gp > xi_dlg=vector(7,j,0); 
> (23:27) gp > xi_idx(y)=subst(lift(lift(y)),x,2);
> (23:30) gp > xi_idx(xi0)
> %14 = 2
> ...
> (23:35) gp > xi_idx(xi0^4)
> %25 = 6
> ...
> (23:35) gp > xi_pwr[2]
> %27 = Mod(Mod(1, 2)*x^2, Mod(1, 2)*x^3 + Mod(1, 2)*x + Mod(1, 2))
> (23:35) gp > for(j=1,7,xi_dlg[xi_idx(xi_pwr[j])=j);
>   ***   expected character: ']' instead of: ...i_dlg[xi_idx(xi_pwr[j])=j);
>                                                                         ^--
> 
> (rats, too late in the night to get my brackets right... %^)
> 
> (23:37) gp > for(j=1,7,xi_dlg[xi_idx(xi_pwr[j])]=j);
>   ***   expected character: ',' instead of: xi_dlg[xi_idx(xi_pwr[j])]=j);
[...]
> It seems that gp, whilst the parser was bailing out from my syntax
> error in the input line following %25, had alzheimered away the
> definition of my function xi_idx.
[...]
> On a hunch, the first syntax error may be setting some flag in gp's
> symbol table marking xi_idx as about-to-be-redefined, without yet
> removing the existing definition.

Nice analysis. The fix happens to be quite trivial: I had forgotten to
initialize the corresponding global flag...

  Karim.

Index: anal.c
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/language/anal.c,v
retrieving revision 1.48
diff -c -r1.48 anal.c
*** anal.c	2001/02/02 16:43:04	1.48
--- anal.c	2001/02/06 18:17:34
***************
*** 199,205 ****
    if (foreignExprHandler && *t == foreignExprSwitch)
      return (*foreignExprHandler)(t);
  
!   check_new_fun=NULL; skipping_fun_def=0;
    mark.start = analyseur = t;
  
    br_status = br_NONE;
--- 199,207 ----
    if (foreignExprHandler && *t == foreignExprSwitch)
      return (*foreignExprHandler)(t);
  
!   redefine_fun = NULL;
!   check_new_fun = NULL;
!   skipping_fun_def = 0;
    mark.start = analyseur = t;
  
    br_status = br_NONE;

-- 
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://www.parigp-home.de/