version 1.51, 2021/03/09 07:07:02 |
version 1.53, 2021/03/12 01:18:33 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.c,v 1.50 2021/03/09 05:20:35 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2018/engine/nd.c,v 1.52 2021/03/09 08:48:50 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); |
} |
} |
} |
} |