version 1.10, 2004/06/25 03:07:51 |
version 1.15, 2018/02/28 03:55:38 |
|
|
* 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.9 2002/09/11 07:23:25 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/engine/PU.c,v 1.14 2010/01/31 03:25:54 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 668 void premp(VL vl,P p1,P p2,P *pr) |
|
Line 729 void premp(VL vl,P p1,P p2,P *pr) |
|
*pr = 0; |
*pr = 0; |
else if ( ( v1 = VR(p1) ) == ( v2 = VR(p2) ) ) { |
else if ( ( v1 = VR(p1) ) == ( v2 = VR(p2) ) ) { |
n1 = deg(v1,p1); n2 = deg(v1,p2); |
n1 = deg(v1,p1); n2 = deg(v1,p2); |
|
if ( n1 < n2 ) { |
|
*pr = p1; |
|
return; |
|
} |
pw = (P *)ALLOCA((n1+1)*sizeof(P)); |
pw = (P *)ALLOCA((n1+1)*sizeof(P)); |
bzero((char *)pw,(int)((n1+1)*sizeof(P))); |
bzero((char *)pw,(int)((n1+1)*sizeof(P))); |
|
|