version 1.33, 2020/07/09 02:33:38 |
version 1.36, 2020/09/27 04:35:04 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.c,v 1.32 2020/07/07 08:08:26 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.c,v 1.35 2020/08/26 06:40:36 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; |
int Nsyz,Nsamesig; |
|
|
Obj nd_top_weight; |
Obj nd_top_weight; |
|
|
Line 1223 void print_sig(SIG s) |
|
Line 1223 void print_sig(SIG s) |
|
fprintf(asir_out,">>*e%d",s->pos); |
fprintf(asir_out,">>*e%d",s->pos); |
} |
} |
|
|
|
// assuming increasing order wrt signature |
|
|
INLINE int ndl_find_reducer_s(UINT *dg,SIG sig) |
INLINE int ndl_find_reducer_s(UINT *dg,SIG sig) |
{ |
{ |
RHist r; |
RHist r; |
Line 1237 INLINE int ndl_find_reducer_s(UINT *dg,SIG sig) |
|
Line 1239 INLINE int ndl_find_reducer_s(UINT *dg,SIG sig) |
|
tmp = (UINT *)MALLOC(wpd*sizeof(UINT)); |
tmp = (UINT *)MALLOC(wpd*sizeof(UINT)); |
} |
} |
d = ndl_hash_value(dg); |
d = ndl_hash_value(dg); |
|
#if 1 |
for ( r = nd_red[d], k = 0; r; r = NEXT(r), k++ ) { |
for ( r = nd_red[d], k = 0; r; r = NEXT(r), k++ ) { |
if ( ndl_equal(dg,DL(r)) ) { |
if ( ndl_equal(dg,DL(r)) ) { |
return r->index; |
return r->index; |
} |
} |
} |
} |
|
#endif |
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]; |
Line 2477 get_eg(&eg2); add_eg(&eg_update,&eg1,&eg2); |
|
Line 2481 get_eg(&eg2); add_eg(&eg_update,&eg1,&eg2); |
|
} |
} |
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 ( !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; |
if ( DP_Print ) |
|
print_eg("update",&eg_update); |
|
return g; |
} |
} |
|
|
ND_pairs update_pairs_s(ND_pairs d,int t,NODE *syz); |
ND_pairs update_pairs_s(ND_pairs d,int t,NODE *syz); |
Line 2713 get_eg(&eg2); add_eg(&eg_remove,&eg1,&eg2); |
|
Line 2719 get_eg(&eg2); add_eg(&eg_remove,&eg1,&eg2); |
|
} |
} |
g = conv_ilist_s(nd_demand,0,indp); |
g = conv_ilist_s(nd_demand,0,indp); |
if ( DP_Print ) { |
if ( DP_Print ) { |
printf("\nnd_sba done. nd_add=%d,Nsyz=%d,Nredundant=%d\n",Nnd_add,Nsyz,Nredundant); |
printf("\nnd_sba done. nd_add=%d,Nsyz=%d,Nsamesig=%d,Nredundant=%d\n",Nnd_add,Nsyz,Nsamesig,Nredundant); |
fflush(stdout); |
fflush(stdout); |
print_eg("create",&eg_create); |
print_eg("create",&eg_create); |
print_eg("merge",&eg_merge); |
print_eg("merge",&eg_merge); |
Line 3307 ND_pairs merge_pairs_s(ND_pairs p1,ND_pairs p2) |
|
Line 3313 ND_pairs merge_pairs_s(ND_pairs p1,ND_pairs p2) |
|
r->next = q2; r = q2; q2 = q2->next; |
r->next = q2; r = q2; q2 = q2->next; |
} else { |
} else { |
ret = DL_COMPARE(q1->lcm,q2->lcm); |
ret = DL_COMPARE(q1->lcm,q2->lcm); |
|
Nsamesig++; |
if ( ret < 0 ) { |
if ( ret < 0 ) { |
r->next = q1; r = q1; q1 = q1->next; |
r->next = q1; r = q1; q1 = q1->next; |
q2 = q2->next; |
q2 = q2->next; |
Line 4266 void nd_sba(LIST f,LIST v,int m,int homo,int retdp,int |
|
Line 4273 void nd_sba(LIST f,LIST v,int m,int homo,int retdp,int |
|
nd_module = 0; |
nd_module = 0; |
nd_demand = 0; |
nd_demand = 0; |
parse_nd_option(current_option); |
parse_nd_option(current_option); |
|
Nsamesig = 0; |
if ( DP_Multiple ) |
if ( DP_Multiple ) |
nd_scale = ((double)DP_Multiple)/(double)(Denominator?Denominator:1); |
nd_scale = ((double)DP_Multiple)/(double)(Denominator?Denominator:1); |
get_vars((Obj)f,&fv); pltovl(v,&vv); vlminus(fv,vv,&nd_vc); |
get_vars((Obj)f,&fv); pltovl(v,&vv); vlminus(fv,vv,&nd_vc); |
Line 4337 void nd_sba(LIST f,LIST v,int m,int homo,int retdp,int |
|
Line 4344 void nd_sba(LIST f,LIST v,int m,int homo,int retdp,int |
|
for ( r0 = 0, t = x; t; t = NEXT(t) ) { |
for ( r0 = 0, t = x; t; t = NEXT(t) ) { |
NEXTNODE(r0,r); |
NEXTNODE(r0,r); |
if ( retdp ) BDY(r) = ndvtodp(m,BDY(t)); |
if ( retdp ) BDY(r) = ndvtodp(m,BDY(t)); |
BDY(r) = ndvtop(m,CO,vv,BDY(t)); |
else BDY(r) = ndvtop(m,CO,vv,BDY(t)); |
} |
} |
if ( r0 ) NEXT(r) = 0; |
if ( r0 ) NEXT(r) = 0; |
MKLIST(*rp,r0); |
MKLIST(*rp,r0); |
Line 10875 int nd_symbolic_preproc_s(PGeoBucket bucket,int trace, |
|
Line 10882 int nd_symbolic_preproc_s(PGeoBucket bucket,int trace, |
|
|
|
NODE nd_sba_f4(int m,int **indp) |
NODE nd_sba_f4(int m,int **indp) |
{ |
{ |
int i,nh,stat,index,f4red; |
int i,nh,stat,index,f4red,f4step; |
int col,rank,len,k,j,a,sugar,nbase,psugar,ms; |
int col,rank,len,k,j,a,sugar,nbase,psugar,ms; |
NODE r,g,rp0,nflist; |
NODE r,g,rp0,nflist; |
ND_pairs d,l,t; |
ND_pairs d,l,t; |
Line 10899 NODE nd_sba_f4(int m,int **indp) |
|
Line 10906 NODE nd_sba_f4(int m,int **indp) |
|
nd_nbase = nd_psn; |
nd_nbase = nd_psn; |
f4red = 1; |
f4red = 1; |
psugar = 0; |
psugar = 0; |
|
f4step = 0; |
while ( d ) { |
while ( d ) { |
for ( t = d, ms = SG(d); t; t = NEXT(t) ) |
for ( t = d, ms = SG(d); t; t = NEXT(t) ) |
if ( SG(t) < ms ) ms = SG(t); |
if ( SG(t) < ms ) ms = SG(t); |
if ( ms == psugar ) { |
if ( ms == psugar && f4step >= 2 ) { |
again: |
again: |
l = d; d = d->next; |
l = d; d = d->next; |
if ( small_lcm(l) ) { |
if ( small_lcm(l) ) { |
|
|
FREENDP(l); |
FREENDP(l); |
} |
} |
} else { |
} else { |
|
if ( ms != psugar ) f4step = 1; |
|
else f4step++; |
again2: |
again2: |
if ( DP_Print ) { printf("\n"); fflush(stdout); } |
|
psugar = ms; |
psugar = ms; |
l = nd_minsugarp_s(d,&d); |
l = nd_minsugarp_s(d,&d); |
sugar = nd_sugarweight?d->sugar2:SG(d); |
sugar = nd_sugarweight?d->sugar2:SG(d); |
|
|
d = nd_reconstruct(0,d); |
d = nd_reconstruct(0,d); |
goto again2; |
goto again2; |
} |
} |
if ( DP_Print ) fprintf(asir_out,"sugar=%d,",psugar); |
if ( DP_Print ) fprintf(asir_out,"\nsugar=%d,",psugar); |
nflist = nd_f4_red_s(m,l,0,s0vect,col,rp0,syzlist); |
nflist = nd_f4_red_s(m,l,0,s0vect,col,rp0,syzlist); |
/* adding new bases */ |
/* adding new bases */ |
for ( r = nflist; r; r = NEXT(r) ) { |
for ( r = nflist; r; r = NEXT(r) ) { |
|
|
d = remove_spair_s(d,(SIG)BDY(r)); |
d = remove_spair_s(d,(SIG)BDY(r)); |
d = remove_large_lcm(d); |
d = remove_large_lcm(d); |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"f4red=%d,gblen=%d\n",f4red,nd_psn); fflush(asir_out); |
fprintf(asir_out,"f4red=%d,gblen=%d",f4red,nd_psn); fflush(asir_out); |
} |
} |
f4red++; |
f4red++; |
} |
} |
} |
} |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"number of red=%d,",Nf4_red); |
fprintf(asir_out,"\nnumber of red=%d,",Nf4_red); |
} |
} |
g = conv_ilist_s(nd_demand,0,indp); |
g = conv_ilist_s(nd_demand,0,indp); |
return g; |
return g; |