version 1.134, 2006/06/06 07:14:16 |
version 1.135, 2006/06/06 09:00:38 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.133 2006/06/05 08:11:10 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.134 2006/06/06 07:14:16 noro Exp $ */ |
|
|
#include "nd.h" |
#include "nd.h" |
|
|
Line 4168 IndArray nm_ind_pair_to_vect_compress(int mod,UINT *s0 |
|
Line 4168 IndArray nm_ind_pair_to_vect_compress(int mod,UINT *s0 |
|
return r; |
return r; |
} |
} |
|
|
|
int compress_array(Q *svect,Q *cvect,int n) |
|
{ |
|
int i,j; |
|
|
|
for ( i = j = 0; i < n; i++ ) |
|
if ( svect[i] ) cvect[j++] = svect[i]; |
|
return j; |
|
} |
|
|
|
void expand_array(Q *svect,Q *cvect,int n) |
|
{ |
|
int i,j; |
|
|
|
for ( i = j = 0; j < n; i++ ) |
|
if ( svect[i] ) svect[i] = cvect[j++]; |
|
} |
|
|
int ndv_reduce_vect_q(Q *svect,int trace,int col,IndArray *imat,NM_ind_pair *rp0,int nred) |
int ndv_reduce_vect_q(Q *svect,int trace,int col,IndArray *imat,NM_ind_pair *rp0,int nred) |
{ |
{ |
int i,j,k,len,pos,prev; |
int i,j,k,len,pos,prev,nz; |
Q cs,mcs,c1,c2,cr,gcd,t; |
Q cs,mcs,c1,c2,cr,gcd,t; |
IndArray ivect; |
IndArray ivect; |
unsigned char *ivc; |
unsigned char *ivc; |
Line 4181 int ndv_reduce_vect_q(Q *svect,int trace,int col,IndAr |
|
Line 4198 int ndv_reduce_vect_q(Q *svect,int trace,int col,IndAr |
|
NODE rp; |
NODE rp; |
int maxrs; |
int maxrs; |
double hmag; |
double hmag; |
struct oVECT v; |
Q *cvect; |
|
|
v.id = O_VECT; v.len = col; v.body = (pointer *)svect; |
|
maxrs = 0; |
maxrs = 0; |
for ( i = 0; i < col && !svect[i]; i++ ); |
for ( i = 0; i < col && !svect[i]; i++ ); |
if ( i == col ) return maxrs; |
if ( i == col ) return maxrs; |
hmag = p_mag((P)svect[i])*nd_scale; |
hmag = p_mag((P)svect[i])*nd_scale; |
|
cvect = (Q *)ALLOCA(col*sizeof(Q)); |
for ( i = 0; i < nred; i++ ) { |
for ( i = 0; i < nred; i++ ) { |
ivect = imat[i]; |
ivect = imat[i]; |
k = ivect->head; |
k = ivect->head; |
Line 4229 int ndv_reduce_vect_q(Q *svect,int trace,int col,IndAr |
|
Line 4246 int ndv_reduce_vect_q(Q *svect,int trace,int col,IndAr |
|
for ( j = k+1; j < col && !svect[j]; j++ ); |
for ( j = k+1; j < col && !svect[j]; j++ ); |
if ( j == col ) break; |
if ( j == col ) break; |
if ( hmag && ((double)p_mag((P)svect[j]) > hmag) ) { |
if ( hmag && ((double)p_mag((P)svect[j]) > hmag) ) { |
igcdv(&v,&t); |
nz = compress_array(svect,cvect,col); |
|
removecont_array(cvect,nz); |
|
expand_array(svect,cvect,nz); |
hmag = ((double)p_mag((P)svect[j]))*nd_scale; |
hmag = ((double)p_mag((P)svect[j]))*nd_scale; |
} |
} |
} |
} |
} |
} |
igcdv(&v,&t); |
nz = compress_array(svect,cvect,col); |
|
removecont_array(cvect,nz); |
|
expand_array(svect,cvect,nz); |
if ( DP_Print ) { |
if ( DP_Print ) { |
fprintf(asir_out,"-"); fflush(asir_out); |
fprintf(asir_out,"-"); fflush(asir_out); |
} |
} |
Line 4853 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 |
|
SG((NDV)BDY(r)) = spsugar[i]; |
SG((NDV)BDY(r)) = spsugar[i]; |
/* GC_free(spmat[i]); */ |
/* GC_free(spmat[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); |