version 1.11, 2000/12/05 06:59:16 |
version 1.15, 2001/03/29 09:49:57 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/engine/dist.c,v 1.10 2000/11/07 06:06:39 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/engine/dist.c,v 1.14 2001/02/21 07:10:18 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
|
|
|
|
#define ORD_BGRADREV 7 |
#define ORD_BGRADREV 7 |
#define ORD_BLEXREV 8 |
#define ORD_BLEXREV 8 |
#define ORD_ELIM 9 |
#define ORD_ELIM 9 |
|
#define ORD_WEYL_ELIM 10 |
|
#define ORD_HOMO_WW_DRL 11 |
|
|
int (*cmpdl)()=cmpdl_revgradlex; |
int (*cmpdl)()=cmpdl_revgradlex; |
int (*primitive_cmpdl[3])() = {cmpdl_revgradlex,cmpdl_gradlex,cmpdl_lex}; |
int (*primitive_cmpdl[3])() = {cmpdl_revgradlex,cmpdl_gradlex,cmpdl_lex}; |
Line 71 void comm_muld_tab(VL,int,struct cdl *,int,struct cdl |
|
Line 73 void comm_muld_tab(VL,int,struct cdl *,int,struct cdl |
|
|
|
void mkwc(int,int,Q *); |
void mkwc(int,int,Q *); |
|
|
|
int cmpdl_weyl_elim(); |
|
int cmpdl_homo_ww_drl(); |
|
|
int do_weyl; |
int do_weyl; |
|
|
int dp_nelim,dp_fcoeffs; |
int dp_nelim,dp_fcoeffs; |
|
|
if ( !f ) |
if ( !f ) |
return 0; |
return 0; |
else if ( NUM(f) ) |
else if ( NUM(f) ) |
return (NID((Num)f) == N_LM || NID((Num)f) == N_GF2N) ? 1 : 0; |
return (NID((Num)f) == N_LM |
|
|| NID((Num)f) == N_GF2N |
|
|| NID((Num)f) == N_GFPN |
|
|| NID((Num)f) == N_GFS) ? 1 : 0; |
else { |
else { |
for ( dc = DC(f); dc; dc = NEXT(dc) ) |
for ( dc = DC(f); dc; dc = NEXT(dc) ) |
if ( has_fcoef_p(COEF(dc)) ) |
if ( has_fcoef_p(COEF(dc)) ) |
Line 141 struct order_spec *spec; |
|
Line 149 struct order_spec *spec; |
|
cmpdl = cmpdl_blexrev; break; |
cmpdl = cmpdl_blexrev; break; |
case ORD_ELIM: |
case ORD_ELIM: |
cmpdl = cmpdl_elim; break; |
cmpdl = cmpdl_elim; break; |
|
case ORD_WEYL_ELIM: |
|
cmpdl = cmpdl_weyl_elim; break; |
|
case ORD_HOMO_WW_DRL: |
|
cmpdl = cmpdl_homo_ww_drl; break; |
case ORD_LEX: default: |
case ORD_LEX: default: |
cmpdl = cmpdl_lex; break; |
cmpdl = cmpdl_lex; break; |
} |
} |
|
|
return -1; |
return -1; |
else |
else |
return cmpdl_revgradlex(n,d1,d2); |
return cmpdl_revgradlex(n,d1,d2); |
|
} |
|
|
|
int cmpdl_weyl_elim(n,d1,d2) |
|
int n; |
|
DL d1,d2; |
|
{ |
|
int e1,e2,i; |
|
|
|
for ( i = 1, e1 = 0, e2 = 0; i <= dp_nelim; i++ ) { |
|
e1 += d1->d[n-i]; e2 += d2->d[n-i]; |
|
} |
|
if ( e1 > e2 ) |
|
return 1; |
|
else if ( e1 < e2 ) |
|
return -1; |
|
else if ( d1->td > d2->td ) |
|
return 1; |
|
else if ( d1->td < d2->td ) |
|
return -1; |
|
else return -cmpdl_revlex(n,d1,d2); |
|
} |
|
|
|
/* |
|
a special ordering |
|
1. total order |
|
2. (-w,w) for the first 2*m variables |
|
3. DRL for the first 2*m variables |
|
*/ |
|
|
|
extern int *current_weight_vector; |
|
|
|
int cmpdl_homo_ww_drl(n,d1,d2) |
|
int n; |
|
DL d1,d2; |
|
{ |
|
int e1,e2,m,i; |
|
int *p1,*p2; |
|
|
|
if ( d1->td > d2->td ) |
|
return 1; |
|
else if ( d1->td < d2->td ) |
|
return -1; |
|
|
|
m = n>>1; |
|
for ( i = 0, e1 = e2 = 0; i < m; i++ ) { |
|
e1 += current_weight_vector[i]*(d1->d[m+i] - d1->d[i]); |
|
e2 += current_weight_vector[i]*(d2->d[m+i] - d2->d[i]); |
|
} |
|
if ( e1 > e2 ) |
|
return 1; |
|
else if ( e1 < e2 ) |
|
return -1; |
|
|
|
e1 = d1->td - d1->d[n-1]; |
|
e2 = d2->td - d2->d[n-1]; |
|
if ( e1 > e2 ) |
|
return 1; |
|
else if ( e1 < e2 ) |
|
return -1; |
|
|
|
for ( i= n - 1, p1 = d1->d+n-1, p2 = d2->d+n-1; |
|
i >= 0 && *p1 == *p2; i--, p1--, p2-- ); |
|
return i < 0 ? 0 : (*p1 < *p2 ? 1 : -1); |
} |
} |
|
|
int cmpdl_order_pair(n,d1,d2) |
int cmpdl_order_pair(n,d1,d2) |