version 1.25, 2020/06/19 22:58:48 |
version 1.27, 2020/06/25 02:53:31 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.c,v 1.24 2020/06/19 10:18:13 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.c,v 1.26 2020/06/23 01:49:58 noro Exp $ */ |
|
|
#include "nd.h" |
#include "nd.h" |
|
|
Line 18 NM _nm_free_list; |
|
Line 18 NM _nm_free_list; |
|
ND _nd_free_list; |
ND _nd_free_list; |
ND_pairs _ndp_free_list; |
ND_pairs _ndp_free_list; |
NODE nd_hcf; |
NODE nd_hcf; |
|
int Nsyz; |
|
|
Obj nd_top_weight; |
Obj nd_top_weight; |
|
|
Line 70 static NODE nd_nzlist,nd_check_splist; |
|
Line 71 static NODE nd_nzlist,nd_check_splist; |
|
static int nd_splist; |
static int nd_splist; |
static int *nd_sugarweight; |
static int *nd_sugarweight; |
static int nd_f4red,nd_rank0,nd_last_nonzero; |
static int nd_f4red,nd_rank0,nd_last_nonzero; |
|
static DL *nd_sba_hm; |
|
|
NumberField get_numberfield(); |
NumberField get_numberfield(); |
UINT *nd_det_compute_bound(NDV **dm,int n,int j); |
UINT *nd_det_compute_bound(NDV **dm,int n,int j); |
Line 291 INLINE int ndl_reducible(UINT *d1,UINT *d2) |
|
Line 293 INLINE int ndl_reducible(UINT *d1,UINT *d2) |
|
#endif |
#endif |
} |
} |
|
|
int ndl_reducible_s(UINT *d1,UINT *d2,UINT *quo) |
|
{ |
|
UINT u1,u2; |
|
int i,j; |
|
|
|
if ( nd_module && (MPOS(d1) != MPOS(d2)) ) return 0; |
|
|
|
if ( !dp_negative_weight && TD(d1) < TD(d2) ) return 0; |
|
#if USE_UNROLL |
|
switch ( nd_bpe ) { |
|
case 3: |
|
for ( i = nd_exporigin; i < nd_wpd; i++ ) { |
|
u1 = d1[i]; u2 = d2[i]; |
|
if ( (u1&0x38000000) < (u2&0x38000000) ) return 0; |
|
if ( (u1& 0x7000000) < (u2& 0x7000000) ) return 0; |
|
if ( (u1& 0xe00000) < (u2& 0xe00000) ) return 0; |
|
if ( (u1& 0x1c0000) < (u2& 0x1c0000) ) return 0; |
|
if ( (u1& 0x38000) < (u2& 0x38000) ) return 0; |
|
if ( (u1& 0x7000) < (u2& 0x7000) ) return 0; |
|
if ( (u1& 0xe00) < (u2& 0xe00) ) return 0; |
|
if ( (u1& 0x1c0) < (u2& 0x1c0) ) return 0; |
|
if ( (u1& 0x38) < (u2& 0x38) ) return 0; |
|
if ( (u1& 0x7) < (u2& 0x7) ) return 0; |
|
} |
|
for ( i = 0; i < nd_wpd; i++ ) d1[i] -= d2[i]; |
|
return 1; |
|
break; |
|
case 4: |
|
for ( i = nd_exporigin; i < nd_wpd; i++ ) { |
|
u1 = d1[i]; u2 = d2[i]; |
|
if ( (u1&0xf0000000) < (u2&0xf0000000) ) return 0; |
|
if ( (u1& 0xf000000) < (u2& 0xf000000) ) return 0; |
|
if ( (u1& 0xf00000) < (u2& 0xf00000) ) return 0; |
|
if ( (u1& 0xf0000) < (u2& 0xf0000) ) return 0; |
|
if ( (u1& 0xf000) < (u2& 0xf000) ) return 0; |
|
if ( (u1& 0xf00) < (u2& 0xf00) ) return 0; |
|
if ( (u1& 0xf0) < (u2& 0xf0) ) return 0; |
|
if ( (u1& 0xf) < (u2& 0xf) ) return 0; |
|
} |
|
for ( i = 0; i < nd_wpd; i++ ) d1[i] -= d2[i]; |
|
return 1; |
|
break; |
|
case 6: |
|
for ( i = nd_exporigin; i < nd_wpd; i++ ) { |
|
u1 = d1[i]; u2 = d2[i]; |
|
if ( (u1&0x3f000000) < (u2&0x3f000000) ) return 0; |
|
if ( (u1& 0xfc0000) < (u2& 0xfc0000) ) return 0; |
|
if ( (u1& 0x3f000) < (u2& 0x3f000) ) return 0; |
|
if ( (u1& 0xfc0) < (u2& 0xfc0) ) return 0; |
|
if ( (u1& 0x3f) < (u2& 0x3f) ) return 0; |
|
} |
|
for ( i = 0; i < nd_wpd; i++ ) d1[i] -= d2[i]; |
|
return 1; |
|
break; |
|
case 8: |
|
for ( i = nd_exporigin; i < nd_wpd; i++ ) { |
|
u1 = d1[i]; u2 = d2[i]; |
|
if ( (u1&0xff000000) < (u2&0xff000000) ) return 0; |
|
if ( (u1& 0xff0000) < (u2& 0xff0000) ) return 0; |
|
if ( (u1& 0xff00) < (u2& 0xff00) ) return 0; |
|
if ( (u1& 0xff) < (u2& 0xff) ) return 0; |
|
} |
|
for ( i = 0; i < nd_wpd; i++ ) d1[i] -= d2[i]; |
|
return 1; |
|
break; |
|
case 16: |
|
for ( i = nd_exporigin; i < nd_wpd; i++ ) { |
|
u1 = d1[i]; u2 = d2[i]; |
|
if ( (u1&0xffff0000) < (u2&0xffff0000) ) return 0; |
|
if ( (u1& 0xffff) < (u2& 0xffff) ) return 0; |
|
} |
|
for ( i = 0; i < nd_wpd; i++ ) d1[i] -= d2[i]; |
|
return 1; |
|
break; |
|
case 32: |
|
for ( i = nd_exporigin; i < nd_wpd; i++ ) |
|
if ( d1[i] < d2[i] ) return 0; |
|
for ( i = 0; i < nd_wpd; i++ ) d1[i] -= d2[i]; |
|
return 1; |
|
break; |
|
default: |
|
for ( i = nd_exporigin; i < nd_wpd; i++ ) { |
|
u1 = d1[i]; u2 = d2[i]; |
|
for ( j = 0; j < nd_epw; j++ ) |
|
if ( (u1&nd_mask[j]) < (u2&nd_mask[j]) ) return 0; |
|
} |
|
for ( i = 0; i < nd_wpd; i++ ) d1[i] -= d2[i]; |
|
return 1; |
|
} |
|
#else |
|
for ( i = nd_exporigin; i < nd_wpd; i++ ) { |
|
u1 = d1[i]; u2 = d2[i]; |
|
for ( j = 0; j < nd_epw; j++ ) |
|
if ( (u1&nd_mask[j]) < (u2&nd_mask[j]) ) return 0; |
|
} |
|
for ( i = 0; i < nd_wpd; i++ ) d1[i] -= d2[i]; |
|
return 1; |
|
#endif |
|
} |
|
|
|
/* |
/* |
* If the current order is a block order, |
* If the current order is a block order, |
* then the last block is length 1 and contains |
* then the last block is length 1 and contains |
Line 1051 INLINE void ndl_addto(UINT *d1,UINT *d2) |
|
Line 953 INLINE void ndl_addto(UINT *d1,UINT *d2) |
|
#endif |
#endif |
} |
} |
|
|
/* d1 -= d2 */ |
|
INLINE void ndl_subfrom(UINT *d1,UINT *d2) |
|
{ |
|
int i; |
|
|
|
if ( nd_module ) { |
|
if ( MPOS(d1) && MPOS(d2) && (MPOS(d1) != MPOS(d2)) ) |
|
error("ndl_addto : invalid operation"); |
|
} |
|
#if 1 |
|
switch ( nd_wpd ) { |
|
case 2: |
|
TD(d1) -= TD(d2); |
|
d1[1] -= d2[1]; |
|
break; |
|
case 3: |
|
TD(d1) -= TD(d2); |
|
d1[1] -= d2[1]; |
|
d1[2] -= d2[2]; |
|
break; |
|
default: |
|
for ( i = 0; i < nd_wpd; i++ ) d1[i] -= d2[i]; |
|
break; |
|
} |
|
#else |
|
for ( i = 0; i < nd_wpd; i++ ) d1[i] -= d2[i]; |
|
#endif |
|
} |
|
|
|
INLINE void ndl_sub(UINT *d1,UINT *d2,UINT *d) |
INLINE void ndl_sub(UINT *d1,UINT *d2,UINT *d) |
{ |
{ |
int i; |
int i; |
Line 1348 void print_sig(SIG s) |
|
Line 1221 void print_sig(SIG s) |
|
INLINE int ndl_find_reducer_s(UINT *dg,SIG sig) |
INLINE int ndl_find_reducer_s(UINT *dg,SIG sig) |
{ |
{ |
RHist r; |
RHist r; |
int i,singular,ret; |
int i,singular,ret,d,k; |
static int wpd; |
static int wpd,nvar; |
static SIG quo; |
static SIG quo; |
static UINT *tmp; |
static UINT *tmp; |
|
|
if ( wpd < nd_wpd ) { |
if ( !quo || nvar != nd_nvar ) NEWSIG(quo); |
|
if ( wpd != nd_wpd ) { |
wpd = nd_wpd; |
wpd = nd_wpd; |
NEWSIG(quo); |
|
tmp = (UINT *)MALLOC(wpd*sizeof(UINT)); |
tmp = (UINT *)MALLOC(wpd*sizeof(UINT)); |
} |
} |
|
d = ndl_hash_value(dg); |
|
for ( r = nd_red[d], k = 0; r; r = NEXT(r), k++ ) { |
|
if ( ndl_equal(dg,DL(r)) ) { |
|
return r->index; |
|
} |
|
} |
singular = 0; |
singular = 0; |
for ( i = 0; i < nd_psn; i++ ) { |
for ( i = 0; i < nd_psn; i++ ) { |
r = nd_psh[i]; |
r = nd_psh[i]; |
if ( ndl_reducible(dg,DL(r)) ) { |
if ( ndl_reducible(dg,DL(r)) ) { |
ndl_copy(dg,tmp); |
ndl_sub(dg,DL(r),tmp); |
ndl_subfrom(tmp,DL(r)); |
|
_ndltodl(tmp,DL(quo)); |
_ndltodl(tmp,DL(quo)); |
_addtodl(nd_nvar,DL(nd_psh[i]->sig),DL(quo)); |
_addtodl(nd_nvar,DL(nd_psh[i]->sig),DL(quo)); |
quo->pos = nd_psh[i]->sig->pos; |
quo->pos = nd_psh[i]->sig->pos; |
Line 1373 INLINE int ndl_find_reducer_s(UINT *dg,SIG sig) |
|
Line 1251 INLINE int ndl_find_reducer_s(UINT *dg,SIG sig) |
|
} |
} |
} |
} |
if ( singular ) return -1; |
if ( singular ) return -1; |
else return i; |
else if ( i < nd_psn ) |
|
nd_append_red(dg,i); |
|
return i; |
} |
} |
|
|
ND nd_merge(ND p1,ND p2) |
ND nd_merge(ND p1,ND p2) |
Line 2500 NODE nd_gb(int m,int ishomo,int checkonly,int gensyz,i |
|
Line 2380 NODE nd_gb(int m,int ishomo,int checkonly,int gensyz,i |
|
int diag_count = 0; |
int diag_count = 0; |
P cont; |
P cont; |
LIST list; |
LIST list; |
|
struct oEGT eg1,eg2,eg_update; |
|
|
|
init_eg(&eg_update); |
Nnd_add = 0; |
Nnd_add = 0; |
g = 0; d = 0; |
g = 0; d = 0; |
for ( i = 0; i < nd_psn; i++ ) { |
for ( i = 0; i < nd_psn; i++ ) { |
|
|
goto again; |
goto again; |
} |
} |
} |
} |
|
get_eg(&eg1); |
d = update_pairs(d,g,nh,0); |
d = update_pairs(d,g,nh,0); |
|
get_eg(&eg2); add_eg(&eg_update,&eg1,&eg2); |
g = update_base(g,nh); |
g = update_base(g,nh); |
FREENDP(l); |
FREENDP(l); |
} else { |
} else { |
|
|
} |
} |
conv_ilist(nd_demand,0,g,indp); |
conv_ilist(nd_demand,0,g,indp); |
if ( !checkonly && DP_Print ) { printf("nd_gb done. Number of nd_add=%d\n",Nnd_add); fflush(stdout); } |
if ( !checkonly && DP_Print ) { printf("nd_gb done. Number of nd_add=%d\n",Nnd_add); fflush(stdout); } |
|
print_eg("update",&eg_update); |
return g; |
return g; |
} |
} |
|
|
Line 2626 NODE insert_sig(NODE l,SIG s) |
|
Line 2511 NODE insert_sig(NODE l,SIG s) |
|
} else |
} else |
prev = p; |
prev = p; |
} |
} |
NEWNODE(r); r->body = (pointer)s; |
NEWNODE(r); r->body = (pointer)s; r->next = 0; |
r->next = root.next; |
for ( p = &root; p->next; p = p->next ); |
return r; |
p->next = r; |
|
// r->next = root.next; |
|
// return r; |
|
return root.next; |
} |
} |
|
|
ND_pairs remove_spair_s(ND_pairs d,SIG sig) |
ND_pairs remove_spair_s(ND_pairs d,SIG sig) |
Line 2641 ND_pairs remove_spair_s(ND_pairs d,SIG sig) |
|
Line 2529 ND_pairs remove_spair_s(ND_pairs d,SIG sig) |
|
prev = &root; p = d; |
prev = &root; p = d; |
while ( p ) { |
while ( p ) { |
spsig = p->sig; |
spsig = p->sig; |
if ( sig->pos == spsig->pos && _dl_redble(DL(sig),DL(spsig),nd_nvar) ) |
if ( sig->pos == spsig->pos && _dl_redble(DL(sig),DL(spsig),nd_nvar) ) { |
// remove p |
// remove p |
prev->next = p->next; |
prev->next = p->next; |
else |
Nsyz++; |
|
} else |
prev = p; |
prev = p; |
p = p->next; |
p = p->next; |
} |
} |
return (ND_pairs)root.next; |
return (ND_pairs)root.next; |
} |
} |
|
|
|
struct oEGT eg_create,eg_newpairs,eg_merge; |
|
|
NODE nd_sba_buch(int m,int ishomo,int **indp) |
NODE nd_sba_buch(int m,int ishomo,int **indp) |
{ |
{ |
int i,nh,sugar,stat; |
int i,nh,sugar,stat; |
Line 2665 NODE nd_sba_buch(int m,int ishomo,int **indp) |
|
Line 2556 NODE nd_sba_buch(int m,int ishomo,int **indp) |
|
LIST list; |
LIST list; |
SIG sig; |
SIG sig; |
NODE syzlist; |
NODE syzlist; |
static int wpd; |
int Nredundant; |
static SIG quo,mul; |
static int wpd,nvar; |
static DL lcm; |
static DL lcm,quo,mul; |
|
struct oEGT eg1,eg2,eg_update,eg_remove; |
|
|
|
init_eg(&eg_remove); |
syzlist = 0; |
syzlist = 0; |
|
Nsyz = 0; |
Nnd_add = 0; |
Nnd_add = 0; |
|
Nredundant = 0; |
g = 0; d = 0; |
g = 0; d = 0; |
for ( i = 0; i < nd_psn; i++ ) { |
for ( i = 0; i < nd_psn; i++ ) { |
d = update_pairs_s(d,g,i,0); |
d = update_pairs_s(d,g,i,0); |
g = append_one(g,i); |
g = append_one(g,i); |
} |
} |
sugar = 0; |
sugar = 0; |
|
NEWDL(lcm,nd_nvar); NEWDL(quo,nd_nvar); NEWDL(mul,nd_nvar); |
|
init_eg(&eg_create); |
|
init_eg(&eg_merge); |
while ( d ) { |
while ( d ) { |
again: |
again: |
|
if ( DP_Print ) { |
|
int len; |
|
ND_pairs td; |
|
for ( td = d, len=0; td; td = td->next, len++); |
|
if ( !(len%100) ) fprintf(asir_out,"(%d)",len); |
|
} |
l = d; d = d->next; |
l = d; d = d->next; |
sig = l->sig; |
sig = l->sig; |
if ( wpd < nd_wpd ) { |
|
wpd = nd_wpd; |
|
NEWSIG(quo); |
|
NEWSIG(mul); |
|
NEWDL(lcm,nd_nvar); |
|
} |
|
_ndltodl(l->lcm,lcm); |
_ndltodl(l->lcm,lcm); |
for ( i = 0; i < nd_psn; i++ ) { |
for ( i = 0; i < nd_psn; i++ ) { |
if ( sig->pos == nd_psh[i]->sig->pos && |
if ( sig->pos == nd_psh[i]->sig->pos && |
_dl_redble(DL(nd_psh[i]->sig),DL(sig),nd_nvar) ) { |
_dl_redble(DL(nd_psh[i]->sig),DL(sig),nd_nvar) ) { |
_copydl(nd_nvar,DL(sig),DL(quo)); |
_copydl(nd_nvar,DL(sig),quo); |
_subfromdl(nd_nvar,DL(nd_psh[i]->sig),DL(quo)); |
_subfromdl(nd_nvar,DL(nd_psh[i]->sig),quo); |
_ndltodl(DL(nd_psh[i]),DL(mul)); |
_ndltodl(DL(nd_psh[i]),mul); |
_addtodl(nd_nvar,DL(quo),DL(mul)); |
_addtodl(nd_nvar,quo,mul); |
if ( (*cmpdl)(nd_nvar,lcm,DL(mul)) > 0 ) |
if ( (*cmpdl)(nd_nvar,lcm,mul) > 0 ) |
break; |
break; |
} |
} |
} |
} |
if ( i < nd_psn ) { |
if ( i < nd_psn ) { |
if ( DP_Print ) fprintf(asir_out,"M"); |
if ( DP_Print ) fprintf(asir_out,"M"); |
|
Nredundant++; |
continue; |
continue; |
} |
} |
if ( SG(l) != sugar ) { |
if ( SG(l) != sugar ) { |
|
|
goto again; |
goto again; |
} else if ( stat == -1 ) { |
} else if ( stat == -1 ) { |
if ( DP_Print ) { printf("S"); fflush(stdout); } |
if ( DP_Print ) { printf("S"); fflush(stdout); } |
|
FREENDP(l); |
} else if ( nf ) { |
} else if ( nf ) { |
if ( DP_Print ) { printf("+"); fflush(stdout); } |
if ( DP_Print ) { printf("+"); fflush(stdout); } |
hc = HCU(nf); |
hc = HCU(nf); |
nd_removecont(m,nf); |
nd_removecont(m,nf); |
nfv = ndtondv(m,nf); nd_free(nf); |
nfv = ndtondv(m,nf); nd_free(nf); |
nh = ndv_newps(m,nfv,0); |
nh = ndv_newps(m,nfv,0); |
|
|
d = update_pairs_s(d,g,nh,syzlist); |
d = update_pairs_s(d,g,nh,syzlist); |
g = append_one(g,nh); |
g = append_one(g,nh); |
FREENDP(l); |
FREENDP(l); |
} else { |
} else { |
// syzygy |
// syzygy |
|
get_eg(&eg1); |
d = remove_spair_s(d,sig); |
d = remove_spair_s(d,sig); |
|
get_eg(&eg2); add_eg(&eg_remove,&eg1,&eg2); |
syzlist = insert_sig(syzlist,sig); |
syzlist = insert_sig(syzlist,sig); |
if ( DP_Print ) { printf("."); fflush(stdout); } |
if ( DP_Print ) { printf("."); fflush(stdout); } |
FREENDP(l); |
FREENDP(l); |
} |
} |
} |
} |
conv_ilist(nd_demand,0,g,indp); |
conv_ilist(nd_demand,0,g,indp); |
if ( DP_Print ) { printf("nd_sba done. Number of nd_add=%d\n",Nnd_add); fflush(stdout); } |
if ( DP_Print ) { |
|
printf("\nnd_sba done. nd_add=%d,Nsyz=%d,Nredundant=%d\n",Nnd_add,Nsyz,Nredundant); |
|
fflush(stdout); |
|
print_eg("create",&eg_create); |
|
print_eg("merge",&eg_merge); |
|
print_eg("remove",&eg_remove); |
|
printf("\n"); |
|
} |
return g; |
return g; |
} |
} |
|
|
Line 3168 ND_pairs merge_pairs_s(ND_pairs d,ND_pairs d1); |
|
Line 3078 ND_pairs merge_pairs_s(ND_pairs d,ND_pairs d1); |
|
ND_pairs update_pairs_s( ND_pairs d, NODE /* of index */ g, int t,NODE syz) |
ND_pairs update_pairs_s( ND_pairs d, NODE /* of index */ g, int t,NODE syz) |
{ |
{ |
ND_pairs d1; |
ND_pairs d1; |
|
struct oEGT eg1,eg2,eg3; |
|
|
if ( !g ) return d; |
if ( !g ) return d; |
|
get_eg(&eg1); |
d1 = nd_newpairs_s(g,t,syz); |
d1 = nd_newpairs_s(g,t,syz); |
|
get_eg(&eg2); add_eg(&eg_create,&eg1,&eg2); |
d = merge_pairs_s(d,d1); |
d = merge_pairs_s(d,d1); |
|
get_eg(&eg3); add_eg(&eg_merge,&eg2,&eg3); |
return d; |
return d; |
} |
} |
|
|
Line 3224 int comp_sig(SIG s1,SIG s2) |
|
Line 3138 int comp_sig(SIG s1,SIG s2) |
|
static int nvar; |
static int nvar; |
int ret; |
int ret; |
|
|
if ( nvar < nd_nvar ) { |
if ( nvar != nd_nvar ) { |
nvar = nd_nvar; |
nvar = nd_nvar; NEWDL(m1,nvar); NEWDL(m2,nvar); |
NEWDL(m1,nvar); |
|
NEWDL(m2,nvar); |
|
} |
} |
_ndltodl(DL(nd_psh[s1->pos]),m1); |
// _ndltodl(DL(nd_psh[s1->pos]),m1); |
_ndltodl(DL(nd_psh[s2->pos]),m2); |
// _ndltodl(DL(nd_psh[s2->pos]),m2); |
|
_copydl(nd_nvar,nd_sba_hm[s1->pos],m1); |
|
_copydl(nd_nvar,nd_sba_hm[s2->pos],m2); |
_addtodl(nd_nvar,s1->dl,m1); |
_addtodl(nd_nvar,s1->dl,m1); |
_addtodl(nd_nvar,s2->dl,m2); |
_addtodl(nd_nvar,s2->dl,m2); |
ret = (*cmpdl)(nd_nvar,m1,m2); |
ret = (*cmpdl)(nd_nvar,m1,m2); |
Line 3257 int _create_spair_s(int i1,int i2,ND_pairs sp,SIG sig1 |
|
Line 3171 int _create_spair_s(int i1,int i2,ND_pairs sp,SIG sig1 |
|
s2 = SG(p2)-TD(DL(p2)); |
s2 = SG(p2)-TD(DL(p2)); |
SG(sp) = MAX(s1,s2) + TD(sp->lcm); |
SG(sp) = MAX(s1,s2) + TD(sp->lcm); |
|
|
if ( wpd < nd_wpd ) { |
if ( wpd != nd_wpd ) { |
wpd = nd_wpd; |
wpd = nd_wpd; |
lcm = (UINT *)MALLOC(wpd*sizeof(UINT)); |
lcm = (UINT *)MALLOC(wpd*sizeof(UINT)); |
} |
} |
// DL(sig1) <- sp->lcm |
// DL(sig1) <- sp->lcm |
// DL(sig1) -= DL(p1) |
// DL(sig1) -= DL(p1) |
// DL(sig1) += DL(p1->sig) |
// DL(sig1) += DL(p1->sig) |
ndl_copy(sp->lcm,lcm); |
ndl_sub(sp->lcm,DL(p1),lcm); |
ndl_subfrom(lcm,DL(p1)); |
|
_ndltodl(lcm,DL(sig1)); |
_ndltodl(lcm,DL(sig1)); |
_addtodl(nd_nvar,DL(p1->sig),DL(sig1)); |
_addtodl(nd_nvar,DL(p1->sig),DL(sig1)); |
sig1->pos = p1->sig->pos; |
sig1->pos = p1->sig->pos; |
Line 3273 int _create_spair_s(int i1,int i2,ND_pairs sp,SIG sig1 |
|
Line 3186 int _create_spair_s(int i1,int i2,ND_pairs sp,SIG sig1 |
|
// DL(sig2) <- sp->lcm |
// DL(sig2) <- sp->lcm |
// DL(sig2) -= DL(p2) |
// DL(sig2) -= DL(p2) |
// DL(sig2) += DL(p2->sig) |
// DL(sig2) += DL(p2->sig) |
ndl_copy(sp->lcm,lcm); |
ndl_sub(sp->lcm,DL(p2),lcm); |
ndl_subfrom(lcm,DL(p2)); |
|
_ndltodl(lcm,DL(sig2)); |
_ndltodl(lcm,DL(sig2)); |
_addtodl(nd_nvar,DL(p2->sig),DL(sig2)); |
_addtodl(nd_nvar,DL(p2->sig),DL(sig2)); |
sig2->pos = p2->sig->pos; |
sig2->pos = p2->sig->pos; |
Line 3379 ND_pairs nd_newpairs_s( NODE g, int t, NODE syz) |
|
Line 3291 ND_pairs nd_newpairs_s( NODE g, int t, NODE syz) |
|
{ |
{ |
NODE h,s; |
NODE h,s; |
UINT *dl; |
UINT *dl; |
int ts,ret; |
int ts,ret,i; |
ND_pairs r,r0,_sp,sp; |
ND_pairs r,r0,_sp,sp; |
SIG _sig1,_sig2,spsig,tsig; |
SIG _sig1,_sig2,spsig,tsig; |
|
struct oEGT eg1,eg2,eg3,eg4; |
|
|
dl = DL(nd_psh[t]); |
|
ts = SG(nd_psh[t]) - TD(dl); |
|
NEWND_pairs(_sp); |
NEWND_pairs(_sp); |
NEWSIG(_sig1); NEWSIG(_sig2); |
NEWSIG(_sig1); NEWSIG(_sig2); |
r0 = 0; |
r0 = 0; |
for ( h = g; h; h = NEXT(h) ) { |
for ( i = 0; i < t; i++ ) { |
ret = _create_spair_s((long)BDY(h),t,_sp,_sig1,_sig2); |
ret = _create_spair_s(i,t,_sp,_sig1,_sig2); |
|
// for ( h = g; h; h = NEXT(h) ) { |
|
// ret = _create_spair_s((long)BDY(h),t,_sp,_sig1,_sig2); |
if ( ret ) { |
if ( ret ) { |
spsig = _sp->sig; |
spsig = _sp->sig; |
for ( s = syz; s; s = s->next ) { |
for ( s = syz; s; s = s->next ) { |
Line 3401 ND_pairs nd_newpairs_s( NODE g, int t, NODE syz) |
|
Line 3314 ND_pairs nd_newpairs_s( NODE g, int t, NODE syz) |
|
NEWND_pairs(sp); |
NEWND_pairs(sp); |
dup_ND_pairs(sp,_sp); |
dup_ND_pairs(sp,_sp); |
r0 = insert_pair_s(r0,sp); |
r0 = insert_pair_s(r0,sp); |
} |
} else |
|
Nsyz++; |
} |
} |
} |
} |
return r0; |
return r0; |
Line 3792 int ndv_setup(int mod,int trace,NODE f,int dont_sort,i |
|
Line 3706 int ndv_setup(int mod,int trace,NODE f,int dont_sort,i |
|
if ( BDY(s) ) { w[i].p = BDY(s); w[i].i = j; i++; } |
if ( BDY(s) ) { w[i].p = BDY(s); w[i].i = j; i++; } |
if ( !dont_sort ) { |
if ( !dont_sort ) { |
/* XXX heuristic */ |
/* XXX heuristic */ |
if ( !nd_ord->id && (nd_ord->ord.simple<2) ) |
if ( !sba && !nd_ord->id && (nd_ord->ord.simple<2) ) |
qsort(w,nd_psn,sizeof(struct oNDVI), |
qsort(w,nd_psn,sizeof(struct oNDVI), |
(int (*)(const void *,const void *))ndvi_compare_rev); |
(int (*)(const void *,const void *))ndvi_compare_rev); |
else |
else |
Line 3869 int ndv_setup(int mod,int trace,NODE f,int dont_sort,i |
|
Line 3783 int ndv_setup(int mod,int trace,NODE f,int dont_sort,i |
|
} |
} |
} |
} |
if ( sba ) { |
if ( sba ) { |
|
nd_sba_hm = (DL *)MALLOC(nd_psn*sizeof(DL)); |
// setup signatures |
// setup signatures |
for ( i = 0; i < nd_psn; i++ ) { |
for ( i = 0; i < nd_psn; i++ ) { |
SIG sig; |
SIG sig; |
|
|
NEWSIG(sig); sig->pos = i; |
NEWSIG(sig); sig->pos = i; |
nd_ps[i]->sig = sig; |
nd_ps[i]->sig = sig; |
if ( nd_demand ) nd_ps_sym[i]->sig = sig; |
if ( nd_demand ) nd_ps_sym[i]->sig = sig; |
nd_psh[i]->sig = sig; |
nd_psh[i]->sig = sig; |
if ( trace ) { |
if ( trace ) { |
nd_ps_trace[i]->sig = sig; |
nd_ps_trace[i]->sig = sig; |
if ( nd_demand ) nd_ps_trace_sym[i]->sig = sig; |
if ( nd_demand ) nd_ps_trace_sym[i]->sig = sig; |
} |
} |
} |
NEWDL(nd_sba_hm[i],nd_nvar); |
|
_ndltodl(DL(nd_psh[i]),nd_sba_hm[i]); |
|
} |
} |
} |
if ( nd_gentrace && nd_tracelist ) NEXT(tn) = 0; |
if ( nd_gentrace && nd_tracelist ) NEXT(tn) = 0; |
return 1; |
return 1; |