=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/builtin/poly.c,v retrieving revision 1.8 retrieving revision 1.10 diff -u -p -r1.8 -r1.10 --- OpenXM_contrib2/asir2000/builtin/poly.c 2001/03/29 09:49:56 1.8 +++ OpenXM_contrib2/asir2000/builtin/poly.c 2001/05/09 01:41:41 1.10 @@ -45,7 +45,7 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/builtin/poly.c,v 1.7 2001/03/14 06:04:52 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/builtin/poly.c,v 1.9 2001/05/02 09:03:52 noro Exp $ */ #include "ca.h" #include "parse.h" @@ -100,6 +100,9 @@ void Pis_irred_gf2(); void Pis_irred_ddd_gf2(); void Pget_next_fft_prime(); void Puadj_coef(); +void Preorder(); +void Phomogeneous_part(); +void Phomogeneous_deg(); void simp_ff(Obj,Obj *); void ranp(int,UP *); void field_order_ff(N *); @@ -111,6 +114,9 @@ extern int lm_lazy; int current_ff; struct ftab poly_tab[] = { + {"homogeneous_deg",Phomogeneous_deg,-2}, + {"homogeneous_part",Phomogeneous_part,-3}, + {"reorder",Preorder,3}, {"uadj_coef",Puadj_coef,3}, {"ranp",Pranp,2}, {"p_mag",Pp_mag,1}, @@ -215,6 +221,60 @@ struct ftab poly_tab[] = { extern V up_var; +void Phomogeneous_part(arg,rp) +NODE arg; +P *rp; +{ + if ( argc(arg) == 2 ) + exthp(CO,(P)ARG0(arg),QTOS((Q)ARG1(arg)),rp); + else + exthpc_generic(CO,(P)ARG0(arg),QTOS((Q)ARG2(arg)), + VR((P)ARG1(arg)),rp); +} + +void Phomogeneous_deg(arg,rp) +NODE arg; +Q *rp; +{ + int d; + + if ( argc(arg) == 1 ) + d = homdeg((P)ARG0(arg)); + else + d = getchomdeg(VR((P)ARG1(arg)),(P)ARG0(arg)); + STOQ(d,*rp); +} + +/* + p1 = reorder(p,ovl,nvl) => p1 is 'sorted accoding to nvl. +*/ + +void Preorder(arg,rp) +NODE arg; +P *rp; +{ + VL ovl,nvl,tvl; + NODE n; + + for ( ovl = 0, n = BDY((LIST)ARG1(arg)); n; n = NEXT(n) ) { + if ( !ovl ) { + NEWVL(ovl); tvl = ovl; + } else { + NEWVL(NEXT(tvl)); tvl = NEXT(tvl); + } + VR(tvl) = VR((P)BDY(n)); + } + for ( nvl = 0, n = BDY((LIST)ARG2(arg)); n; n = NEXT(n) ) { + if ( !nvl ) { + NEWVL(nvl); tvl = nvl; + } else { + NEWVL(NEXT(tvl)); tvl = NEXT(tvl); + } + VR(tvl) = VR((P)BDY(n)); + } + reorderp(nvl,ovl,(P)ARG0(arg),rp); +} + /* uadj_coef(F,M,M2) if ( F is a non-negative integer ) @@ -762,6 +822,12 @@ Q *rp; getmod_gf2n(&up2); d = degup2(up2); STOQ(d,*rp); break; case FF_GFPN: getmod_gfpn(&up); STOQ(up->d,*rp); break; + case FF_GFS: + if ( !current_gfs_ext ) + *rp = ONE; + else + *rp = DEG(DC(current_gfs_ext)); + break; default: error("extdeg_ff : current_ff is not set"); } @@ -778,6 +844,8 @@ Q *rp; getmod_lm(&lm); NTOQ(lm,1,*rp); break; case FF_GF2N: STOQ(2,*rp); break; + case FF_GFS: + STOQ(current_gfs_p,*rp); break; default: error("characteristic_ff : current_ff is not set"); } @@ -820,6 +888,8 @@ N *order; case FF_GFPN: getmod_lm(&m); getmod_gfpn(&up); pwrn(m,up->d,order); break; + case FF_GFS: + STON(current_gfs_q,*order); break; default: error("field_order_ff : current_ff is not set"); } @@ -1277,6 +1347,7 @@ P *rp; case FF_GF2N: powermodup_gf2n(p1,&p2); break; case FF_GFPN: + case FF_GFS: powermodup(p1,&p2); break; default: error("pwrmod_ff : current_ff is not set"); @@ -1298,6 +1369,7 @@ P *rp; case FF_GF2N: generic_powermodup_gf2n(g,f,(Q)ARG2(arg),&r); break; case FF_GFPN: + case FF_GFS: generic_powermodup(g,f,(Q)ARG2(arg),&r); break; default: error("generic_pwrmod_ff : current_ff is not set"); @@ -1325,6 +1397,7 @@ VECT *rp; case FF_GF2N: powertabup_gf2n(f,xp,tab); break; case FF_GFPN: + case FF_GFS: powertabup(f,xp,tab); break; default: error("pwrtab_ff : current_ff is not set");