version 1.57, 2003/09/05 05:02:53 |
version 1.59, 2003/09/05 13:20:14 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.56 2003/09/04 08:35:09 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.58 2003/09/05 07:00:37 noro Exp $ */ |
|
|
#include "ca.h" |
#include "ca.h" |
#include "inline.h" |
#include "inline.h" |
Line 121 static int nmv_adv; |
|
Line 121 static int nmv_adv; |
|
static int nd_dcomp; |
static int nd_dcomp; |
|
|
extern int Top,Reverse,dp_nelim,do_weyl; |
extern int Top,Reverse,dp_nelim,do_weyl; |
|
extern int *current_weyl_weight_vector; |
|
|
/* fundamental macros */ |
/* fundamental macros */ |
#define TD(d) (d[0]) |
#define TD(d) (d[0]) |
Line 621 int ndl_block_compare(unsigned int *d1,unsigned int *d |
|
Line 622 int ndl_block_compare(unsigned int *d1,unsigned int *d |
|
return 0; |
return 0; |
} |
} |
|
|
|
/* TDH -> WW -> TD-> RL */ |
|
|
|
int ndl_ww_lex_compare(unsigned int *d1,unsigned int *d2) |
|
{ |
|
int i,m,e1,e2; |
|
|
|
if ( TD(d1) > TD(d2) ) return 1; |
|
else if ( TD(d1) < TD(d2) ) return -1; |
|
m = nd_nvar>>1; |
|
for ( i = 0, e1 = e2 = 0; i < m; i++ ) { |
|
e1 += current_weyl_weight_vector[i]*(GET_EXP(d1,m+i)-GET_EXP(d1,i)); |
|
e2 += current_weyl_weight_vector[i]*(GET_EXP(d2,m+i)-GET_EXP(d2,i)); |
|
} |
|
if ( e1 > e2 ) return 1; |
|
else if ( e1 < e2 ) return -1; |
|
return ndl_lex_compare(d1,d2); |
|
} |
|
|
INLINE int ndl_equal(unsigned int *d1,unsigned int *d2) |
INLINE int ndl_equal(unsigned int *d1,unsigned int *d2) |
{ |
{ |
int i; |
int i; |
Line 3138 void nd_init_ord(struct order_spec *ord) |
|
Line 3157 void nd_init_ord(struct order_spec *ord) |
|
nd_isrlex = 0; |
nd_isrlex = 0; |
ndl_compare_function = ndl_lex_compare; |
ndl_compare_function = ndl_lex_compare; |
break; |
break; |
|
case 11: |
|
/* XXX */ |
|
nd_dcomp = 0; |
|
nd_isrlex = 1; |
|
ndl_compare_function = ndl_ww_lex_compare; |
|
break; |
default: |
default: |
error("nd_gr : unsupported order"); |
error("nd_gr : unsupported order"); |
} |
} |
Line 3224 EPOS nd_create_epos(struct order_spec *ord) |
|
Line 3249 EPOS nd_create_epos(struct order_spec *ord) |
|
} |
} |
return epos; |
return epos; |
} |
} |
|
|
|
/* external interface */ |
|
|
|
void nd_nf_p(P f,LIST g,LIST v,int m,struct order_spec *ord,P *rp) |
|
{ |
|
NODE t; |
|
ND nd,nf; |
|
VL vv; |
|
DP d,r,dm; |
|
int stat; |
|
|
|
pltovl(v,&vv); |
|
nd_nvar = length(vv); |
|
nd_init_ord(ord); |
|
initd(ord); |
|
for ( t = BDY(g); NEXT(t); t = NEXT(t) ) { |
|
ptod(CO,vv,(P)BDY(t),&d); BDY(t) = (pointer)d; |
|
} |
|
ptod(CO,vv,(P)BDY(t),&d); BDY(t) = (pointer)d; |
|
NEWNODE(NEXT(t)); ptod(CO,vv,f,&d); BDY(NEXT(t)) = d; NEXT(NEXT(t)) = 0; |
|
nd_setup(m,0,BDY(g)); |
|
nd_psn--; |
|
nd_scale=2; |
|
while ( 1 ) { |
|
nd = (pointer)ndvtond(m,nd_ps[nd_psn]); |
|
stat = nd_nf(m,nd,nd_ps,1,&nf); |
|
if ( !stat ) { |
|
nd_psn++; |
|
nd_reconstruct(m,0,0); |
|
nd_psn--; |
|
} else |
|
break; |
|
} |
|
r = (DP)ndtodp(m,nf); |
|
if ( m ) _dtop_mod(CO,vv,r,rp); |
|
else dtop(CO,vv,r,rp); |
|
} |
|
|