version 1.84, 2003/10/18 01:39:42 |
version 1.86, 2003/10/28 08:47:01 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.83 2003/10/17 05:15:20 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/engine/nd.c,v 1.85 2003/10/28 03:23:40 noro Exp $ */ |
|
|
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
Line 1768 NODE nd_gb(int m,int ishomo,int checkonly) |
|
Line 1768 NODE nd_gb(int m,int ishomo,int checkonly) |
|
ND_pairs l; |
ND_pairs l; |
ND h,nf,s,head; |
ND h,nf,s,head; |
NDV nfv; |
NDV nfv; |
Q q; |
Q q,num,den; |
union oNDC dn; |
union oNDC dn; |
|
|
g = 0; d = 0; |
g = 0; d = 0; |
|
|
l = nd_minp(d,&d); |
l = nd_minp(d,&d); |
if ( SG(l) != sugar ) { |
if ( SG(l) != sugar ) { |
if ( ishomo ) { |
if ( ishomo ) { |
for ( i = nd_psn-1; SG(nd_psh[i]) == sugar; i-- ) { |
for ( i = nd_psn-1; i >= 0 && SG(nd_psh[i]) == sugar; i-- ) { |
if ( nd_demand ) |
if ( nd_demand ) |
nfv = ndv_load(i); |
nfv = ndv_load(i); |
else |
else |
|
|
s = ndvtond(m,nfv); |
s = ndvtond(m,nfv); |
s = nd_separate_head(s,&head); |
s = nd_separate_head(s,&head); |
nd_nf(m,s,nd_ps,1,&dn,&nf); |
nd_nf(m,s,nd_ps,1,&dn,&nf); |
if ( !m ) { mulq(HCQ(head),dn.z,&q); HCQ(head) = q; } |
if ( !m ) { |
|
NTOQ(NM(dn.z),SGN(dn.z),num); |
|
mulq(HCQ(head),num,&q); HCQ(head) = q; |
|
if ( DN(dn.z) ) { |
|
NTOQ(DN(dn.z),1,den); |
|
nd_mul_c_q(nf,den); |
|
} |
|
} |
nf = nd_add(m,head,nf); |
nf = nd_add(m,head,nf); |
ndv_free(nfv); |
ndv_free(nfv); |
nd_removecont(m,nf); |
nd_removecont(m,nf); |
Line 1853 NODE nd_gb_trace(int m,int ishomo) |
|
Line 1860 NODE nd_gb_trace(int m,int ishomo) |
|
ND_pairs l; |
ND_pairs l; |
ND h,nf,nfq,s,head; |
ND h,nf,nfq,s,head; |
NDV nfv,nfqv; |
NDV nfv,nfqv; |
Q q; |
Q q,den,num; |
union oNDC dn; |
union oNDC dn; |
|
|
g = 0; d = 0; |
g = 0; d = 0; |
|
|
l = nd_minp(d,&d); |
l = nd_minp(d,&d); |
if ( SG(l) != sugar ) { |
if ( SG(l) != sugar ) { |
if ( ishomo ) { |
if ( ishomo ) { |
for ( i = nd_psn-1; SG(nd_psh[i]) == sugar; i-- ) { |
for ( i = nd_psn-1; i >= 0 && SG(nd_psh[i]) == sugar; i-- ) { |
/* for nd_ps */ |
/* for nd_ps */ |
s = ndvtond(m,nd_ps[i]); |
s = ndvtond(m,nd_ps[i]); |
s = nd_separate_head(s,&head); |
s = nd_separate_head(s,&head); |
|
|
s = ndvtond(0,nfv); |
s = ndvtond(0,nfv); |
s = nd_separate_head(s,&head); |
s = nd_separate_head(s,&head); |
nd_nf(0,s,nd_ps_trace,1,&dn,&nf); |
nd_nf(0,s,nd_ps_trace,1,&dn,&nf); |
mulq(HCQ(head),dn.z,&q); HCQ(head) = q; |
NTOQ(NM(dn.z),SGN(dn.z),num); |
|
mulq(HCQ(head),num,&q); HCQ(head) = q; |
|
if ( DN(dn.z) ) { |
|
NTOQ(DN(dn.z),1,den); |
|
nd_mul_c_q(nf,den); |
|
} |
nf = nd_add(0,head,nf); |
nf = nd_add(0,head,nf); |
ndv_free(nfv); |
ndv_free(nfv); |
nd_removecont(0,nf); |
nd_removecont(0,nf); |
Line 1974 NODE ndv_reduceall(int m,NODE f) |
|
Line 1986 NODE ndv_reduceall(int m,NODE f) |
|
NODE t,a0,a; |
NODE t,a0,a; |
union oNDC dn; |
union oNDC dn; |
NDV *w; |
NDV *w; |
Q q; |
Q q,num,den; |
|
|
n = length(f); |
n = length(f); |
#if 0 |
#if 0 |
Line 1993 NODE ndv_reduceall(int m,NODE f) |
|
Line 2005 NODE ndv_reduceall(int m,NODE f) |
|
nd_reconstruct(m,0,0); |
nd_reconstruct(m,0,0); |
else { |
else { |
if ( DP_Print ) { printf("."); fflush(stdout); } |
if ( DP_Print ) { printf("."); fflush(stdout); } |
if ( !m ) { mulq(HCQ(head),dn.z,&q); HCQ(head) = q; } |
if ( !m ) { |
|
NTOQ(NM(dn.z),SGN(dn.z),num); |
|
mulq(HCQ(head),num,&q); HCQ(head) = q; |
|
if ( DN(dn.z) ) { |
|
NTOQ(DN(dn.z),1,den); |
|
nd_mul_c_q(nf,den); |
|
} |
|
} |
nf = nd_add(m,head,nf); |
nf = nd_add(m,head,nf); |
ndv_free(nd_ps[i]); |
ndv_free(nd_ps[i]); |
nd_removecont(m,nf); |
nd_removecont(m,nf); |
Line 4164 NODE nd_f4(int m) |
|
Line 4183 NODE nd_f4(int m) |
|
d = nd_reconstruct(m,0,d); |
d = nd_reconstruct(m,0,d); |
continue; |
continue; |
} |
} |
|
if ( bucket->m < 0 ) continue; |
col = nd_symbolic_preproc(bucket,&s0vect,&rp0); |
col = nd_symbolic_preproc(bucket,&s0vect,&rp0); |
if ( !col ) { |
if ( !col ) { |
for ( t = l; NEXT(t); t = NEXT(t) ); |
for ( t = l; NEXT(t); t = NEXT(t) ); |