version 1.1, 1999/12/03 07:39:07 |
version 1.3, 2000/05/29 08:54:45 |
|
|
/* $OpenXM: OpenXM/src/asir99/builtin/dp.c,v 1.1.1.1 1999/11/10 08:12:25 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/builtin/dp.c,v 1.2 2000/04/13 06:01:01 noro Exp $ */ |
#include "ca.h" |
#include "ca.h" |
#include "base.h" |
#include "base.h" |
#include "parse.h" |
#include "parse.h" |
|
|
NEWDL(d,n); d->td = d1->td - d2->td; |
NEWDL(d,n); d->td = d1->td - d2->td; |
for ( i = 0; i < n; i++ ) |
for ( i = 0; i < n; i++ ) |
d->d[i] = d1->d[i]-d2->d[i]; |
d->d[i] = d1->d[i]-d2->d[i]; |
NEWMP(m); m->dl = d; m->c = (P)ONE; NEXT(m) = 0; MKDP(n,m,s); s->sugar = d->td; |
NEWMP(m); m->dl = d; m->c = (P)ONE; NEXT(m) = 0; |
|
MKDP(n,m,s); s->sugar = d->td; |
*rp = s; |
*rp = s; |
} |
} |
|
|
|
void dltod(d,n,rp) |
|
DL d; |
|
int n; |
|
DP *rp; |
|
{ |
|
MP m; |
|
DP s; |
|
|
|
NEWMP(m); m->dl = d; m->c = (P)ONE; NEXT(m) = 0; |
|
MKDP(n,m,s); s->sugar = d->td; |
|
*rp = s; |
|
} |
|
|
void Pdp_red(arg,rp) |
void Pdp_red(arg,rp) |
NODE arg; |
NODE arg; |
LIST *rp; |
LIST *rp; |
|
|
divsp(CO,(P)c1,g,&a); c1 = (Q)a; divsp(CO,(P)c2,g,&a); c2 = (Q)a; |
divsp(CO,(P)c1,g,&a); c1 = (Q)a; divsp(CO,(P)c2,g,&a); c2 = (Q)a; |
} |
} |
NEWMP(m); m->dl = d; chsgnp((P)c1,&m->c); NEXT(m) = 0; MKDP(n,m,s); s->sugar = d->td; |
NEWMP(m); m->dl = d; chsgnp((P)c1,&m->c); NEXT(m) = 0; MKDP(n,m,s); s->sugar = d->td; |
muld(CO,p2,s,&t); muldc(CO,p1,(P)c2,&s); addd(CO,s,t,&r); |
muld(CO,s,p2,&t); muldc(CO,p1,(P)c2,&s); addd(CO,s,t,&r); |
muldc(CO,p0,(P)c2,&h); |
muldc(CO,p0,(P)c2,&h); |
*head = h; *rest = r; *dnp = (P)c2; |
*head = h; *rest = r; *dnp = (P)c2; |
} |
} |
|
|
NEWDL(d,n); d->td = td - d1->td; |
NEWDL(d,n); d->td = td - d1->td; |
for ( i = 0; i < n; i++ ) |
for ( i = 0; i < n; i++ ) |
d->d[i] = w[i] - d1->d[i]; |
d->d[i] = w[i] - d1->d[i]; |
#if 0 |
|
NEWMP(m); m->dl = d; divsp(CO,ONE,BDY(p1)->c,&m->c); NEXT(m) = 0; |
|
MKDP(n,m,s); muld(CO,p1,s,&t); |
|
|
|
NEWDL(d,n); d->td = td - d2->td; |
|
for ( i = 0; i < n; i++ ) |
|
d->d[i] = w[i] - d2->d[i]; |
|
NEWMP(m); m->dl = d; divsp(CO,ONE,BDY(p2)->c,&m->c); NEXT(m) = 0; |
|
MKDP(n,m,s); muld(CO,p2,s,&u); |
|
#endif |
|
c1 = (Q)BDY(p1)->c; c2 = (Q)BDY(p2)->c; |
c1 = (Q)BDY(p1)->c; c2 = (Q)BDY(p2)->c; |
if ( INT(c1) && INT(c2) ) { |
if ( INT(c1) && INT(c2) ) { |
gcdn(NM(c1),NM(c2),&gn); |
gcdn(NM(c1),NM(c2),&gn); |
|
|
} |
} |
|
|
NEWMP(m); m->dl = d; m->c = (P)c2; NEXT(m) = 0; |
NEWMP(m); m->dl = d; m->c = (P)c2; NEXT(m) = 0; |
MKDP(n,m,s); s->sugar = d->td; muld(CO,p1,s,&t); |
MKDP(n,m,s); s->sugar = d->td; muld(CO,s,p1,&t); |
|
|
NEWDL(d,n); d->td = td - d2->td; |
NEWDL(d,n); d->td = td - d2->td; |
for ( i = 0; i < n; i++ ) |
for ( i = 0; i < n; i++ ) |
d->d[i] = w[i] - d2->d[i]; |
d->d[i] = w[i] - d2->d[i]; |
NEWMP(m); m->dl = d; m->c = (P)c1; NEXT(m) = 0; |
NEWMP(m); m->dl = d; m->c = (P)c1; NEXT(m) = 0; |
MKDP(n,m,s); s->sugar = d->td; muld(CO,p2,s,&u); |
MKDP(n,m,s); s->sugar = d->td; muld(CO,s,p2,&u); |
|
|
subd(CO,t,u,rp); |
subd(CO,t,u,rp); |
} |
} |