=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/engine/nd.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -p -r1.39 -r1.40 --- OpenXM_contrib2/asir2000/engine/nd.c 2003/08/21 03:13:01 1.39 +++ OpenXM_contrib2/asir2000/engine/nd.c 2003/08/21 04:44:36 1.40 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.38 2003/08/20 08:56:29 noro Exp $ */ +/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.39 2003/08/21 03:13:01 noro Exp $ */ #include "ca.h" #include "inline.h" @@ -15,11 +15,14 @@ #define REDTAB_LEN 32003 +/* GeoBucket for polynomial addition */ + typedef struct oPGeoBucket { int m; struct oND *body[32]; } *PGeoBucket; +/* distributed polynomial; linked list rep. */ typedef struct oND { struct oNM *body; int nv; @@ -27,6 +30,7 @@ typedef struct oND { int sugar; } *ND; +/* distributed polynomial; array rep. */ typedef struct oNDV { struct oNMV *body; int nv; @@ -34,6 +38,7 @@ typedef struct oNDV { int sugar; } *NDV; +/* monomial; linked list rep. */ typedef struct oNM { struct oNM *next; union { @@ -43,6 +48,7 @@ typedef struct oNM { unsigned int dl[1]; } *NM; +/* monomial; array rep. */ typedef struct oNMV { union { int m; @@ -51,6 +57,7 @@ typedef struct oNMV { unsigned int dl[1]; } *NMV; +/* history of reducer */ typedef struct oRHist { struct oRHist *next; int index; @@ -58,6 +65,7 @@ typedef struct oRHist { unsigned int dl[1]; } *RHist; +/* S-pair list */ typedef struct oND_pairs { struct oND_pairs *next; int i1,i2; @@ -85,7 +93,6 @@ RHist *nd_psh; int nd_psn,nd_pslen; RHist *nd_red; -int nd_red_len; int nd_found,nd_create,nd_notfirst; int nm_adv; @@ -94,6 +101,7 @@ int nd_dcomp; extern int Top,Reverse,dp_nelim; +/* fundamental macros */ #define TD(d) (d[0]) #define HDL(d) ((d)->body->dl) #define HTD(d) (TD(HDL(d))) @@ -106,13 +114,13 @@ extern int Top,Reverse,dp_nelim; #define LEN(a) ((a)->len) #define LCM(a) ((a)->lcm) +/* macros for term comparison */ #define TD_DL_COMPARE(d1,d2)\ (TD(d1)>TD(d2)?1:(TD(d1)i1 = t->i1; s->i2 = t->i2; SG(s) = SG(t); - ndl_dup(obpe,LCM(t),LCM(s)); + ndl_reconstruct(obpe,LCM(t),LCM(s)); } old_red = (RHist *)ALLOCA(REDTAB_LEN*sizeof(RHist)); @@ -2452,7 +2496,7 @@ ND_pairs nd_reconstruct(int mod,int trace,ND_pairs d) NEWRHist(mr); mr->index = r->index; SG(mr) = SG(r); - ndl_dup(obpe,DL(r),DL(mr)); + ndl_reconstruct(obpe,DL(r),DL(mr)); h = ndl_hash_value(DL(mr)); NEXT(mr) = nd_red[h]; nd_red[h] = mr; @@ -2461,7 +2505,7 @@ ND_pairs nd_reconstruct(int mod,int trace,ND_pairs d) old_red = 0; for ( i = 0; i < nd_psn; i++ ) { NEWRHist(r); SG(r) = SG(nd_psh[i]); - ndl_dup(obpe,DL(nd_psh[i]),DL(r)); + ndl_reconstruct(obpe,DL(nd_psh[i]),DL(r)); nd_psh[i] = r; } if ( s0 ) NEXT(s) = 0; @@ -2505,7 +2549,7 @@ void nd_reconstruct_direct(int mod,NDV *ps,int len) NEWRHist(mr); mr->index = r->index; SG(mr) = SG(r); - ndl_dup(obpe,DL(r),DL(mr)); + ndl_reconstruct(obpe,DL(r),DL(mr)); h = ndl_hash_value(DL(mr)); NEXT(mr) = nd_red[h]; nd_red[h] = mr; @@ -2517,7 +2561,7 @@ void nd_reconstruct_direct(int mod,NDV *ps,int len) GC_gcollect(); } -void ndl_dup(int obpe,unsigned int *d,unsigned int *r) +void ndl_reconstruct(int obpe,unsigned int *d,unsigned int *r) { int n,i,ei,oepw,cepw,cbpe; @@ -2550,7 +2594,7 @@ void nd_realloc(ND p,int obpe) for ( mr0 = 0; m; m = NEXT(m) ) { NEXTNM(mr0,mr); CM(mr) = CM(m); - ndl_dup(obpe,DL(m),DL(mr)); + ndl_reconstruct(obpe,DL(m),DL(mr)); } NEXT(mr) = 0; BDY(p) = mr0; @@ -2693,7 +2737,7 @@ void ndv_realloc(NDV p,int obpe,int oadv) for ( i = 0; i < len; i++, NMV_OPREV(m), NMV_PREV(mr) ) { CQ(t) = CQ(m); for ( k = 0; k < nd_wpd; k++ ) DL(t)[k] = 0; - ndl_dup(obpe,DL(m),DL(t)); + ndl_reconstruct(obpe,DL(m),DL(t)); CQ(mr) = CQ(t); ndl_copy(DL(t),DL(mr)); }