version 1.21, 2002/01/30 01:09:07 |
version 1.23, 2003/05/28 07:32:32 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/engine/dist.c,v 1.20 2002/01/28 00:54:43 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/engine/dist.c,v 1.22 2003/01/04 09:06:17 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
|
|
Line 75 int dp_nelim,dp_fcoeffs; |
|
Line 75 int dp_nelim,dp_fcoeffs; |
|
struct order_spec dp_current_spec; |
struct order_spec dp_current_spec; |
int *dp_dl_work; |
int *dp_dl_work; |
|
|
int has_fcoef(DP f) |
int has_sfcoef(DP f) |
{ |
{ |
MP t; |
MP t; |
|
|
if ( !f ) |
if ( !f ) |
return 0; |
return 0; |
for ( t = BDY(f); t; t = NEXT(t) ) |
for ( t = BDY(f); t; t = NEXT(t) ) |
if ( has_fcoef_p(t->c) ) |
if ( has_sfcoef_p(t->c) ) |
break; |
break; |
return t ? 1 : 0; |
return t ? 1 : 0; |
} |
} |
|
|
int has_fcoef_p(P f) |
int has_sfcoef_p(P f) |
{ |
{ |
DCP dc; |
DCP dc; |
|
|
if ( !f ) |
if ( !f ) |
return 0; |
return 0; |
else if ( NUM(f) ) |
else if ( NUM(f) ) |
return (NID((Num)f) == N_LM |
return (NID((Num)f) == N_GFS) ? 1 : 0; |
|| NID((Num)f) == N_GF2N |
|
|| NID((Num)f) == N_GFPN |
|
|| NID((Num)f) == N_GFS) ? 1 : 0; |
|
else { |
else { |
for ( dc = DC(f); dc; dc = NEXT(dc) ) |
for ( dc = DC(f); dc; dc = NEXT(dc) ) |
if ( has_fcoef_p(COEF(dc)) ) |
if ( has_sfcoef_p(COEF(dc)) ) |
return 1; |
return 1; |
return 0; |
return 0; |
} |
} |
Line 204 void ptod(VL vl,VL dvl,P p,DP *pr) |
|
Line 201 void ptod(VL vl,VL dvl,P p,DP *pr) |
|
} |
} |
} |
} |
#if 0 |
#if 0 |
if ( !dp_fcoeffs && has_fcoef(*pr) ) |
if ( !dp_fcoeffs && has_sfcoef(*pr) ) |
dp_fcoeffs = 1; |
dp_fcoeffs = N_GFS; |
#endif |
#endif |
} |
} |
|
|
Line 420 NODE symb_merge(NODE m1,NODE m2,int n) |
|
Line 417 NODE symb_merge(NODE m1,NODE m2,int n) |
|
} |
} |
if ( !cur ) |
if ( !cur ) |
NEXT(prev) = m; |
NEXT(prev) = m; |
|
return top; |
|
} |
|
} |
|
|
|
void _adddl(int n,DL d1,DL d2,DL d3) |
|
{ |
|
int i; |
|
|
|
d3->td = d1->td+d2->td; |
|
for ( i = 0; i < n; i++ ) |
|
d3->d[i] = d1->d[i]+d2->d[i]; |
|
} |
|
|
|
/* m1 <- m1 U dl*f, destructive */ |
|
|
|
NODE mul_dllist(DL dl,DP f); |
|
|
|
NODE symb_mul_merge(NODE m1,DL dl,DP f,int n) |
|
{ |
|
NODE top,prev,cur,n1; |
|
DP g; |
|
DL t,s; |
|
MP m; |
|
|
|
if ( !m1 ) |
|
return mul_dllist(dl,f); |
|
else if ( !f ) |
|
return m1; |
|
else { |
|
m = BDY(f); |
|
NEWDL_NOINIT(t,n); |
|
_adddl(n,m->dl,dl,t); |
|
top = m1; prev = 0; cur = m1; |
|
while ( m ) { |
|
switch ( (*cmpdl)(n,(DL)BDY(cur),t) ) { |
|
case 0: |
|
prev = cur; cur = NEXT(cur); |
|
if ( !cur ) { |
|
MKDP(n,m,g); |
|
NEXT(prev) = mul_dllist(dl,g); |
|
return; |
|
} |
|
m = NEXT(m); |
|
if ( m ) _adddl(n,m->dl,dl,t); |
|
break; |
|
case 1: |
|
prev = cur; cur = NEXT(cur); |
|
if ( !cur ) { |
|
MKDP(n,m,g); |
|
NEXT(prev) = mul_dllist(dl,g); |
|
return; |
|
} |
|
break; |
|
case -1: |
|
NEWDL_NOINIT(s,n); |
|
s->td = t->td; |
|
bcopy(t->d,s->d,n*sizeof(int)); |
|
NEWNODE(n1); |
|
n1->body = (pointer)s; |
|
NEXT(n1) = cur; |
|
if ( !prev ) { |
|
top = n1; cur = n1; |
|
} else { |
|
NEXT(prev) = n1; prev = n1; |
|
} |
|
m = NEXT(m); |
|
if ( m ) _adddl(n,m->dl,dl,t); |
|
break; |
|
} |
|
} |
return top; |
return top; |
} |
} |
} |
} |