version 1.137, 2006/06/11 06:57:54 |
version 1.141, 2006/06/17 10:12:06 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.136 2006/06/11 06:01:55 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.140 2006/06/12 21:51:33 noro Exp $ */ |
|
|
#include "nd.h" |
#include "nd.h" |
|
|
Line 1592 NODE nd_gb(int m,int ishomo,int checkonly) |
|
Line 1592 NODE nd_gb(int m,int ishomo,int checkonly) |
|
NDV nfv; |
NDV nfv; |
Q q,num,den; |
Q q,num,den; |
union oNDC dn; |
union oNDC dn; |
|
int diag_count = 0; |
|
|
g = 0; d = 0; |
g = 0; d = 0; |
for ( i = 0; i < nd_psn; i++ ) { |
for ( i = 0; i < nd_psn; i++ ) { |
|
|
l = nd_minp(d,&d); |
l = nd_minp(d,&d); |
if ( SG(l) != sugar ) { |
if ( SG(l) != sugar ) { |
if ( ishomo ) { |
if ( ishomo ) { |
|
diag_count = 0; |
stat = do_diagonalize(sugar,m); |
stat = do_diagonalize(sugar,m); |
if ( !stat ) { |
if ( !stat ) { |
NEXT(l) = d; d = l; |
NEXT(l) = d; d = l; |
|
|
} |
} |
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); |
|
if ( !m && (ishomo && ++diag_count == diag_period) ) { |
|
diag_count = 0; |
|
stat = do_diagonalize(sugar,m); |
|
if ( !stat ) { |
|
NEXT(l) = d; d = l; |
|
d = nd_reconstruct(1,d); |
|
goto again; |
|
} |
|
} |
d = update_pairs(d,g,nh); |
d = update_pairs(d,g,nh); |
g = update_base(g,nh); |
g = update_base(g,nh); |
FREENDP(l); |
FREENDP(l); |
Line 2208 void ndv_setup(int mod,int trace,NODE f,int dont_sort) |
|
Line 2219 void ndv_setup(int mod,int trace,NODE f,int dont_sort) |
|
for ( nd_psn = 0, s = f; s; s = NEXT(s) ) if ( BDY(s) ) nd_psn++; |
for ( nd_psn = 0, s = f; s; s = NEXT(s) ) if ( BDY(s) ) nd_psn++; |
w = (NDV *)ALLOCA(nd_psn*sizeof(NDV)); |
w = (NDV *)ALLOCA(nd_psn*sizeof(NDV)); |
for ( i = 0, s = f; s; s = NEXT(s) ) if ( BDY(s) ) w[i++] = BDY(s); |
for ( i = 0, s = f; s; s = NEXT(s) ) if ( BDY(s) ) w[i++] = BDY(s); |
if ( !dont_sort ) |
if ( !dont_sort ) { |
qsort(w,nd_psn,sizeof(NDV), |
/* XXX heuristic */ |
(int (*)(const void *,const void *))ndv_compare); |
if ( !nd_ord->id && (nd_ord->ord.simple<2) ) |
|
qsort(w,nd_psn,sizeof(NDV), |
|
(int (*)(const void *,const void *))ndv_compare_rev); |
|
else |
|
qsort(w,nd_psn,sizeof(NDV), |
|
(int (*)(const void *,const void *))ndv_compare); |
|
} |
nd_pslen = 2*nd_psn; |
nd_pslen = 2*nd_psn; |
nd_ps = (NDV *)MALLOC(nd_pslen*sizeof(NDV)); |
nd_ps = (NDV *)MALLOC(nd_pslen*sizeof(NDV)); |
nd_ps_trace = (NDV *)MALLOC(nd_pslen*sizeof(NDV)); |
nd_ps_trace = (NDV *)MALLOC(nd_pslen*sizeof(NDV)); |
Line 4874 NODE nd_f4_red_q_main(ND_pairs sp0,int nsp,int trace,U |
|
Line 4891 NODE nd_f4_red_q_main(ND_pairs sp0,int nsp,int trace,U |
|
SG((NDV)w[rank-i-1]) = spsugar[i]; |
SG((NDV)w[rank-i-1]) = spsugar[i]; |
/* GC_free(spmat[i]); */ |
/* GC_free(spmat[i]); */ |
} |
} |
#if 1 |
#if 0 |
qsort(w,rank,sizeof(NDV), |
qsort(w,rank,sizeof(NDV), |
(int (*)(const void *,const void *))ndv_compare); |
(int (*)(const void *,const void *))ndv_compare); |
#endif |
#endif |