version 1.133, 2006/06/05 08:11:10 |
version 1.136, 2006/06/11 06:01:55 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.132 2006/06/05 01:29:24 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.135 2006/06/06 09:00:38 noro Exp $ */ |
|
|
#include "nd.h" |
#include "nd.h" |
|
|
Line 2083 ND_pairs equivalent_pairs( ND_pairs d1, ND_pairs *pres |
|
Line 2083 ND_pairs equivalent_pairs( ND_pairs d1, ND_pairs *pres |
|
NODE update_base(NODE nd,int ndp) |
NODE update_base(NODE nd,int ndp) |
{ |
{ |
UINT *dl, *dln; |
UINT *dl, *dln; |
NODE last, p, head; |
NODE last, p, head, cur, prev; |
|
|
dl = DL(nd_psh[ndp]); |
dl = DL(nd_psh[ndp]); |
for ( head = last = 0, p = nd; p; ) { |
for ( head = last = 0, p = nd; p; ) { |
Line 2096 NODE update_base(NODE nd,int ndp) |
|
Line 2096 NODE update_base(NODE nd,int ndp) |
|
p = NEXT(last = p); |
p = NEXT(last = p); |
} |
} |
} |
} |
|
#if 1 |
head = append_one(head,ndp); |
head = append_one(head,ndp); |
|
#else |
|
for ( prev = 0, cur = head; cur; prev = cur, cur = NEXT(cur) ) |
|
if ( ndv_compare(&(nd_ps[ndp]),&(nd_ps[(int)BDY(cur)]))<0 ) break; |
|
MKNODE(p,(pointer)ndp,cur); |
|
if ( !prev ) |
|
head = p; |
|
else |
|
NEXT(prev) = p; |
|
#endif |
return head; |
return head; |
} |
} |
|
|
Line 4168 IndArray nm_ind_pair_to_vect_compress(int mod,UINT *s0 |
|
Line 4178 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 4208 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; |
hmag = p_mag((P)svect[0])*nd_scale; |
for ( i = 0; i < col && !svect[i]; i++ ); |
|
if ( i == col ) return maxrs; |
|
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 4224 int ndv_reduce_vect_q(Q *svect,int trace,int col,IndAr |
|
Line 4253 int ndv_reduce_vect_q(Q *svect,int trace,int col,IndAr |
|
} |
} |
break; |
break; |
} |
} |
|
for ( j = k+1; j < col && !svect[j]; j++ ); |
|
if ( j == col ) break; |
|
if ( hmag && ((double)p_mag((P)svect[j]) > hmag) ) { |
|
nz = compress_array(svect,cvect,col); |
|
removecont_array(cvect,nz); |
|
expand_array(svect,cvect,nz); |
|
hmag = ((double)p_mag((P)svect[j]))*nd_scale; |
|
} |
} |
} |
if ( hmag && ((double)p_mag((P)svect[0]) > hmag) ) |
|
igcdv(&v,&t); |
|
} |
} |
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 4847 NODE nd_f4_red_q_main(ND_pairs sp0,int nsp,int trace,U |
|
Line 4884 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); |