version 1.240, 2017/09/15 01:52:51 |
version 1.242, 2017/09/17 02:34:02 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.239 2017/09/14 01:34:53 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.241 2017/09/16 08:02:35 noro Exp $ */ |
|
|
#include "nd.h" |
#include "nd.h" |
|
|
Line 65 static int *nd_gbblock; |
|
Line 65 static int *nd_gbblock; |
|
static NODE nd_nzlist,nd_check_splist; |
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; |
static int nd_f4red,nd_rank0,nd_last_nonzero; |
|
|
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 3228 void nd_gr(LIST f,LIST v,int m,int homo,int retdp,int |
|
Line 3228 void nd_gr(LIST f,LIST v,int m,int homo,int retdp,int |
|
NODE tr,tl1,tl2,tl3,tl4,nzlist; |
NODE tr,tl1,tl2,tl3,tl4,nzlist; |
LIST l1,l2,l3,l4,l5; |
LIST l1,l2,l3,l4,l5; |
int j; |
int j; |
Q jq,bpe; |
Q jq,bpe,last_nonzero; |
int *perm; |
int *perm; |
EPOS oepos; |
EPOS oepos; |
int obpe,oadv,ompos,cbpe; |
int obpe,oadv,ompos,cbpe; |
|
|
if ( nd_gentrace ) { |
if ( nd_gentrace ) { |
if ( f4 ) { |
if ( f4 ) { |
STOQ(16,bpe); |
STOQ(16,bpe); |
tr = mknode(4,*rp,(!ishomo&&homo)?ONE:0,BDY(nzlist),bpe); MKLIST(*rp,tr); |
STOQ(nd_last_nonzero,last_nonzero); |
|
tr = mknode(5,*rp,(!ishomo&&homo)?ONE:0,BDY(nzlist),bpe,last_nonzero); MKLIST(*rp,tr); |
|
|
} else { |
} else { |
tl1 = reverse_node(tl1); tl2 = reverse_node(tl2); |
tl1 = reverse_node(tl1); tl2 = reverse_node(tl2); |
tl3 = reverse_node(tl3); |
tl3 = reverse_node(tl3); |
Line 3840 void nd_gr_trace(LIST f,LIST v,int trace,int homo,int |
|
Line 3842 void nd_gr_trace(LIST f,LIST v,int trace,int homo,int |
|
} |
} |
get_eg(&eg1); init_eg(&eg_check); add_eg(&eg_check,&eg0,&eg1); |
get_eg(&eg1); init_eg(&eg_check); add_eg(&eg_check,&eg0,&eg1); |
if ( DP_Print ) |
if ( DP_Print ) |
fprintf(asir_out,"check=%fsec\n",eg_check.exectime+eg_check.gctime); |
fprintf(asir_out,"check=%.3fsec,",eg_check.exectime+eg_check.gctime); |
/* dp->p */ |
/* dp->p */ |
nd_bpe = cbpe; |
nd_bpe = cbpe; |
nd_setup_parameters(nd_nvar,0); |
nd_setup_parameters(nd_nvar,0); |
Line 5822 int nd_to_vect(int mod,UINT *s0,int n,ND d,UINT *r) |
|
Line 5824 int nd_to_vect(int mod,UINT *s0,int n,ND d,UINT *r) |
|
return i; |
return i; |
} |
} |
|
|
#if defined(__GNUC__) |
#if defined(__GNUC__) && SIZEOF_LONG==8 |
|
|
#define MOD128(a,c,m) ((a)=(((c)!=0||((a)>=(m)))?(((((U128)(c))<<64)+(a))%(m)):(a))) |
#define MOD128(a,c,m) ((a)=(((c)!=0||((a)>=(m)))?(((((U128)(c))<<64)+(a))%(m)):(a))) |
|
|
Line 6237 int ndv_reduce_vect(int m,UINT *svect,int col,IndArray |
|
Line 6239 int ndv_reduce_vect(int m,UINT *svect,int col,IndArray |
|
return maxrs; |
return maxrs; |
} |
} |
|
|
#if defined(__GNUC__) |
#if defined(__GNUC__) && SIZEOF_LONG==8 |
|
|
int ndv_reduce_vect64(int m,U64 *svect,U64 *cvect,int col,IndArray *imat,NM_ind_pair *rp0,int nred) |
int ndv_reduce_vect64(int m,U64 *svect,U64 *cvect,int col,IndArray *imat,NM_ind_pair *rp0,int nred) |
{ |
{ |
Line 6566 NDV vect_to_ndv(UINT *vect,int spcol,int col,int *rhea |
|
Line 6568 NDV vect_to_ndv(UINT *vect,int spcol,int col,int *rhea |
|
} |
} |
} |
} |
|
|
#if defined(__GNUC__) |
#if defined(__GNUC__) && SIZEOF_LONG==8 |
NDV vect64_to_ndv(U64 *vect,int spcol,int col,int *rhead,UINT *s0vect) |
NDV vect64_to_ndv(U64 *vect,int spcol,int col,int *rhead,UINT *s0vect) |
{ |
{ |
int j,k,len; |
int j,k,len; |
Line 6834 NODE nd_f4(int m,int checkonly,int **indp) |
|
Line 6836 NODE nd_f4(int m,int checkonly,int **indp) |
|
} |
} |
nzlist = 0; |
nzlist = 0; |
nzlist_t = nd_nzlist; |
nzlist_t = nd_nzlist; |
f4red = 0; |
f4red = 1; |
|
nd_last_nonzero = 0; |
while ( d || nzlist_t ) { |
while ( d || nzlist_t ) { |
get_eg(&eg0); |
get_eg(&eg0); |
if ( nd_nzlist ) { |
if ( nd_nzlist ) { |
node = BDY((LIST)BDY(nzlist_t)); |
node = BDY((LIST)BDY(nzlist_t)); |
sugar = (int)ARG0(node); |
sugar = QTOS((Q)ARG0(node)); |
tn = BDY((LIST)ARG1(node)); |
tn = BDY((LIST)ARG1(node)); |
if ( !tn ) { |
if ( !tn ) { |
nzlist_t = NEXT(nzlist_t); |
nzlist_t = NEXT(nzlist_t); |
Line 6872 NODE nd_f4(int m,int checkonly,int **indp) |
|
Line 6875 NODE nd_f4(int m,int checkonly,int **indp) |
|
} |
} |
get_eg(&eg1); init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg1); |
get_eg(&eg1); init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg1); |
if ( DP_Print ) |
if ( DP_Print ) |
fprintf(asir_out,"sugar=%d,symb=%fsec,", |
fprintf(asir_out,"sugar=%d,symb=%.3fsec,", |
sugar,eg_f4.exectime+eg_f4.gctime); |
sugar,eg_f4.exectime+eg_f4.gctime); |
nflist = nd_f4_red(m,l,0,s0vect,col,rp0,nd_gentrace?&ll:0); |
nflist = nd_f4_red(m,l,0,s0vect,col,rp0,nd_gentrace?&ll:0); |
if ( checkonly && nflist ) return 0; |
if ( checkonly && nflist ) return 0; |
/* adding new bases */ |
/* adding new bases */ |
|
if ( nflist ) nd_last_nonzero = f4red; |
for ( r = nflist; r; r = NEXT(r) ) { |
for ( r = nflist; r; r = NEXT(r) ) { |
nf = (NDV)BDY(r); |
nf = (NDV)BDY(r); |
ndv_removecont(m,nf); |
ndv_removecont(m,nf); |
Line 6893 NODE nd_f4(int m,int checkonly,int **indp) |
|
Line 6897 NODE nd_f4(int m,int checkonly,int **indp) |
|
g = update_base(g,nh); |
g = update_base(g,nh); |
} |
} |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"f4red=%d,gblen=%d,",f4red,length(g)); fflush(asir_out); |
fprintf(asir_out,"f4red=%d,gblen=%d\n",f4red,length(g)); fflush(asir_out); |
} |
} |
if ( nd_gentrace ) { |
if ( nd_gentrace ) { |
for ( t = ll, tn0 = 0; t; t = NEXT(t) ) { |
for ( t = ll, tn0 = 0; t; t = NEXT(t) ) { |
Line 6908 NODE nd_f4(int m,int checkonly,int **indp) |
|
Line 6912 NODE nd_f4(int m,int checkonly,int **indp) |
|
} |
} |
if ( nd_nzlist ) nzlist_t = NEXT(nzlist_t); |
if ( nd_nzlist ) nzlist_t = NEXT(nzlist_t); |
f4red++; |
f4red++; |
if ( nd_f4red && f4red >= nd_f4red ) break; |
if ( nd_f4red && f4red > nd_f4red ) break; |
if ( nd_rank0 && !nflist ) break; |
if ( nd_rank0 && !nflist ) break; |
} |
} |
if ( nd_gentrace ) { |
if ( nd_gentrace ) { |
Line 6971 NODE nd_f4_trace(int m,int **indp) |
|
Line 6975 NODE nd_f4_trace(int m,int **indp) |
|
} |
} |
get_eg(&eg1); init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg1); |
get_eg(&eg1); init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg1); |
if ( DP_Print ) |
if ( DP_Print ) |
fprintf(asir_out,"sugar=%d,symb=%fsec,", |
fprintf(asir_out,"sugar=%d,symb=%.3fsec,", |
sugar,eg_f4.exectime+eg_f4.gctime); |
sugar,eg_f4.exectime+eg_f4.gctime); |
nflist = nd_f4_red(m,l,0,s0vect,col,rp0,&l0); |
nflist = nd_f4_red(m,l,0,s0vect,col,rp0,&l0); |
if ( !l0 ) continue; |
if ( !l0 ) continue; |
Line 7185 init_eg(&eg_search); |
|
Line 7189 init_eg(&eg_search); |
|
get_eg(&eg2); |
get_eg(&eg2); |
init_eg(&eg_elim2); add_eg(&eg_elim2,&eg1,&eg2); |
init_eg(&eg_elim2); add_eg(&eg_elim2,&eg1,&eg2); |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"elim1=%fsec,elim2=%fsec\n", |
fprintf(asir_out,"elim1=%.3fsec,elim2=%.3fsec,", |
eg_elim1.exectime+eg_elim1.gctime,eg_elim2.exectime+eg_elim2.gctime); |
eg_elim1.exectime+eg_elim1.gctime,eg_elim2.exectime+eg_elim2.gctime); |
fflush(asir_out); |
fflush(asir_out); |
} |
} |
Line 7216 init_eg(&eg_search); |
|
Line 7220 init_eg(&eg_search); |
|
|
|
/* construction of index arrays */ |
/* construction of index arrays */ |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(stderr,"%dx%d,",nsp+nred,col); |
fprintf(asir_out,"%dx%d,",nsp+nred,col); |
} |
} |
rvect = (NM_ind_pair *)MALLOC(nred*sizeof(NM_ind_pair)); |
rvect = (NM_ind_pair *)MALLOC(nred*sizeof(NM_ind_pair)); |
s0hash = (int *)MALLOC(col*sizeof(int)); |
s0hash = (int *)MALLOC(col*sizeof(int)); |
Line 7228 init_eg(&eg_search); |
|
Line 7232 init_eg(&eg_search); |
|
rhead[imat[i]->head] = 1; |
rhead[imat[i]->head] = 1; |
} |
} |
if ( m > 0 ) |
if ( m > 0 ) |
#if defined(__GNUC__) |
#if defined(__GNUC__) && SIZEOF_LONG==8 |
r0 = nd_f4_red_mod64_main(m,sp0,nsp,s0vect,col,rvect,rhead,imat,nred,nz); |
r0 = nd_f4_red_mod64_main(m,sp0,nsp,s0vect,col,rvect,rhead,imat,nred,nz); |
#else |
#else |
r0 = nd_f4_red_main(m,sp0,nsp,s0vect,col,rvect,rhead,imat,nred,nz); |
r0 = nd_f4_red_main(m,sp0,nsp,s0vect,col,rvect,rhead,imat,nred,nz); |
Line 7243 init_eg(&eg_search); |
|
Line 7247 init_eg(&eg_search); |
|
#else |
#else |
r0 = nd_f4_red_gz_main(sp0,nsp,trace,s0vect,col,rvect,rhead,imat,nred); |
r0 = nd_f4_red_gz_main(sp0,nsp,trace,s0vect,col,rvect,rhead,imat,nred); |
#endif |
#endif |
|
#if 0 |
if ( DP_Print ) print_eg("search",&eg_search); |
if ( DP_Print ) print_eg("search",&eg_search); |
|
#endif |
return r0; |
return r0; |
} |
} |
|
|
Line 7294 NODE nd_f4_red_main(int m,ND_pairs sp0,int nsp,UINT *s |
|
Line 7300 NODE nd_f4_red_main(int m,ND_pairs sp0,int nsp,UINT *s |
|
} |
} |
get_eg(&eg1); init_eg(&eg_f4_1); add_eg(&eg_f4_1,&eg0,&eg1); |
get_eg(&eg1); init_eg(&eg_f4_1); add_eg(&eg_f4_1,&eg0,&eg1); |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"elim1=%fsec,",eg_f4_1.exectime+eg_f4_1.gctime); |
fprintf(asir_out,"elim1=%.3fsec,",eg_f4_1.exectime+eg_f4_1.gctime); |
fflush(asir_out); |
fflush(asir_out); |
} |
} |
/* free index arrays */ |
/* free index arrays */ |
Line 7319 NODE nd_f4_red_main(int m,ND_pairs sp0,int nsp,UINT *s |
|
Line 7325 NODE nd_f4_red_main(int m,ND_pairs sp0,int nsp,UINT *s |
|
get_eg(&eg2); init_eg(&eg_f4_2); add_eg(&eg_f4_2,&eg1,&eg2); |
get_eg(&eg2); init_eg(&eg_f4_2); add_eg(&eg_f4_2,&eg1,&eg2); |
init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg2); |
init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg2); |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"elim2=%fsec\n",eg_f4_2.exectime+eg_f4_2.gctime); |
fprintf(asir_out,"elim2=%.3fsec,",eg_f4_2.exectime+eg_f4_2.gctime); |
fprintf(asir_out,"nsp=%d,nred=%d,spmat=(%d,%d),rank=%d ", |
fprintf(asir_out,"nsp=%d,nred=%d,spmat=(%d,%d),rank=%d ", |
nsp,nred,sprow,spcol,rank); |
nsp,nred,sprow,spcol,rank); |
fprintf(asir_out,"%fsec\n",eg_f4.exectime+eg_f4.gctime); |
fprintf(asir_out,"%.3fsec,",eg_f4.exectime+eg_f4.gctime); |
} |
} |
if ( nz ) { |
if ( nz ) { |
for ( i = 0; i < rank-1; i++ ) NEXT(spactive[i]) = spactive[i+1]; |
for ( i = 0; i < rank-1; i++ ) NEXT(spactive[i]) = spactive[i+1]; |
Line 7335 NODE nd_f4_red_main(int m,ND_pairs sp0,int nsp,UINT *s |
|
Line 7341 NODE nd_f4_red_main(int m,ND_pairs sp0,int nsp,UINT *s |
|
return r0; |
return r0; |
} |
} |
|
|
#if defined(__GNUC__) |
#if defined(__GNUC__) && SIZEOF_LONG==8 |
/* for Fp, 2^15=<p<2^29 */ |
/* for Fp, 2^15=<p<2^29 */ |
|
|
NODE nd_f4_red_mod64_main(int m,ND_pairs sp0,int nsp,UINT *s0vect,int col, |
NODE nd_f4_red_mod64_main(int m,ND_pairs sp0,int nsp,UINT *s0vect,int col, |
Line 7382 NODE nd_f4_red_mod64_main(int m,ND_pairs sp0,int nsp,U |
|
Line 7388 NODE nd_f4_red_mod64_main(int m,ND_pairs sp0,int nsp,U |
|
} |
} |
get_eg(&eg1); init_eg(&eg_f4_1); add_eg(&eg_f4_1,&eg0,&eg1); |
get_eg(&eg1); init_eg(&eg_f4_1); add_eg(&eg_f4_1,&eg0,&eg1); |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"elim1=%fsec,",eg_f4_1.exectime+eg_f4_1.gctime); |
fprintf(asir_out,"elim1=%.3fsec,",eg_f4_1.exectime+eg_f4_1.gctime); |
fflush(asir_out); |
fflush(asir_out); |
} |
} |
/* free index arrays */ |
/* free index arrays */ |
Line 7404 NODE nd_f4_red_mod64_main(int m,ND_pairs sp0,int nsp,U |
|
Line 7410 NODE nd_f4_red_mod64_main(int m,ND_pairs sp0,int nsp,U |
|
get_eg(&eg2); init_eg(&eg_f4_2); add_eg(&eg_f4_2,&eg1,&eg2); |
get_eg(&eg2); init_eg(&eg_f4_2); add_eg(&eg_f4_2,&eg1,&eg2); |
init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg2); |
init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg2); |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"elim2=%fsec\n",eg_f4_2.exectime+eg_f4_2.gctime); |
fprintf(asir_out,"elim2=%.3fsec,",eg_f4_2.exectime+eg_f4_2.gctime); |
fprintf(asir_out,"nsp=%d,nred=%d,spmat=(%d,%d),rank=%d ", |
fprintf(asir_out,"nsp=%d,nred=%d,spmat=(%d,%d),rank=%d ", |
nsp,nred,sprow,spcol,rank); |
nsp,nred,sprow,spcol,rank); |
fprintf(asir_out,"%fsec\n",eg_f4.exectime+eg_f4.gctime); |
fprintf(asir_out,"%.3fsec,",eg_f4.exectime+eg_f4.gctime); |
} |
} |
if ( nz ) { |
if ( nz ) { |
for ( i = 0; i < rank-1; i++ ) NEXT(spactive[i]) = spactive[i+1]; |
for ( i = 0; i < rank-1; i++ ) NEXT(spactive[i]) = spactive[i+1]; |
Line 7465 NODE nd_f4_red_sf_main(int m,ND_pairs sp0,int nsp,UINT |
|
Line 7471 NODE nd_f4_red_sf_main(int m,ND_pairs sp0,int nsp,UINT |
|
} |
} |
get_eg(&eg1); init_eg(&eg_f4_1); add_eg(&eg_f4_1,&eg0,&eg1); |
get_eg(&eg1); init_eg(&eg_f4_1); add_eg(&eg_f4_1,&eg0,&eg1); |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"elim1=%fsec,",eg_f4_1.exectime+eg_f4_1.gctime); |
fprintf(asir_out,"elim1=%.3fsec,",eg_f4_1.exectime+eg_f4_1.gctime); |
fflush(asir_out); |
fflush(asir_out); |
} |
} |
/* free index arrays */ |
/* free index arrays */ |
Line 7487 NODE nd_f4_red_sf_main(int m,ND_pairs sp0,int nsp,UINT |
|
Line 7493 NODE nd_f4_red_sf_main(int m,ND_pairs sp0,int nsp,UINT |
|
get_eg(&eg2); init_eg(&eg_f4_2); add_eg(&eg_f4_2,&eg1,&eg2); |
get_eg(&eg2); init_eg(&eg_f4_2); add_eg(&eg_f4_2,&eg1,&eg2); |
init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg2); |
init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg2); |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"elim2=%fsec\n",eg_f4_2.exectime+eg_f4_2.gctime); |
fprintf(asir_out,"elim2=%.3fsec,",eg_f4_2.exectime+eg_f4_2.gctime); |
fprintf(asir_out,"nsp=%d,nred=%d,spmat=(%d,%d),rank=%d ", |
fprintf(asir_out,"nsp=%d,nred=%d,spmat=(%d,%d),rank=%d ", |
nsp,nred,sprow,spcol,rank); |
nsp,nred,sprow,spcol,rank); |
fprintf(asir_out,"%fsec\n",eg_f4.exectime+eg_f4.gctime); |
fprintf(asir_out,"%.3fsec,",eg_f4.exectime+eg_f4.gctime); |
} |
} |
if ( nz ) { |
if ( nz ) { |
for ( i = 0; i < rank-1; i++ ) NEXT(spactive[i]) = spactive[i+1]; |
for ( i = 0; i < rank-1; i++ ) NEXT(spactive[i]) = spactive[i+1]; |
Line 7542 NODE nd_f4_red_lf_main(int m,ND_pairs sp0,int nsp,int |
|
Line 7548 NODE nd_f4_red_lf_main(int m,ND_pairs sp0,int nsp,int |
|
} |
} |
get_eg(&eg1); init_eg(&eg_f4_1); add_eg(&eg_f4_1,&eg0,&eg1); |
get_eg(&eg1); init_eg(&eg_f4_1); add_eg(&eg_f4_1,&eg0,&eg1); |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"elim1=%fsec,",eg_f4_1.exectime+eg_f4_1.gctime); |
fprintf(asir_out,"elim1=%.3fsec,",eg_f4_1.exectime+eg_f4_1.gctime); |
fflush(asir_out); |
fflush(asir_out); |
} |
} |
/* free index arrays */ |
/* free index arrays */ |
Line 7577 NODE nd_f4_red_lf_main(int m,ND_pairs sp0,int nsp,int |
|
Line 7583 NODE nd_f4_red_lf_main(int m,ND_pairs sp0,int nsp,int |
|
get_eg(&eg2); init_eg(&eg_f4_2); add_eg(&eg_f4_2,&eg1,&eg2); |
get_eg(&eg2); init_eg(&eg_f4_2); add_eg(&eg_f4_2,&eg1,&eg2); |
init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg2); |
init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg2); |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"elim2=%fsec\n",eg_f4_2.exectime+eg_f4_2.gctime); |
fprintf(asir_out,"elim2=%.3fsec,",eg_f4_2.exectime+eg_f4_2.gctime); |
fprintf(asir_out,"nsp=%d,nred=%d,spmat=(%d,%d),rank=%d ", |
fprintf(asir_out,"nsp=%d,nred=%d,spmat=(%d,%d),rank=%d ", |
nsp,nred,sprow,spcol,rank); |
nsp,nred,sprow,spcol,rank); |
fprintf(asir_out,"%fsec\n",eg_f4.exectime+eg_f4.gctime); |
fprintf(asir_out,"%.3fsec,",eg_f4.exectime+eg_f4.gctime); |
} |
} |
return r0; |
return r0; |
} |
} |
Line 7625 NODE nd_f4_red_q_main(ND_pairs sp0,int nsp,int trace,U |
|
Line 7631 NODE nd_f4_red_q_main(ND_pairs sp0,int nsp,int trace,U |
|
} |
} |
get_eg(&eg1); init_eg(&eg_f4_1); add_eg(&eg_f4_1,&eg0,&eg1); |
get_eg(&eg1); init_eg(&eg_f4_1); add_eg(&eg_f4_1,&eg0,&eg1); |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"elim1=%fsec,",eg_f4_1.exectime+eg_f4_1.gctime); |
fprintf(asir_out,"elim1=%.3fsec,",eg_f4_1.exectime+eg_f4_1.gctime); |
fflush(asir_out); |
fflush(asir_out); |
} |
} |
/* free index arrays */ |
/* free index arrays */ |
Line 7659 NODE nd_f4_red_q_main(ND_pairs sp0,int nsp,int trace,U |
|
Line 7665 NODE nd_f4_red_q_main(ND_pairs sp0,int nsp,int trace,U |
|
get_eg(&eg2); init_eg(&eg_f4_2); add_eg(&eg_f4_2,&eg1,&eg2); |
get_eg(&eg2); init_eg(&eg_f4_2); add_eg(&eg_f4_2,&eg1,&eg2); |
init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg2); |
init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg2); |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"elim2=%fsec\n",eg_f4_2.exectime+eg_f4_2.gctime); |
fprintf(asir_out,"elim2=%.3fsec,",eg_f4_2.exectime+eg_f4_2.gctime); |
fprintf(asir_out,"nsp=%d,nred=%d,spmat=(%d,%d),rank=%d ", |
fprintf(asir_out,"nsp=%d,nred=%d,spmat=(%d,%d),rank=%d ", |
nsp,nred,sprow,spcol,rank); |
nsp,nred,sprow,spcol,rank); |
fprintf(asir_out,"%fsec\n",eg_f4.exectime+eg_f4.gctime); |
fprintf(asir_out,"%.3fsec,",eg_f4.exectime+eg_f4.gctime); |
} |
} |
return r0; |
return r0; |
} |
} |
Line 7707 NODE nd_f4_red_gz_main(ND_pairs sp0,int nsp,int trace, |
|
Line 7713 NODE nd_f4_red_gz_main(ND_pairs sp0,int nsp,int trace, |
|
} |
} |
get_eg(&eg1); init_eg(&eg_f4_1); add_eg(&eg_f4_1,&eg0,&eg1); |
get_eg(&eg1); init_eg(&eg_f4_1); add_eg(&eg_f4_1,&eg0,&eg1); |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"elim1=%fsec,",eg_f4_1.exectime+eg_f4_1.gctime); |
fprintf(asir_out,"elim1=%.3fsec,",eg_f4_1.exectime+eg_f4_1.gctime); |
fflush(asir_out); |
fflush(asir_out); |
} |
} |
/* free index arrays */ |
/* free index arrays */ |
Line 7744 NODE nd_f4_red_gz_main(ND_pairs sp0,int nsp,int trace, |
|
Line 7750 NODE nd_f4_red_gz_main(ND_pairs sp0,int nsp,int trace, |
|
get_eg(&eg2); init_eg(&eg_f4_2); add_eg(&eg_f4_2,&eg1,&eg2); |
get_eg(&eg2); init_eg(&eg_f4_2); add_eg(&eg_f4_2,&eg1,&eg2); |
init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg2); |
init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg2); |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"elim2=%fsec\n",eg_f4_2.exectime+eg_f4_2.gctime); |
fprintf(asir_out,"elim2=%.3fsec,",eg_f4_2.exectime+eg_f4_2.gctime); |
fprintf(asir_out,"nsp=%d,nred=%d,spmat=(%d,%d),rank=%d ", |
fprintf(asir_out,"nsp=%d,nred=%d,spmat=(%d,%d),rank=%d ", |
nsp,nred,sprow,spcol,rank); |
nsp,nred,sprow,spcol,rank); |
fprintf(asir_out,"%fsec\n",eg_f4.exectime+eg_f4.gctime); |
fprintf(asir_out,"%.3fsec,",eg_f4.exectime+eg_f4.gctime); |
} |
} |
return r0; |
return r0; |
} |
} |
Line 7997 int nd_gauss_elim_mod(int **mat0,int *sugar,ND_pairs * |
|
Line 8003 int nd_gauss_elim_mod(int **mat0,int *sugar,ND_pairs * |
|
return rank; |
return rank; |
} |
} |
|
|
#if defined(__GNUC__) |
#if defined(__GNUC__) && SIZEOF_LONG==8 |
|
|
int nd_gauss_elim_mod64(U64 **mat,int *sugar,ND_pairs *spactive,int row,int col,int md,int *colstat) |
int nd_gauss_elim_mod64(U64 **mat,int *sugar,ND_pairs *spactive,int row,int col,int md,int *colstat) |
{ |
{ |
Line 8365 void nd_det(int mod,MAT f,P *rp) |
|
Line 8371 void nd_det(int mod,MAT f,P *rp) |
|
chsgnq(ONE,&mone); |
chsgnq(ONE,&mone); |
for ( j = 0, sgn = 1; j < n; j++ ) { |
for ( j = 0, sgn = 1; j < n; j++ ) { |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(stderr,".",j); |
fprintf(asir_out,".",j); |
} |
} |
for ( i = j; i < n && !dm[i][j]; i++ ); |
for ( i = j; i < n && !dm[i][j]; i++ ); |
if ( i == n ) { |
if ( i == n ) { |
Line 8395 void nd_det(int mod,MAT f,P *rp) |
|
Line 8401 void nd_det(int mod,MAT f,P *rp) |
|
nd_det_reconstruct(dm,n,j,d); |
nd_det_reconstruct(dm,n,j,d); |
|
|
for ( i = j+1, mj = dm[j], mjj = mj[j]; i < n; i++ ) { |
for ( i = j+1, mj = dm[j], mjj = mj[j]; i < n; i++ ) { |
/* if ( DP_Print ) fprintf(stderr," i=%d\n ",i); */ |
/* if ( DP_Print ) fprintf(asir_out," i=%d\n ",i); */ |
mi = dm[i]; mij = mi[j]; |
mi = dm[i]; mij = mi[j]; |
if ( mod ) |
if ( mod ) |
ndv_mul_c(mod,mij,mod-1); |
ndv_mul_c(mod,mij,mod-1); |
else |
else |
ndv_mul_c_q(mij,mone); |
ndv_mul_c_q(mij,mone); |
for ( k = j+1; k < n; k++ ) { |
for ( k = j+1; k < n; k++ ) { |
/* if ( DP_Print ) fprintf(stderr,"k=%d ",k); */ |
/* if ( DP_Print ) fprintf(asir_out,"k=%d ",k); */ |
bucket = create_pbucket(); |
bucket = create_pbucket(); |
if ( mi[k] ) { |
if ( mi[k] ) { |
nmv = BDY(mjj); len = LEN(mjj); |
nmv = BDY(mjj); len = LEN(mjj); |
Line 8421 void nd_det(int mod,MAT f,P *rp) |
|
Line 8427 void nd_det(int mod,MAT f,P *rp) |
|
u = nd_quo(mod,bucket,d); |
u = nd_quo(mod,bucket,d); |
mi[k] = ndtondv(mod,u); |
mi[k] = ndtondv(mod,u); |
} |
} |
/* if ( DP_Print ) fprintf(stderr,"\n",k); */ |
/* if ( DP_Print ) fprintf(asir_out,"\n",k); */ |
} |
} |
d = mjj; |
d = mjj; |
} |
} |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(stderr,"\n",k); |
fprintf(asir_out,"\n",k); |
} |
} |
if ( sgn < 0 ) |
if ( sgn < 0 ) |
if ( mod ) |
if ( mod ) |
Line 9225 void nd_f4_lf_trace(LIST f,LIST v,int trace,int homo,s |
|
Line 9231 void nd_f4_lf_trace(LIST f,LIST v,int trace,int homo,s |
|
} |
} |
get_eg(&eg1); init_eg(&eg_check); add_eg(&eg_check,&eg0,&eg1); |
get_eg(&eg1); init_eg(&eg_check); add_eg(&eg_check,&eg0,&eg1); |
if ( DP_Print ) |
if ( DP_Print ) |
fprintf(asir_out,"check=%fsec\n",eg_check.exectime+eg_check.gctime); |
fprintf(asir_out,"check=%.3fsec\n",eg_check.exectime+eg_check.gctime); |
/* dp->p */ |
/* dp->p */ |
nd_bpe = cbpe; |
nd_bpe = cbpe; |
nd_setup_parameters(nd_nvar,0); |
nd_setup_parameters(nd_nvar,0); |
Line 9285 NODE nd_f4_lf_trace_main(int m,int **indp) |
|
Line 9291 NODE nd_f4_lf_trace_main(int m,int **indp) |
|
} |
} |
get_eg(&eg1); init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg1); |
get_eg(&eg1); init_eg(&eg_f4); add_eg(&eg_f4,&eg0,&eg1); |
if ( DP_Print ) |
if ( DP_Print ) |
fprintf(asir_out,"sugar=%d,symb=%fsec,", |
fprintf(asir_out,"sugar=%d,symb=%.3fsec,", |
sugar,eg_f4.exectime+eg_f4.gctime); |
sugar,eg_f4.exectime+eg_f4.gctime); |
nflist = nd_f4_red(m,l,0,s0vect,col,rp0,&l0); |
nflist = nd_f4_red(m,l,0,s0vect,col,rp0,&l0); |
if ( !l0 ) continue; |
if ( !l0 ) continue; |