| version 1.50, 2021/03/09 05:20:35 |
version 1.54, 2021/10/29 20:50:02 |
|
|
| /* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.c,v 1.49 2021/02/28 02:33:16 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.c,v 1.53 2021/03/12 01:18:33 noro Exp $ */ |
| |
|
| #include "nd.h" |
#include "nd.h" |
| |
|
| Line 2623 init_eg(&eg_update); |
|
| Line 2623 init_eg(&eg_update); |
|
| } |
} |
| sugar = 0; |
sugar = 0; |
| if ( nd_hpdata ) { |
if ( nd_hpdata ) { |
| |
if ( DP_Print ) fprintf(asir_out,"Hilbert driven algorithm.\n"); |
| setup_hpdata(&final_hpdata,¤t_hpdata); |
setup_hpdata(&final_hpdata,¤t_hpdata); |
| } |
} |
| while ( d ) { |
while ( d ) { |
|
|
| else { |
else { |
| final_hpvalue = hpvalue(&final_hpdata,sugar); |
final_hpvalue = hpvalue(&final_hpdata,sugar); |
| if ( final_hpvalue == hpvalue(¤t_hpdata,sugar) ) { |
if ( final_hpvalue == hpvalue(¤t_hpdata,sugar) ) { |
| if ( DP_Print ) fprintf(asir_out,"sugar=%d done.\n",sugar); |
// if ( DP_Print ) fprintf(asir_out,"done.\n",sugar); |
| d = nd_remove_same_sugar(d,sugar); |
d = nd_remove_same_sugar(d,sugar); |
| continue; |
continue; |
| } |
} |
| Line 2713 get_eg(&eg2); add_eg(&eg_update,&eg1,&eg2); |
|
| Line 2714 get_eg(&eg2); add_eg(&eg_update,&eg1,&eg2); |
|
| if ( nd_hpdata ) { |
if ( nd_hpdata ) { |
| update_hpdata(¤t_hpdata,nh,1); |
update_hpdata(¤t_hpdata,nh,1); |
| if ( final_hpvalue == hpvalue(¤t_hpdata,sugar) ) { |
if ( final_hpvalue == hpvalue(¤t_hpdata,sugar) ) { |
| if ( DP_Print ) fprintf(asir_out,"sugar=%d done.\n",sugar); |
// if ( DP_Print ) fprintf(asir_out,"sugar=%d done.\n",sugar); |
| d = nd_remove_same_sugar(d,sugar); |
d = nd_remove_same_sugar(d,sugar); |
| } |
} |
| } |
} |
| Line 2753 int nd_nf_s(int mod,ND d,ND g,NDV *ps,int full,ND *nf) |
|
| Line 2754 int nd_nf_s(int mod,ND d,ND g,NDV *ps,int full,ND *nf) |
|
| void _copydl(int n,DL d1,DL d2); |
void _copydl(int n,DL d1,DL d2); |
| void _subfromdl(int n,DL d1,DL d2); |
void _subfromdl(int n,DL d1,DL d2); |
| extern int (*cmpdl)(int n,DL d1,DL d2); |
extern int (*cmpdl)(int n,DL d1,DL d2); |
| |
int _dl_redble_ext(DL,DL,DL,int); |
| |
|
| |
int primitive_irred(ND p,SIG sig) |
| |
{ |
| |
static int wpd=0,dlen=0; |
| |
static DL dquo,squo; |
| |
static UINT *quo; |
| |
int i; |
| |
|
| |
if ( dlen < nd_nvar ) { |
| |
NEWDL(dquo,nd_nvar); |
| |
NEWDL(squo,nd_nvar); |
| |
dlen = nd_nvar; |
| |
} |
| |
if ( wpd != nd_wpd ) { |
| |
wpd = nd_wpd; |
| |
quo = (UINT *)MALLOC(wpd*sizeof(UINT)); |
| |
} |
| |
for ( i = 0; i < nd_psn; i++ ) { |
| |
if ( sig->pos == nd_psh[i]->sig->pos && |
| |
_dl_redble_ext(DL(nd_psh[i]->sig),DL(sig),squo,nd_nvar) ) |
| |
if ( ndl_reducible(HDL(p),DL(nd_psh[i])) ) { |
| |
if ( DP_Print ) fprintf(asir_out,"D"); |
| |
ndl_sub(HDL(p),DL(nd_psh[i]),quo); |
| |
_ndltodl(quo,dquo); |
| |
if ( _eqdl(nd_nvar,squo,dquo) ) |
| |
return 0; |
| |
} |
| |
} |
| |
return 1; |
| |
} |
| |
|
| NODE insert_sig(NODE l,SIG s) |
NODE insert_sig(NODE l,SIG s) |
| { |
{ |
| int pos; |
int pos; |
| Line 2806 ND_pairs remove_spair_s(ND_pairs d,SIG sig) |
|
| Line 2838 ND_pairs remove_spair_s(ND_pairs d,SIG sig) |
|
| return (ND_pairs)root.next; |
return (ND_pairs)root.next; |
| } |
} |
| |
|
| int _dl_redble_ext(DL,DL,DL,int); |
|
| |
|
| int small_lcm(ND_pairs l) |
int small_lcm(ND_pairs l) |
| { |
{ |
| SIG sig; |
SIG sig; |
| Line 3049 init_eg(&eg_hpdata); |
|
| Line 3079 init_eg(&eg_hpdata); |
|
| init_eg(&eg_sbabuch); |
init_eg(&eg_sbabuch); |
| get_eg(&eg3); |
get_eg(&eg3); |
| while ( 1 ) { |
while ( 1 ) { |
| if ( DP_Print && dlen%100 == 0 ) fprintf(asir_out,"(%d)",dlen); |
if ( DP_Print && !nd_hpdata && dlen%1000 == 0 ) fprintf(asir_out,"(%d)",dlen); |
| again : |
again : |
| get_eg(&eg1); |
get_eg(&eg1); |
| ind = nd_minsig(d); |
ind = nd_minsig(d); |
|
|
| get_eg(&eg2); add_eg(&eg_smallest,&eg1,&eg2); |
get_eg(&eg2); add_eg(&eg_smallest,&eg1,&eg2); |
| if ( l1 == 0 ) { |
if ( l1 == 0 ) { |
| d[ind] = d[ind]->next; dlen--; |
d[ind] = d[ind]->next; dlen--; |
| if ( DP_Print && !nd_hpdata ) fprintf(asir_out,"M"); |
// if ( DP_Print && !nd_hpdata ) fprintf(asir_out,"M"); |
| Nnominimal++; |
Nnominimal++; |
| continue; |
continue; |
| } |
} |
|
|
| get_eg(&eg2); add_eg(&eg_removecont,&eg1,&eg2); |
get_eg(&eg2); add_eg(&eg_removecont,&eg1,&eg2); |
| 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); |
| |
|
| get_eg(&eg1); |
get_eg(&eg1); |
| dlen += update_pairs_array_s(d,nh,syzlist); |
dlen += update_pairs_array_s(d,nh,syzlist); |
| get_eg(&eg2); add_eg(&eg_updatepairs,&eg1,&eg2); |
get_eg(&eg2); add_eg(&eg_updatepairs,&eg1,&eg2); |
|
|
| get_eg(&eg2); add_eg(&eg_hpdata,&eg1,&eg2); |
get_eg(&eg2); add_eg(&eg_hpdata,&eg1,&eg2); |
| if ( !compp(CO,final_hpdata.hn,current_hpdata.hn) ) { |
if ( !compp(CO,final_hpdata.hn,current_hpdata.hn) ) { |
| if ( DP_Print ) { printf("\nWe found a gb.\n"); } |
if ( DP_Print ) { printf("\nWe found a gb.\n"); } |
| break; |
break; |
| } |
} |
| } |
} |
| } else { |
} else { |
| Line 3371 NODE nd_gb_trace(int m,int ishomo,int **indp) |
|
| Line 3401 NODE nd_gb_trace(int m,int ishomo,int **indp) |
|
| } |
} |
| sugar = 0; |
sugar = 0; |
| if ( nd_hpdata ) { |
if ( nd_hpdata ) { |
| |
if ( DP_Print ) fprintf(asir_out,"Hilbert driven algorithm.\n"); |
| setup_hpdata(&final_hpdata,¤t_hpdata); |
setup_hpdata(&final_hpdata,¤t_hpdata); |
| } |
} |
| |
|
|
|
| else { |
else { |
| final_hpvalue = hpvalue(&final_hpdata,sugar); |
final_hpvalue = hpvalue(&final_hpdata,sugar); |
| if ( final_hpvalue == hpvalue(¤t_hpdata,sugar) ) { |
if ( final_hpvalue == hpvalue(¤t_hpdata,sugar) ) { |
| if ( DP_Print ) fprintf(asir_out,"sugar=%d done.\n",sugar); |
// if ( DP_Print ) fprintf(asir_out,"sugar=%d done.\n",sugar); |
| d = nd_remove_same_sugar(d,sugar); |
d = nd_remove_same_sugar(d,sugar); |
| continue; |
continue; |
| } |
} |
|
|
| if ( nd_hpdata ) { |
if ( nd_hpdata ) { |
| update_hpdata(¤t_hpdata,nh,1); |
update_hpdata(¤t_hpdata,nh,1); |
| if ( final_hpvalue == hpvalue(¤t_hpdata,sugar) ) { |
if ( final_hpvalue == hpvalue(¤t_hpdata,sugar) ) { |
| if ( DP_Print ) fprintf(asir_out,"sugar=%d done.\n",sugar); |
// if ( DP_Print ) fprintf(asir_out,"sugar=%d done.\n",sugar); |
| d = nd_remove_same_sugar(d,sugar); |
d = nd_remove_same_sugar(d,sugar); |
| } |
} |
| } |
} |
| Line 5054 void nd_sba(LIST f,LIST v,int m,int homo,int retdp,int |
|
| Line 5085 void nd_sba(LIST f,LIST v,int m,int homo,int retdp,int |
|
| int *perm; |
int *perm; |
| EPOS oepos; |
EPOS oepos; |
| int obpe,oadv,ompos,cbpe; |
int obpe,oadv,ompos,cbpe; |
| struct oEGT eg0,eg1,egconv; |
struct oEGT eg0,eg1,egconv,egintred; |
| |
|
| nd_module = 0; |
nd_module = 0; |
| nd_demand = 0; |
nd_demand = 0; |
| Line 5140 void nd_sba(LIST f,LIST v,int m,int homo,int retdp,int |
|
| Line 5171 void nd_sba(LIST f,LIST v,int m,int homo,int retdp,int |
|
| nd_setup_parameters(nvar,0); |
nd_setup_parameters(nvar,0); |
| } |
} |
| nd_demand = 0; |
nd_demand = 0; |
| |
get_eg(&eg0); |
| x = ndv_reducebase(x,perm); |
x = ndv_reducebase(x,perm); |
| x = ndv_reduceall(m,x); |
x = ndv_reduceall(m,x); |
| |
get_eg(&eg1); init_eg(&egintred); add_eg(&egintred,&eg0,&eg1); |
| nd_setup_parameters(nd_nvar,0); |
nd_setup_parameters(nd_nvar,0); |
| get_eg(&eg0); |
get_eg(&eg0); |
| for ( r0 = 0, t = x; t; t = NEXT(t) ) { |
for ( r0 = 0, t = x; t; t = NEXT(t) ) { |
| Line 5161 void nd_sba(LIST f,LIST v,int m,int homo,int retdp,int |
|
| Line 5194 void nd_sba(LIST f,LIST v,int m,int homo,int retdp,int |
|
| } else |
} else |
| MKLIST(*rp,r0); |
MKLIST(*rp,r0); |
| get_eg(&eg1); init_eg(&egconv); add_eg(&egconv,&eg0,&eg1); |
get_eg(&eg1); init_eg(&egconv); add_eg(&egconv,&eg0,&eg1); |
| |
print_eg("intred",&egintred); fprintf(asir_out,"\n"); |
| print_eg("conv",&egconv); fprintf(asir_out,"\n"); |
print_eg("conv",&egconv); fprintf(asir_out,"\n"); |
| } |
} |
| |
|
| Line 5595 void nd_gr_trace(LIST f,LIST v,int trace,int homo,int |
|
| Line 5629 void nd_gr_trace(LIST f,LIST v,int trace,int homo,int |
|
| tl3 = nd_alltracelist; nd_alltracelist = 0; |
tl3 = nd_alltracelist; nd_alltracelist = 0; |
| } else tl3 = 0; |
} else tl3 = 0; |
| /* gbcheck : cand is a GB of Id(cand) ? */ |
/* gbcheck : cand is a GB of Id(cand) ? */ |
| if ( nd_vc || nd_gentrace || nd_gensyz ) |
if ( nd_vc || nd_gentrace || nd_gensyz || do_weyl ) |
| ret = nd_gb(0,0,1,nd_gensyz?1:0,0)!=0; |
ret = nd_gb(0,0,1,nd_gensyz?1:0,0)!=0; |
| else |
else |
| ret = nd_f4(0,1,0)!=0; |
ret = nd_f4(0,1,0)!=0; |