version 1.45, 2007/09/16 09:08:25 |
version 1.47, 2007/10/14 02:32:21 |
|
|
* 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/builtin/dp-supp.c,v 1.44 2007/09/15 10:17:08 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/dp-supp.c,v 1.46 2007/09/19 05:42:59 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "base.h" |
#include "base.h" |
Line 71 void print_composite_order_spec(struct order_spec *spe |
|
Line 71 void print_composite_order_spec(struct order_spec *spe |
|
* |
* |
*/ |
*/ |
|
|
|
static NODE RatDenomList; |
|
|
|
void init_denomlist() |
|
{ |
|
RatDenomList = 0; |
|
} |
|
|
|
void add_denomlist(P f) |
|
{ |
|
NODE n; |
|
|
|
if ( OID(f)==O_P ) { |
|
MKNODE(n,f,RatDenomList); RatDenomList = n; |
|
} |
|
} |
|
|
|
LIST get_denomlist() |
|
{ |
|
LIST l; |
|
|
|
MKLIST(l,RatDenomList); RatDenomList = 0; |
|
return l; |
|
} |
|
|
void dp_ptozp(DP p,DP *rp) |
void dp_ptozp(DP p,DP *rp) |
{ |
{ |
MP m,mr,mr0; |
MP m,mr,mr0; |
Line 448 void dp_prim(DP p,DP *rp) |
|
Line 472 void dp_prim(DP p,DP *rp) |
|
P *w; |
P *w; |
Q *c; |
Q *c; |
Q dvr; |
Q dvr; |
|
NODE tn; |
|
|
if ( !p ) |
if ( !p ) |
*rp = 0; |
*rp = 0; |
Line 502 void dp_prim(DP p,DP *rp) |
|
Line 527 void dp_prim(DP p,DP *rp) |
|
NEXTMP(mr0,mr); divsp(CO,m->c,g,&mr->c); mr->dl = m->dl; |
NEXTMP(mr0,mr); divsp(CO,m->c,g,&mr->c); mr->dl = m->dl; |
} |
} |
NEXT(mr) = 0; MKDP(p->nv,mr0,*rp); (*rp)->sugar = p->sugar; |
NEXT(mr) = 0; MKDP(p->nv,mr0,*rp); (*rp)->sugar = p->sugar; |
|
add_denomlist(g); |
} |
} |
} |
} |
} |
} |
Line 805 void dp_red(DP p0,DP p1,DP p2,DP *head,DP *rest,P *dnp |
|
Line 831 void dp_red(DP p0,DP p1,DP p2,DP *head,DP *rest,P *dnp |
|
} else { |
} else { |
ezgcdpz(CO,(P)c1,(P)c2,&g); |
ezgcdpz(CO,(P)c1,(P)c2,&g); |
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; |
|
add_denomlist(g); |
} |
} |
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; |
*multp = s; |
*multp = s; |
Line 853 void dp_red_marked(DP p0,DP p1,DP p2,DP hp2,DP *head,D |
|
Line 880 void dp_red_marked(DP p0,DP p1,DP p2,DP hp2,DP *head,D |
|
ezgcdpz(CO,(P)c1,(P)c2,&g); |
ezgcdpz(CO,(P)c1,(P)c2,&g); |
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; m->c = (P)c1; NEXT(m) = 0; MKDP(n,m,s); s->sugar = d->td; |
*multp = s; |
*multp = s; |
muld(CO,s,p2,&t); muldc(CO,p1,(P)c2,&s); addd(CO,s,t,&r); |
muld(CO,s,p2,&t); muldc(CO,p1,(P)c2,&s); subd(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; |
} |
} |
Line 1202 void dp_true_nf_marked_mod(NODE b,DP g,DP *ps,DP *hps, |
|
Line 1229 void dp_true_nf_marked_mod(NODE b,DP g,DP *ps,DP *hps, |
|
if ( d ) |
if ( d ) |
d->sugar = sugar; |
d->sugar = sugar; |
*rp = d; *dnp = dn; |
*rp = d; *dnp = dn; |
|
} |
|
|
|
/* true nf by a marked GB and collect quotients */ |
|
|
|
DP *dp_true_nf_and_quotient_marked (NODE b,DP g,DP *ps,DP *hps,DP *rp,P *dnp) |
|
{ |
|
DP u,p,d,s,t,dmy,hp,mult; |
|
DP *q; |
|
NODE l; |
|
MP m,mr; |
|
int i,n,j; |
|
int *wb; |
|
int sugar,psugar,multiple; |
|
P nm,tnm1,dn,tdn,tdn1; |
|
Q cont; |
|
|
|
dn = (P)ONE; |
|
if ( !g ) { |
|
*rp = 0; *dnp = dn; return; |
|
} |
|
for ( n = 0, l = b; l; l = NEXT(l), n++ ); |
|
wb = (int *)ALLOCA(n*sizeof(int)); |
|
for ( i = 0, l = b; i < n; l = NEXT(l), i++ ) |
|
wb[i] = QTOS((Q)BDY(l)); |
|
q = (DP *)MALLOC(n*sizeof(DP)); |
|
for ( i = 0; i < n; i++ ) q[i] = 0; |
|
sugar = g->sugar; |
|
for ( d = 0; g; ) { |
|
for ( u = 0, i = 0; i < n; i++ ) { |
|
if ( dp_redble(g,hp = hps[wb[i]]) ) { |
|
p = ps[wb[i]]; |
|
dp_red_marked(d,g,p,hp,&t,&u,&tdn,&mult); |
|
psugar = (BDY(g)->dl->td - BDY(p)->dl->td) + p->sugar; |
|
sugar = MAX(sugar,psugar); |
|
for ( j = 0; j < n; j++ ) { |
|
muldc(CO,q[j],(P)tdn,&dmy); q[j] = dmy; |
|
} |
|
addd(CO,q[wb[i]],mult,&dmy); q[wb[i]] = dmy; |
|
mulp(CO,dn,tdn,&tdn1); dn = tdn1; |
|
d = t; |
|
if ( !u ) goto last; |
|
break; |
|
} |
|
} |
|
if ( u ) { |
|
g = u; |
|
} else { |
|
m = BDY(g); NEWMP(mr); mr->dl = m->dl; mr->c = m->c; |
|
NEXT(mr) = 0; MKDP(g->nv,mr,t); t->sugar = mr->dl->td; |
|
addd(CO,d,t,&s); d = s; |
|
dp_rest(g,&t); g = t; |
|
} |
|
} |
|
last: |
|
if ( d ) d->sugar = sugar; |
|
*rp = d; *dnp = dn; |
|
return q; |
} |
} |
|
|
/* nf computation over Z */ |
/* nf computation over Z */ |