version 1.38, 2004/12/06 09:29:34 |
version 1.40, 2006/12/12 11:50:37 |
|
|
* 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.37 2004/09/15 06:06:42 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/dp-supp.c,v 1.39 2005/08/25 18:59:11 ohara Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "base.h" |
#include "base.h" |
Line 122 void dp_ptozp2(DP p0,DP p1,DP *hp,DP *rp) |
|
Line 122 void dp_ptozp2(DP p0,DP p1,DP *hp,DP *rp) |
|
*hp = h; *rp = r; |
*hp = h; *rp = r; |
} |
} |
|
|
|
void dp_ptozp3(DP p,Q *dvr,DP *rp) |
|
{ |
|
MP m,mr,mr0; |
|
int i,n; |
|
Q *w; |
|
P t; |
|
|
|
if ( !p ) { |
|
*rp = 0; *dvr = 0; |
|
}else { |
|
for ( m =BDY(p), n = 0; m; m = NEXT(m), n++ ); |
|
w = (Q *)ALLOCA(n*sizeof(Q)); |
|
for ( m =BDY(p), i = 0; i < n; m = NEXT(m), i++ ) |
|
if ( NUM(m->c) ) |
|
w[i] = (Q)m->c; |
|
else |
|
ptozp(m->c,1,&w[i],&t); |
|
sortbynm(w,n); |
|
qltozl(w,n,dvr); |
|
for ( mr0 = 0, m = BDY(p); m; m = NEXT(m) ) { |
|
NEXTMP(mr0,mr); divsp(CO,m->c,(P)(*dvr),&mr->c); mr->dl = m->dl; |
|
} |
|
NEXT(mr) = 0; MKDP(p->nv,mr0,*rp); (*rp)->sugar = p->sugar; |
|
} |
|
} |
|
|
void dp_idiv(DP p,Q c,DP *rp) |
void dp_idiv(DP p,Q c,DP *rp) |
{ |
{ |
Q t; |
Q t; |
Line 485 void heu_nezgcdnpz(VL vl,P *pl,int m,P *pr) |
|
Line 511 void heu_nezgcdnpz(VL vl,P *pl,int m,P *pr) |
|
int i,r; |
int i,r; |
P gcd,t,s1,s2,u; |
P gcd,t,s1,s2,u; |
Q rq; |
Q rq; |
|
DCP dc; |
|
extern int DP_Print; |
|
|
while ( 1 ) { |
while ( 1 ) { |
for ( i = 0, s1 = 0; i < m; i++ ) { |
for ( i = 0, s1 = 0; i < m; i++ ) { |
r = random(); UTOQ(r,rq); |
r = random(); UTOQ(r,rq); |
Line 496 void heu_nezgcdnpz(VL vl,P *pl,int m,P *pr) |
|
Line 524 void heu_nezgcdnpz(VL vl,P *pl,int m,P *pr) |
|
mulp(vl,pl[i],(P)rq,&t); addp(vl,s2,t,&u); s2 = u; |
mulp(vl,pl[i],(P)rq,&t); addp(vl,s2,t,&u); s2 = u; |
} |
} |
ezgcdp(vl,s1,s2,&gcd); |
ezgcdp(vl,s1,s2,&gcd); |
|
if ( DP_Print > 2 ) |
|
{ fprintf(asir_out,"(%d)",nmonop(gcd)); fflush(asir_out); } |
for ( i = 0; i < m; i++ ) { |
for ( i = 0; i < m; i++ ) { |
if ( !divtpz(vl,pl[i],gcd,&t) ) |
if ( !divtpz(vl,pl[i],gcd,&t) ) |
break; |
break; |