version 1.9, 2003/11/21 08:07:16 |
version 1.10, 2003/11/27 11:25:00 |
|
|
return (A[0]<B[0] ? 1:(A[0]>B[0] ? -1:0))$ |
return (A[0]<B[0] ? 1:(A[0]>B[0] ? -1:0))$ |
} |
} |
|
|
def wsort(A,B,C){ |
def bsort(A){ |
|
|
D=newvect(length(B))$ |
K=size(A)[0]-1$ |
for(I=0;I<length(B);I++) |
while(K>=0){ |
D[I]=[A[I],B[I],C[I]]$ |
J=-1$ |
|
for(I=1;I<=K;I++) |
|
if(A[I-1][0]<A[I][0]){ |
|
J=I-1$ |
|
X=A[J]$ |
|
A[J]=A[I]$ |
|
A[I]=X$ |
|
} |
|
K=J$ |
|
} |
|
return A$ |
|
} |
|
|
D=qsort(D,worder)$ |
def perm(I,P,TMP){ |
E=[]$ |
|
for(I=0;I<length(B);I++) |
if(I>0){ |
E=cons(D[I][1],E)$ |
TMP=perm(I-1,P,TMP)$ |
E=reverse(E)$ |
for(J=I-1;J>=0;J--){ |
F=[]$ |
T=P[I]$ |
for(I=0;I<length(B);I++) |
P[I]=P[J]$ |
F=cons(D[I][2],F)$ |
P[J]=T$ |
F=reverse(F)$ |
TMP=perm(I-1,P,TMP)$ |
|
T=P[I]$ |
|
P[I]=P[J]$ |
|
P[J]=T$ |
|
} |
|
|
|
return TMP$ |
|
} |
|
else{ |
|
for(TMP0=[],K=0;K<size(P)[0];K++) |
|
TMP0=cons(P[K],TMP0)$ |
|
|
|
TMP=cons(TMP0,TMP)$ |
|
return TMP$ |
|
} |
|
} |
|
|
|
def marge(A,B){ |
|
|
|
RET=[]$ |
|
for(I=0;I<length(A);I++) |
|
for(J=0;J<length(B);J++) |
|
RET=cons(append(A[I],B[J]),RET)$ |
|
|
|
return RET$ |
|
} |
|
|
|
def wsort(A,B,C,FLAG){ |
|
|
|
if(FLAG==0){ |
|
D=newvect(length(B))$ |
|
for(I=0;I<length(B);I++) |
|
D[I]=[A[I],B[I],C[I]]$ |
|
|
|
D=bsort(D)$ |
|
E=[]$ |
|
for(I=0;I<length(B);I++) |
|
E=cons(D[I][1],E)$ |
|
E=reverse(E)$ |
|
F=[]$ |
|
for(I=0;I<length(B);I++) |
|
F=cons(D[I][2],F)$ |
|
F=reverse(F)$ |
|
|
return [E,F]$ |
return [[E,F]]$ |
|
} |
|
else{ |
|
D=newvect(length(B))$ |
|
for(I=0;I<length(B);I++) |
|
D[I]=[A[I],B[I],C[I]]$ |
|
|
|
D=qsort(D,worder)$ |
|
D0=[]$ |
|
|
|
for(I=0,J=0,TMP=[],X=0;I<size(D)[0];I++){ |
|
if(X==D[I][0]) |
|
TMP=cons(cdr(D[I]),TMP)$ |
|
else{ |
|
D0=cons(TMP,D0)$ |
|
TMP=[]$ |
|
TMP=cons(cdr(D[I]),TMP)$ |
|
X=car(D[I])$ |
|
} |
|
} |
|
D0=cdr(reverse(cons(TMP,D0)))$ |
|
D0=map(ltov,D0)$ |
|
for(I=0,TMP=[[]];I<length(D0);I++){ |
|
TMP0=perm(length(D0[I])-1,D0[I],[])$ |
|
TMP=marge(TMP,TMP0)$ |
|
} |
|
|
|
RET=[]$ |
|
for(I=0;I<length(TMP);I++){ |
|
TMP0=[]$ |
|
TMP1=[]$ |
|
for(J=0;J<length(TMP[I]);J++){ |
|
TMP0=cons(TMP[I][J][0],TMP0)$ |
|
TMP1=cons(TMP[I][J][1],TMP1)$ |
|
} |
|
TMP0=reverse(TMP0)$ |
|
TMP1=reverse(TMP1)$ |
|
|
|
RET=cons([TMP0,TMP1],RET)$ |
|
} |
|
|
|
return RET$ |
|
} |
} |
} |
|
|
def derase(A){ |
def derase(A){ |
Line 103 def getgcd(A,B){ |
|
Line 198 def getgcd(A,B){ |
|
return RET$ |
return RET$ |
} |
} |
|
|
def resvars(Res,Vars){ |
def makeret(Res,Vars,FLAG){ |
|
|
ResVars=newvect(length(Vars),Vars)$ |
|
for(I=0;I<length(Res);I++){ |
|
|
|
for(J=0;J<size(ResVars)[0];J++) |
|
if(Res[I][0]==ResVars[J]) |
|
break$ |
|
|
|
if(J<size(ResVars)[0]) |
|
ResVars[J]=Res[I][1]$ |
|
} |
|
return(ResVars)$ |
|
} |
|
|
|
def makeret(Res,Vars){ |
|
|
|
ResNum=length(Res)$ |
ResNum=length(Res)$ |
VarsNum=length(Vars)$ |
VarsNum=length(Vars)$ |
|
|
Line 128 def makeret(Res,Vars){ |
|
Line 208 def makeret(Res,Vars){ |
|
if(member(Res[I][0],Vars)){ |
if(member(Res[I][0],Vars)){ |
ResVec[I]=Res[I][1]$ |
ResVec[I]=Res[I][1]$ |
|
|
if(type(ResVec[I])==1){ |
if(FLAG && type(ResVec[I])==1){ |
if(M==0) |
if(M==0) |
M=ResVec[I]$ |
M=ResVec[I]$ |
else |
else |
Line 152 def makeret(Res,Vars){ |
|
Line 232 def makeret(Res,Vars){ |
|
RET[J]=ResVec[I]$ |
RET[J]=ResVec[I]$ |
} |
} |
|
|
|
|
|
for(J=0;J<length(Vars);J++) |
|
RET=map(subst,RET,Vars[J], |
|
strtov(rtostr(Vars[J])+"_deg"))$ |
|
|
for(I=0;I<VarsNum;I++) |
for(I=0;I<VarsNum;I++) |
if(type(RET[I])!=1) |
if(type(RET[I])!=1) |
return [1,RET]$ |
return [1,RET]$ |
Line 264 def checktd(PolyList,Vars,ResVars){ |
|
Line 349 def checktd(PolyList,Vars,ResVars){ |
|
return 1$ |
return 1$ |
} |
} |
|
|
def qcheck(PolyList,Vars){ |
def qcheck(PolyList,Vars,FLAG){ |
|
|
|
RET=[]$ |
Res=qcheckmain(PolyList,Vars)$ |
Res=qcheckmain(PolyList,Vars)$ |
VarsNum=length(Vars)$ |
VarsNum=length(Vars)$ |
|
|
Line 294 def qcheck(PolyList,Vars){ |
|
Line 380 def qcheck(PolyList,Vars){ |
|
|
|
if(nonposdegchk(Res)){ |
if(nonposdegchk(Res)){ |
|
|
ResVars=resvars(Res,Vars)$ |
ResVars=makeret(Res,Vars,0)$ |
|
|
if(checktd(PolyList,Vars,ResVars)==1){ |
if(checktd(PolyList,Vars,ResVars[1])==1){ |
|
if(ResVars[0]==0){ |
for(J=0;J<length(Vars);J++) |
RET=append(RET,wsort(ResVars[1],Vars, |
ResVars=map(subst,ResVars,Vars[J], |
ResVars[1],FLAG))$ |
strtov(rtostr(Vars[J])+"_deg"))$ |
return RET$ |
|
} |
return [wsort(ResVars,Vars,ResVars)]$ |
else{ |
|
RET=append(RET,[[Vars,ResVars[1]]])$ |
|
return RET$ |
|
} |
} |
} |
else |
else |
return []$ |
return []$ |
Line 312 def qcheck(PolyList,Vars){ |
|
Line 401 def qcheck(PolyList,Vars){ |
|
|
|
} |
} |
|
|
def leastsq(NormMat,ExpMat,Vars){ |
def leastsq(NormMat,ExpMat,Vars,FLAG){ |
|
|
RET=[]$ |
RET=[]$ |
|
|
Line 359 def leastsq(NormMat,ExpMat,Vars){ |
|
Line 448 def leastsq(NormMat,ExpMat,Vars){ |
|
Res=getgcd(Res,Rea)$ |
Res=getgcd(Res,Rea)$ |
|
|
if(nonposdegchk(Res)){ |
if(nonposdegchk(Res)){ |
TMP1=makeret(Res,Vars)$ |
TMP1=makeret(Res,Vars,1)$ |
if(TMP1[0]==0){ |
if(TMP1[0]==0){ |
TMP=roundret(TMP1[1]*1.0)$ |
TMP=roundret(TMP1[1]*1.0)$ |
if(TMP!=[]) |
if(TMP!=[]) |
RET=cons(wsort(TMP1[1],Vars,TMP),RET)$ |
RET=append(RET,wsort(TMP1[1],Vars,TMP,FLAG))$ |
|
|
RET=cons(wsort(TMP1[1],Vars, |
RET=append(RET,wsort(TMP1[1],Vars, |
map(drint,TMP1[1]*1.0)),RET)$ |
map(drint,TMP1[1]*1.0),FLAG))$ |
|
|
return RET$ |
return RET$ |
} |
} |
else{ |
else{ |
RET=cons(wsort(TMP1[1],Vars,TMP1[1]*1.0),RET)$ |
RET=append(RET,[[Vars,TMP1[1]*1.0]])$ |
return RET$ |
return RET$ |
} |
} |
} |
} |
Line 380 def leastsq(NormMat,ExpMat,Vars){ |
|
Line 469 def leastsq(NormMat,ExpMat,Vars){ |
|
|
|
} |
} |
|
|
def weightr(ExpMat,Vars,PolyListNum,OneMat){ |
def weightr(ExpMat,Vars,PolyListNum,OneMat,FLAG){ |
|
|
RET=[]$ |
RET=[]$ |
|
|
Line 475 def weightr(ExpMat,Vars,PolyListNum,OneMat){ |
|
Line 564 def weightr(ExpMat,Vars,PolyListNum,OneMat){ |
|
|
|
if(nonposdegchk(Res)){ |
if(nonposdegchk(Res)){ |
|
|
TMP1=makeret(Res,Vars)$ |
TMP1=makeret(Res,Vars,1)$ |
if(TMP1[0]==0){ |
if(TMP1[0]==0){ |
TMP=roundret(TMP1[1]*1.0)$ |
TMP=roundret(TMP1[1]*1.0)$ |
if(TMP!=[]) |
if(TMP!=[]) |
RET=cons(wsort(TMP1[1],Vars,TMP),RET)$ |
RET=append(RET,wsort(TMP1[1],Vars, |
|
TMP,FLAG))$ |
|
|
RET=cons(wsort(TMP1[1],Vars, |
RET=append(RET,wsort(TMP1[1],Vars, |
map(drint,TMP1[1]*1.0)),RET)$ |
map(drint,TMP1[1]*1.0),FLAG))$ |
} |
} |
else{ |
else{ |
RET=cons(wsort(TMP1[1],Vars,TMP1[1]*1.0),RET)$ |
RET=append(RET,[[Vars,TMP1[1]*1.0]])$ |
} |
} |
} |
} |
|
|
Line 494 def weightr(ExpMat,Vars,PolyListNum,OneMat){ |
|
Line 584 def weightr(ExpMat,Vars,PolyListNum,OneMat){ |
|
return [NormMat,RET]$ |
return [NormMat,RET]$ |
} |
} |
|
|
def weight(PolyList,Vars,FLAG){ |
def weight(PolyList,Vars,FLAG1,FLAG2){ |
|
|
Vars0=vars(PolyList)$ |
Vars0=vars(PolyList)$ |
Vars1=[]$ |
Vars1=[]$ |
Line 506 def weight(PolyList,Vars,FLAG){ |
|
Line 596 def weight(PolyList,Vars,FLAG){ |
|
|
|
RET=[]$ |
RET=[]$ |
|
|
TMP=qcheck(PolyList,Vars)$ |
TMP=qcheck(PolyList,Vars,FLAG2)$ |
|
|
if(TMP!=[]){ |
if(TMP!=[]){ |
RET=append(RET,TMP)$ |
RET=append(RET,TMP)$ |
Line 517 def weight(PolyList,Vars,FLAG){ |
|
Line 607 def weight(PolyList,Vars,FLAG){ |
|
|
|
PolyListNum=length(PolyList)$ |
PolyListNum=length(PolyList)$ |
|
|
if(FLAG){ |
if(FLAG1){ |
|
|
OneMat=newvect(PolyListNum+1,[0])$ |
OneMat=newvect(PolyListNum+1,[0])$ |
ExpMat=[]$ |
ExpMat=[]$ |
Line 532 def weight(PolyList,Vars,FLAG){ |
|
Line 622 def weight(PolyList,Vars,FLAG){ |
|
ExpMat=reverse(ExpMat)$ |
ExpMat=reverse(ExpMat)$ |
ExpMat=newvect(length(ExpMat),ExpMat)$ |
ExpMat=newvect(length(ExpMat),ExpMat)$ |
|
|
TMP=weightr(ExpMat,Vars,PolyListNum,OneMat)$ |
TMP=weightr(ExpMat,Vars,PolyListNum,OneMat,FLAG2)$ |
RET=append(RET,TMP[1])$ |
RET=append(RET,TMP[1])$ |
RET=append(RET,leastsq(TMP[0],ExpMat,Vars))$ |
RET=append(RET,leastsq(TMP[0],ExpMat,Vars,FLAG2))$ |
} |
} |
else{ |
else{ |
ExpMat=[]$ |
ExpMat=[]$ |
Line 549 def weight(PolyList,Vars,FLAG){ |
|
Line 639 def weight(PolyList,Vars,FLAG){ |
|
ExpMat=reverse(ExpMat)$ |
ExpMat=reverse(ExpMat)$ |
ExpMat=newvect(length(ExpMat),ExpMat)$ |
ExpMat=newvect(length(ExpMat),ExpMat)$ |
|
|
RET=append(RET,leastsq(0,ExpMat,Vars))$ |
RET=append(RET,leastsq(0,ExpMat,Vars,FLAG2))$ |
} |
} |
|
|
ExpMat=qsort(ExpMat,junban)$ |
ExpMat=qsort(ExpMat,junban)$ |
Line 561 def weight(PolyList,Vars,FLAG){ |
|
Line 651 def weight(PolyList,Vars,FLAG){ |
|
|
|
if(size(ExpMat)[0]!=length(ExpMat2)){ |
if(size(ExpMat)[0]!=length(ExpMat2)){ |
ExpMat=newvect(length(ExpMat2),ExpMat2)$ |
ExpMat=newvect(length(ExpMat2),ExpMat2)$ |
RET=append(RET,leastsq(0,ExpMat,Vars))$ |
RET=append(RET,leastsq(0,ExpMat,Vars,FLAG2))$ |
} |
} |
|
|
RET=derase(RET)$ |
RET=derase(RET)$ |