version 1.135, 2006/06/06 09:00:38 |
version 1.139, 2006/06/12 00:46:48 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.134 2006/06/06 07:14:16 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.138 2006/06/11 11:41:15 noro Exp $ */ |
|
|
#include "nd.h" |
#include "nd.h" |
|
|
Line 2208 void ndv_setup(int mod,int trace,NODE f,int dont_sort) |
|
Line 2208 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 4834 NODE nd_f4_red_q_main(ND_pairs sp0,int nsp,int trace,U |
|
Line 4840 NODE nd_f4_red_q_main(ND_pairs sp0,int nsp,int trace,U |
|
struct oEGT eg0,eg1,eg2,eg_f4,eg_f4_1,eg_f4_2; |
struct oEGT eg0,eg1,eg2,eg_f4,eg_f4_1,eg_f4_2; |
int maxrs; |
int maxrs; |
int *spsugar; |
int *spsugar; |
|
pointer *w; |
|
|
spcol = col-nred; |
spcol = col-nred; |
get_eg(&eg0); |
get_eg(&eg0); |
Line 4867 NODE nd_f4_red_q_main(ND_pairs sp0,int nsp,int trace,U |
|
Line 4874 NODE nd_f4_red_q_main(ND_pairs sp0,int nsp,int trace,U |
|
/* elimination (2nd step) */ |
/* elimination (2nd step) */ |
colstat = (int *)ALLOCA(spcol*sizeof(int)); |
colstat = (int *)ALLOCA(spcol*sizeof(int)); |
rank = nd_gauss_elim_q(spmat,spsugar,sprow,spcol,colstat); |
rank = nd_gauss_elim_q(spmat,spsugar,sprow,spcol,colstat); |
r0 = 0; |
w = (pointer *)ALLOCA(rank*sizeof(pointer)); |
for ( i = 0; i < rank; i++ ) { |
for ( i = 0; i < rank; i++ ) { |
NEXTNODE(r0,r); BDY(r) = |
w[rank-i-1] = (pointer)vect_to_ndv_q(spmat[i],spcol,col,rhead,s0vect); |
(pointer)vect_to_ndv_q(spmat[i],spcol,col,rhead,s0vect); |
SG((NDV)w[rank-i-1]) = spsugar[i]; |
SG((NDV)BDY(r)) = spsugar[i]; |
|
/* GC_free(spmat[i]); */ |
/* GC_free(spmat[i]); */ |
} |
} |
|
#if 0 |
|
qsort(w,rank,sizeof(NDV), |
|
(int (*)(const void *,const void *))ndv_compare); |
|
#endif |
|
r0 = 0; |
|
for ( i = 0; i < rank; i++ ) { |
|
NEXTNODE(r0,r); BDY(r) = w[i]; |
|
} |
if ( r0 ) NEXT(r) = 0; |
if ( r0 ) NEXT(r) = 0; |
|
|
/* for ( ; i < sprow; i++ ) GC_free(spmat[i]); */ |
/* for ( ; i < sprow; i++ ) GC_free(spmat[i]); */ |
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); |