version 1.8, 2001/10/09 01:36:11 |
version 1.14, 2010/01/31 03:25:54 |
|
|
* 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/PU.c,v 1.7 2001/10/01 01:58:03 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/engine/PU.c,v 1.13 2010/01/28 08:56:26 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
|
|
Line 114 void substp(VL vl,P p,V v0,P p0,P *pr) |
|
Line 114 void substp(VL vl,P p,V v0,P p0,P *pr) |
|
} |
} |
} |
} |
|
|
|
void substpp(VL vl,P p,V *vvect,P *svect,int nv,P *pr); |
|
|
|
void substpp(VL vl,P p,V *vvect,P *svect,int nv,P *pr) |
|
{ |
|
P x,t,m,c,s,a,p0,c1; |
|
DCP dc; |
|
Q d; |
|
V v; |
|
int i; |
|
|
|
if ( !p ) |
|
*pr = 0; |
|
else if ( NUM(p) ) |
|
*pr = p; |
|
else { |
|
v = VR(p); |
|
for ( i = 0; i < nv; i++ ) if ( vvect[i] == v ) break; |
|
if ( svect[i] && OID(svect[i]) < 0 ) { |
|
MKV(VR(p),x); |
|
for ( c = 0, dc = DC(p); dc; dc = NEXT(dc) ) { |
|
substpp(vl,COEF(dc),vvect,svect,nv,&t); |
|
if ( DEG(dc) ) { |
|
pwrp(vl,x,DEG(dc),&s); mulp(vl,s,t,&m); |
|
addp(vl,m,c,&a); |
|
c = a; |
|
} else { |
|
addp(vl,t,c,&a); |
|
c = a; |
|
} |
|
} |
|
*pr = c; |
|
} else { |
|
p0 = svect[i]; |
|
dc = DC(p); |
|
substpp(vl,COEF(dc),vvect,svect,nv,&c); |
|
for ( d = DEG(dc), dc = NEXT(dc); |
|
dc; d = DEG(dc), dc = NEXT(dc) ) { |
|
subq(d,DEG(dc),(Q *)&t); pwrp(vl,p0,(Q)t,&s); |
|
mulp(vl,s,c,&m); |
|
substpp(vl,COEF(dc),vvect,svect,nv,&c1); |
|
addp(vl,m,c1,&c); |
|
} |
|
if ( d ) { |
|
pwrp(vl,p0,d,&t); mulp(vl,t,c,&m); |
|
c = m; |
|
} |
|
*pr = c; |
|
} |
|
} |
|
} |
|
|
void detp(VL vl,P **rmat,int n,P *dp) |
void detp(VL vl,P **rmat,int n,P *dp) |
{ |
{ |
int i,j,k,sgn; |
int i,j,k,l,sgn,nmin,kmin,lmin,ntmp; |
P mjj,mij,t,s,u,d; |
P mjj,mij,t,s,u,d; |
P **mat; |
P **mat; |
P *mi,*mj; |
P *mi,*mj; |
Line 130 void detp(VL vl,P **rmat,int n,P *dp) |
|
Line 181 void detp(VL vl,P **rmat,int n,P *dp) |
|
if ( i == n ) { |
if ( i == n ) { |
*dp = 0; return; |
*dp = 0; return; |
} |
} |
for ( k = i; k < n; k++ ) |
nmin = nmonop(mat[i][j]); |
if ( mat[k][j] && (nmonop(mat[k][j]) < nmonop(mat[i][j]) ) ) |
kmin=i; lmin=j; |
i = k; |
for ( k = j; k < n; k++ ) |
if ( j != i ) { |
for ( l = j; l < n; l++ ) |
mj = mat[j]; mat[j] = mat[i]; mat[i] = mj; sgn = -sgn; |
if ( mat[k][l] && ((ntmp=nmonop(mat[k][l])) < nmin) ) { |
|
kmin = k; lmin = l; nmin = ntmp; |
|
} |
|
if ( kmin != j ) { |
|
mj = mat[j]; mat[j] = mat[kmin]; mat[kmin] = mj; sgn = -sgn; |
} |
} |
|
if ( lmin != j ) { |
|
for ( k = j; k < n; k++ ) { |
|
t = mat[k][j]; mat[k][j] = mat[k][lmin]; mat[k][lmin] = t; |
|
} |
|
sgn = -sgn; |
|
} |
for ( i = j + 1, mj = mat[j], mjj = mj[j]; i < n; i++ ) |
for ( i = j + 1, mj = mat[j], mjj = mj[j]; i < n; i++ ) |
for ( k = j + 1, mi = mat[i], mij = mi[j]; k < n; k++ ) { |
for ( k = j + 1, mi = mat[i], mij = mi[j]; k < n; k++ ) { |
mulp(vl,mi[k],mjj,&t); mulp(vl,mj[k],mij,&s); |
mulp(vl,mi[k],mjj,&t); mulp(vl,mj[k],mij,&s); |
Line 635 showmat(VL vl,P **mat,int n) |
|
Line 696 showmat(VL vl,P **mat,int n) |
|
|
|
for ( i = 0; i < n; i++ ) { |
for ( i = 0; i < n; i++ ) { |
for ( j = 0; j < n; j++ ) { |
for ( j = 0; j < n; j++ ) { |
mptop(mat[i][j],&t); printp(vl,t); fprintf(out," "); |
mptop(mat[i][j],&t); asir_printp(vl,t); fprintf(out," "); |
} |
} |
fprintf(out,"\n"); |
fprintf(out,"\n"); |
} |
} |
Line 646 showmp(VL vl,P p) |
|
Line 707 showmp(VL vl,P p) |
|
{ |
{ |
P t; |
P t; |
|
|
mptop(p,&t); printp(vl,t); fprintf(out,"\n"); |
mptop(p,&t); asir_printp(vl,t); fprintf(out,"\n"); |
} |
} |
#endif |
#endif |
|
|
Line 1030 int maxblenp(P p) |
|
Line 1091 int maxblenp(P p) |
|
return n_bits(NM((Q)p))+(INT((Q)p)?0:n_bits(DN((Q)p))); |
return n_bits(NM((Q)p))+(INT((Q)p)?0:n_bits(DN((Q)p))); |
else { |
else { |
for ( dc = DC(p), s = 0; dc; dc = NEXT(dc) ) { |
for ( dc = DC(p), s = 0; dc; dc = NEXT(dc) ) { |
t = p_mag(COEF(dc)); |
t = maxblenp(COEF(dc)); |
s = MAX(t,s); |
s = MAX(t,s); |
} |
} |
return s; |
return s; |