=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/builtin/dp.c,v retrieving revision 1.25 retrieving revision 1.28 diff -u -p -r1.25 -r1.28 --- OpenXM_contrib2/asir2000/builtin/dp.c 2002/06/06 01:18:05 1.25 +++ OpenXM_contrib2/asir2000/builtin/dp.c 2003/01/15 04:53:03 1.28 @@ -45,13 +45,12 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/builtin/dp.c,v 1.24 2002/01/28 00:54:41 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/builtin/dp.c,v 1.27 2003/01/06 01:16:37 noro Exp $ */ #include "ca.h" #include "base.h" #include "parse.h" -extern int dp_fcoeffs; extern int dp_nelim; extern int dp_order_pair_length; extern struct order_pair *dp_order_pair; @@ -73,7 +72,7 @@ void Pdp_gr_mod_main(),Pdp_gr_f_main(); void Pdp_gr_main(),Pdp_gr_hm_main(),Pdp_gr_d_main(),Pdp_gr_flags(); void Pdp_f4_main(),Pdp_f4_mod_main(),Pdp_f4_f_main(); void Pdp_gr_print(); -void Pdp_mbase(),Pdp_lnf_mod(),Pdp_nf_tab_mod(),Pdp_mdtod(); +void Pdp_mbase(),Pdp_lnf_mod(),Pdp_nf_tab_mod(),Pdp_mdtod(), Pdp_nf_tab_f(); void Pdp_vtoe(), Pdp_etov(), Pdp_dtov(), Pdp_idiv(), Pdp_sep(); void Pdp_cont(); void Pdp_gr_checklist(); @@ -115,6 +114,7 @@ struct ftab dp_tab[] = { {"dp_nf_mod",Pdp_nf_mod,5}, {"dp_true_nf_mod",Pdp_true_nf_mod,5}, {"dp_lnf_mod",Pdp_lnf_mod,3}, + {"dp_nf_tab_f",Pdp_nf_tab_f,2}, {"dp_nf_tab_mod",Pdp_nf_tab_mod,3}, {"dp_lnf_f",Pdp_lnf_f,2}, @@ -378,6 +378,15 @@ DP *rp; QTOS((Q)ARG2(arg)),rp); } +void Pdp_nf_tab_f(arg,rp) +NODE arg; +DP *rp; +{ + asir_assert(ARG0(arg),O_DP,"dp_nf_tab_f"); + asir_assert(ARG1(arg),O_VECT,"dp_nf_tab_f"); + dp_nf_tab_f((DP)ARG0(arg),(LIST *)BDY((VECT)ARG1(arg)),rp); +} + void Pdp_ord(arg,rp) NODE arg; Obj *rp; @@ -1270,7 +1279,9 @@ LIST *rp; { LIST f,v; Num homo; + int m,field,t; struct order_spec ord; + NODE n; do_weyl = 0; asir_assert(ARG0(arg),O_LIST,"dp_gr_f_main"); @@ -1282,8 +1293,29 @@ LIST *rp; *rp = f; return; } homo = (Num)ARG2(arg); +#if 0 + asir_assert(ARG3(arg),O_N,"dp_gr_f_main"); + m = QTOS((Q)ARG3(arg)); + if ( m ) + error("dp_gr_f_main : trace lifting is not implemented yet"); + create_order_spec(ARG4(arg),&ord); +#else + m = 0; create_order_spec(ARG3(arg),&ord); - dp_gr_main(f,v,homo,0,1,&ord,rp); +#endif + field = 0; + for ( n = BDY(f); n; n = NEXT(n) ) { + t = get_field_type(BDY(n)); + if ( !t ) + continue; + if ( t < 0 ) + error("dp_gr_f_main : incosistent coefficients"); + if ( !field ) + field = t; + else if ( t != field ) + error("dp_gr_f_main : incosistent coefficients"); + } + dp_gr_main(f,v,homo,m?1:0,field,&ord,rp); } void Pdp_f4_main(arg,rp) @@ -1572,4 +1604,30 @@ LIST remove_zero_from_list(LIST l) NEXT(r) = 0; MKLIST(rl,r0); return rl; +} + +int get_field_type(P p) +{ + int type,t; + DCP dc; + + if ( !p ) + return 0; + else if ( NUM(p) ) + return NID((Num)p); + else { + type = 0; + for ( dc = DC(p); dc; dc = NEXT(dc) ) { + t = get_field_type(COEF(dc)); + if ( !t ) + continue; + if ( t < 0 ) + return t; + if ( !type ) + type = t; + else if ( t != type ) + return -1; + } + return type; + } }