version 1.9, 2000/12/08 08:26:08 |
version 1.12, 2001/02/21 07:10:17 |
|
|
* 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.8 2000/12/08 06:43:09 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/dp-supp.c,v 1.11 2000/12/13 05:37:29 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "base.h" |
#include "base.h" |
|
|
divsmp(CO,mod,c1,c2,&u); c1 = u; c2 = (P)ONEM; |
divsmp(CO,mod,c1,c2,&u); c1 = u; c2 = (P)ONEM; |
} |
} |
NEWMP(m); m->dl = d; chsgnmp(mod,(P)c1,&m->c); NEXT(m) = 0; |
NEWMP(m); m->dl = d; chsgnmp(mod,(P)c1,&m->c); NEXT(m) = 0; |
MKDP(n,m,s); s->sugar = d->td; mulmd(CO,mod,p2,s,&t); |
MKDP(n,m,s); s->sugar = d->td; mulmd(CO,mod,s,p2,&t); |
if ( NUM(c2) ) { |
if ( NUM(c2) ) { |
addmd(CO,mod,p1,t,&r); h = p0; |
addmd(CO,mod,p1,t,&r); h = p0; |
} else { |
} else { |
|
|
*head = h; *rest = r; *dnp = c2; |
*head = h; *rest = r; *dnp = c2; |
} |
} |
|
|
|
struct oEGT eg_red_mod; |
|
|
void _dp_red_mod_destructive(p1,p2,mod,rp) |
void _dp_red_mod_destructive(p1,p2,mod,rp) |
DP p1,p2; |
DP p1,p2; |
int mod; |
int mod; |
|
|
MP m; |
MP m; |
DP t,s; |
DP t,s; |
int c,c1; |
int c,c1; |
|
struct oEGT t0,t1; |
|
|
n = p1->nv; d1 = BDY(p1)->dl; d2 = BDY(p2)->dl; |
n = p1->nv; d1 = BDY(p1)->dl; d2 = BDY(p2)->dl; |
_NEWDL(d,n); d->td = d1->td - d2->td; |
_NEWDL(d,n); d->td = d1->td - d2->td; |
|
|
_NEWMP(m); m->dl = d; m->c = STOI(mod-c1); NEXT(m) = 0; |
_NEWMP(m); m->dl = d; m->c = STOI(mod-c1); NEXT(m) = 0; |
_MKDP(n,m,s); s->sugar = d->td; |
_MKDP(n,m,s); s->sugar = d->td; |
_mulmd_dup(mod,s,p2,&t); _free_dp(s); |
_mulmd_dup(mod,s,p2,&t); _free_dp(s); |
|
/* get_eg(&t0); */ |
_addmd_destructive(mod,p1,t,rp); |
_addmd_destructive(mod,p1,t,rp); |
|
/* get_eg(&t1); add_eg(&eg_red_mod,&t0,&t1); */ |
} |
} |
|
|
/* |
/* |
|
|
int *wb; |
int *wb; |
int hmag; |
int hmag; |
int sugar,psugar; |
int sugar,psugar; |
|
int fcoef; |
|
|
if ( !g ) { |
if ( !g ) { |
*rp = 0; return; |
*rp = 0; return; |
|
|
wb = (int *)ALLOCA(n*sizeof(int)); |
wb = (int *)ALLOCA(n*sizeof(int)); |
for ( i = 0, l = b; i < n; l = NEXT(l), i++ ) |
for ( i = 0, l = b; i < n; l = NEXT(l), i++ ) |
wb[i] = QTOS((Q)BDY(l)); |
wb[i] = QTOS((Q)BDY(l)); |
hmag = multiple*HMAG(g); |
|
|
/* check whether polys have coeffs in finite fields */ |
|
fcoef = 0; |
|
for ( i = 0; i < n; i++ ) |
|
if ( has_fcoef(ps[wb[i]]) ) { |
|
fcoef = 1; |
|
break; |
|
} |
|
if ( has_fcoef(g) ) |
|
fcoef = 1; |
|
|
|
if ( !fcoef ) |
|
hmag = multiple*HMAG(g); |
sugar = g->sugar; |
sugar = g->sugar; |
|
|
for ( d = 0; g; ) { |
for ( d = 0; g; ) { |
for ( u = 0, i = 0; i < n; i++ ) { |
for ( u = 0, i = 0; i < n; i++ ) { |
if ( dp_redble(g,p = ps[wb[i]]) ) { |
if ( dp_redble(g,p = ps[wb[i]]) ) { |
|
|
if ( u ) { |
if ( u ) { |
g = u; |
g = u; |
if ( d ) { |
if ( d ) { |
if ( multiple && HMAG(d) > hmag ) { |
if ( !fcoef && multiple && HMAG(d) > hmag ) { |
dp_ptozp2(d,g,&t,&u); d = t; g = u; |
dp_ptozp2(d,g,&t,&u); d = t; g = u; |
hmag = multiple*HMAG(d); |
hmag = multiple*HMAG(d); |
} |
} |
} else { |
} else { |
if ( multiple && HMAG(g) > hmag ) { |
if ( !fcoef && multiple && HMAG(g) > hmag ) { |
dp_ptozp(g,&t); g = t; |
dp_ptozp(g,&t); g = t; |
hmag = multiple*HMAG(g); |
hmag = multiple*HMAG(g); |
} |
} |