=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/engine/Hgfs.c,v retrieving revision 1.21 retrieving revision 1.23 diff -u -p -r1.21 -r1.23 --- OpenXM_contrib2/asir2000/engine/Hgfs.c 2001/11/19 00:57:11 1.21 +++ OpenXM_contrib2/asir2000/engine/Hgfs.c 2002/09/27 08:40:48 1.23 @@ -1,6 +1,7 @@ -/* $OpenXM: OpenXM_contrib2/asir2000/engine/Hgfs.c,v 1.20 2001/10/30 10:24:35 noro Exp $ */ +/* $OpenXM: OpenXM_contrib2/asir2000/engine/Hgfs.c,v 1.22 2002/09/27 04:24:04 noro Exp $ */ #include "ca.h" +#include "inline.h" void lnfsf(int n,UM p0,UM p1,struct p_pair *list,UM np0,UM np1); void extractcoefbm(BM f,int dx,UM r); @@ -649,7 +650,7 @@ int sfberle(VL vl,P f,int count,GFS *ev,DCP *dcp) V x,y; P lc,lc0,f0; Obj obj; - int j,q1,index,i; + int j,q,index,i; clctv(vl,f,&nvl); vl = nvl; x = vl->v; y = vl->next->v; @@ -657,11 +658,11 @@ int sfberle(VL vl,P f,int count,GFS *ev,DCP *dcp) n = QTOS(DEG(DC(f))); wf = W_UMALLOC(n); wf1 = W_UMALLOC(n); wf2 = W_UMALLOC(n); wfs = W_UMALLOC(n); gcd = W_UMALLOC(n); - q1 = field_order_sf()-1; + q = field_order_sf(); lc = DC(f)->c; for ( j = 0, fn = n + 1, index = 0; - index < q1 && j < count && fn > 1; index++ ) { - MKGFS(index,m); + index < q && j < count && fn > 1; index++ ) { + indextogfs(index,&m); substp(vl,lc,y,(P)m,&lc0); if ( lc0 ) { substp(vl,f,y,(P)m,&f0); @@ -677,7 +678,7 @@ int sfberle(VL vl,P f,int count,GFS *ev,DCP *dcp) } } } - if ( index == q1 ) + if ( index == q ) return 0; else if ( fn == 1 ) return 1; @@ -864,7 +865,7 @@ void sfbmtop(BM f,V x,V y,P *fp) if ( DEG(c[j]) >= i && (a = COEF(c[j])[i]) ) { NEWDC(dct); STOQ(j,DEG(dct)); - MKGFS(IFTOF(a),b); + iftogfs(a,&b); COEF(dct) = (P)b; NEXT(dct) = dc; dc = dct; @@ -1321,7 +1322,7 @@ void cont_pp_sfp(VL vl,P f,P *cp,P *fp) y = vl->next->v; d = getdeg(y,f); if ( d == 0 ) { - MKGFS(0,g); + itogfs(1,&g); *cp = (P)g; *fp = f; /* XXX */ } else { @@ -1387,6 +1388,7 @@ int divtp_by_sfbm(VL vl,P f,P g,P *qp) /* XXX generate an irreducible poly of degree n */ extern int current_gfs_q1; +extern int *current_gfs_ntoi; void generate_defpoly_sfum(int n,UM *dp) { @@ -1414,8 +1416,12 @@ void generate_defpoly_sfum(int n,UM *dp) for ( j = 0; j < i; j++ ) w[j] = 0; w[i]++; - for ( i = 0; i < n; i++ ) - c[i] = w[i]?FTOIF(w[i]-1):0; + if ( !current_gfs_ntoi ) + for ( i = 0; i < n; i++ ) + c[i] = w[i]?FTOIF(w[i]):0; + else + for ( i = 0; i < n; i++ ) + c[i] = w[i]?FTOIF(w[i]-1):0; if ( !c[0] ) continue; diffsfum(r,dr); cpyum(r,t); gcdsfum(t,dr,g);