=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/builtin/gr.c,v retrieving revision 1.37 retrieving revision 1.42 diff -u -p -r1.37 -r1.42 --- OpenXM_contrib2/asir2000/builtin/gr.c 2001/10/09 01:36:06 1.37 +++ OpenXM_contrib2/asir2000/builtin/gr.c 2002/07/17 09:45:49 1.42 @@ -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/gr.c,v 1.36 2001/10/01 01:58:02 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/builtin/gr.c,v 1.41 2002/01/28 00:54:41 noro Exp $ */ #include "ca.h" #include "parse.h" @@ -108,6 +108,7 @@ static int Denominator = 1; static int Top = 0; static int Reverse = 0; static int Max_mag = 0; +static int Max_coef = 0; static char *Demand = 0; static int PtozpRA = 0; @@ -338,7 +339,7 @@ void dp_gr_main(LIST f,LIST v,Num homo,int modular,int } print_stat(); if ( ShowMag ) - fprintf(asir_out,"\nMax_mag=%d\n",Max_mag); + fprintf(asir_out,"\nMax_mag=%d, Max_coef=%d\n",Max_mag, Max_coef); } void dp_gr_mod_main(LIST f,LIST v,Num homo,int m,struct order_spec *ord,LIST *rp) @@ -1537,7 +1538,7 @@ void minsugar(DP_pairs d,DP_pairs *dm,DP_pairs *dr) NODE gb(NODE f,int m,NODE subst) { - int i,nh,prev,mag; + int i,nh,prev,mag,mag0,magt; NODE r,g,gall; DP_pairs d; DP_pairs l; @@ -1551,6 +1552,7 @@ NODE gb(NODE f,int m,NODE subst) static prev_sugar = -1; Max_mag = 0; + Max_coef = 0; prev = 1; doing_f4 = 0; if ( m ) { @@ -1625,8 +1627,12 @@ skip_nf: g = updbase(g,nh); gall = append_one(gall,nh); if ( !dp_fcoeffs && ShowMag ) { - for ( mag = 0, mp = BDY(h); mp; mp = NEXT(mp) ) - mag += p_mag((P)mp->c); + for ( mag = 0, mag0 = 0, mp = BDY(h); mp; mp = NEXT(mp) ) { + magt = p_mag((P)mp->c); + mag0 = MAX(mag0,magt); + mag += magt; + } + Max_coef = MAX(Max_coef,mag0); Max_mag = MAX(Max_mag,mag); } if ( DP_Print ) { @@ -1638,7 +1644,7 @@ skip_nf: l->dp1,l->dp2,length(g),length(gall),DPPlength(d), pss[nh]); if ( ShowMag ) - fprintf(asir_out,",mag=%d",mag); + fprintf(asir_out,",mag=(%d,%d)",mag,mag0); fprintf(asir_out,"\n"); fflush(asir_out); } else if ( DP_PrintShort ) { fprintf(asir_out,"+"); fflush(asir_out); @@ -1779,7 +1785,7 @@ DP_pairs newpairs( NODE /* of index */ g, int t ) p->lcm = lcm_of_DL(CNVars, dl = psh[dp], tdl, (DL)0 ); #if 0 if ( do_weyl ) - p->sugar = dl_weight(p->lcm); + p->sugar = dl_weyl_weight(p->lcm); else #endif p->sugar = (ts > (s = pss[dp] - dl->td) ? ts : s) + p->lcm->td; @@ -1946,7 +1952,8 @@ int dl_redble(DL dl1,DL dl2) return 1; } -int dl_weight(DL dl) +#if 0 +int dl_weyl_weight(DL dl) { int n,w,i; @@ -1955,6 +1962,7 @@ int dl_weight(DL dl) w += (-dl->d[i]+dl->d[n+i]); return w; } +#endif int gbcheck(NODE f) { @@ -1992,6 +2000,40 @@ int gbcheck(NODE f) if ( DP_Print || DP_PrintShort ) fprintf(asir_out,"\n"); return 1; +} + +void gbcheck_list(NODE f,int n,VECT *gp,LIST *pp) +{ + int i; + NODE r,g,gall,u,u0,t; + VECT vect; + LIST pair; + DP_pairs d,l; + Q q1,q2; + + /* we need the following settings */ + NVars = CNVars = n; + setup_arrays(f,0,&r); + for ( gall = g = 0, d = 0; r; r = NEXT(r) ) { + i = (int)BDY(r); + d = updpairs(d,g,i); + g = updbase(g,i); + gall = append_one(gall,i); + } + NEWVECT(vect); vect->len = psn; vect->body = (pointer)ps; + *gp = vect; + + for ( u0 = 0, l = d; l; l = NEXT(l) ) { + NEXTNODE(u0,u); + STOQ(l->dp1,q1); + STOQ(l->dp2,q2); + t = mknode(2,q1,q2); + MKLIST(pair,t); + BDY(u) = (pointer)pair; + } + if ( u0 ) + NEXT(u) = 0; + MKLIST(*pp,u0); } int membercheck(NODE f,NODE x)