=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2018/builtin/dp.c,v retrieving revision 1.11 retrieving revision 1.14 diff -u -p -r1.11 -r1.14 --- OpenXM_contrib2/asir2018/builtin/dp.c 2019/09/04 01:12:02 1.11 +++ OpenXM_contrib2/asir2018/builtin/dp.c 2019/09/13 09:02:49 1.14 @@ -45,7 +45,7 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2018/builtin/dp.c,v 1.10 2019/08/28 23:27:33 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2018/builtin/dp.c,v 1.13 2019/09/05 08:49:43 noro Exp $ */ #include "ca.h" #include "base.h" @@ -91,7 +91,7 @@ void Pdp_gr_checklist(); void Pdp_ltod(),Pdpv_ord(),Pdpv_ht(),Pdpv_hm(),Pdpv_hc(); void Pdpm_ltod(),Pdpm_dtol(),Pdpm_set_schreyer(),Pdpm_nf(),Pdpm_weyl_nf(),Pdpm_sp(),Pdpm_weyl_sp(),Pdpm_nf_and_quotient(); void Pdpm_hm(),Pdpm_ht(),Pdpm_hc(),Pdpm_hp(),Pdpm_rest(),Pdpm_shift(),Pdpm_split(),Pdpm_sort(),Pdpm_dptodpm(),Pdpm_redble(); -void Pdpm_schreyer_base(); +void Pdpm_schreyer_base(),Pdpm_simplify_syz(); void Pdp_weyl_red(); void Pdp_weyl_sp(); @@ -277,7 +277,7 @@ struct ftab dp_supp_tab[] = { {"dpm_ltod",Pdpm_ltod,2}, {"dpm_dptodpm",Pdpm_dptodpm,2}, - {"dpm_dtol",Pdpm_dtol,3}, + {"dpm_dtol",Pdpm_dtol,2}, /* criteria */ {"dp_cri1",Pdp_cri1,2}, @@ -326,6 +326,7 @@ struct ftab dp_supp_tab[] = { {"dp_mono_raddec",Pdp_mono_raddec,2}, {"dp_mono_reduce",Pdp_mono_reduce,2}, {"dpm_schreyer_base",Pdpm_schreyer_base,1}, + {"dpm_simplify_syz",Pdpm_simplify_syz,2}, {"dp_rref2",Pdp_rref2,2}, {"sumi_updatepairs",Psumi_updatepairs,3}, @@ -1123,6 +1124,10 @@ void Pdpm_dtol(NODE arg,LIST *rp) Obj s; a = (DPM)ARG0(arg); + if ( !a ) { + MKLIST(*rp,0); + return; + } for ( vl = 0, nd = BDY((LIST)ARG1(arg)), nv = 0; nd; nd = NEXT(nd), nv++ ) { if ( !vl ) { NEWVL(vl); tvl = vl; @@ -1133,7 +1138,8 @@ void Pdpm_dtol(NODE arg,LIST *rp) } if ( vl ) NEXT(tvl) = 0; - n = ZTOS((Q)ARG2(arg)); + for ( t = BDY(a), n = 0; t; t = NEXT(t) ) + if ( t->pos > n ) n = t->pos; w = (MP *)CALLOC(n,sizeof(MP)); for ( t = BDY(a), len = 0; t; t = NEXT(t) ) len++; wa = (DMM *)MALLOC(len*sizeof(DMM)); @@ -1141,8 +1147,8 @@ void Pdpm_dtol(NODE arg,LIST *rp) for ( i = len-1; i >= 0; i-- ) { NEWMP(m); m->dl = wa[i]->dl; C(m) = C(wa[i]); pos = wa[i]->pos; - NEXT(m) = w[pos]; - w[pos] = m; + NEXT(m) = w[pos-1]; + w[pos-1] = m; } nd = 0; for ( i = n-1; i >= 0; i-- ) { @@ -1878,6 +1884,21 @@ void Pdpm_schreyer_base(NODE arg,LIST *rp) dpm_schreyer_base((LIST)ARG0(arg),rp); } +void dpm_simplify_syz(LIST m,LIST s,LIST *m1,LIST *s1); + +void Pdpm_simplify_syz(NODE arg,LIST *rp) +{ + LIST s1,m1; + NODE t; + + asir_assert(ARG0(arg),O_LIST,"dpm_simplify_syz"); + asir_assert(ARG1(arg),O_LIST,"dpm_simplify_syz"); + dpm_simplify_syz((LIST)ARG0(arg),(LIST)ARG1(arg),&s1,&m1); + t = mknode(2,s1,m1); + MKLIST(*rp,t); +} + + void Pdp_red_mod(NODE arg,LIST *rp) { DP h,r; @@ -3990,15 +4011,25 @@ void Pdpm_split(NODE arg,LIST *rp) } -void Pdpm_hc(NODE arg,Obj *rp) +void Pdpm_hc(NODE arg,DP *rp) { + DPM p; + DP d; + MP m; + asir_assert(ARG0(arg),O_DPM,"dpm_hc"); if ( !ARG0(arg) ) *rp = 0; - else - *rp = BDY((DPM)ARG0(arg))->c; + else { + p = (DPM)ARG0(arg); + NEWMP(m); + m->dl = BDY(p)->dl; + m->c = BDY(p)->c; + NEXT(m) = 0; + MKDP(NV(p),m,d); d->sugar = p->sugar; + *rp = d; + } } - void Pdpv_ht(NODE arg,LIST *rp) {