version 1.1.1.1, 1999/12/03 07:39:07 |
version 1.3, 2001/03/09 01:13:28 |
|
|
/* $OpenXM: OpenXM/src/asir99/builtin/al.c,v 1.2 1999/11/18 05:42:01 noro Exp $ */ |
|
/* ---------------------------------------------------------------------- |
/* ---------------------------------------------------------------------- |
$Id$ |
$Id$ |
---------------------------------------------------------------------- |
---------------------------------------------------------------------- |
File al.c: Real quantifier elimination code for RISA/ASIR |
File al.c: Real quantifier elimination code for RISA/ASIR |
|
|
Copyright (c) 1996, 1997, 1998 by |
Copyright (c) 1996-2001 by |
Andreas Dolzmann and Thomas Sturm, University of Passau, Germany |
Andreas Dolzmann and Thomas Sturm, University of Passau, Germany |
dolzmann@uni-passau.de, sturm@uni-passau.de |
dolzmann@uni-passau.de, sturm@uni-passau.de |
---------------------------------------------------------------------- |
---------------------------------------------------------------------- |
Line 61 void qeblock_verbose0(); |
|
Line 60 void qeblock_verbose0(); |
|
int getmodulus(); |
int getmodulus(); |
int qevar(); |
int qevar(); |
int gausselim(); |
int gausselim(); |
|
int delv(); |
int translate(); |
int translate(); |
int translate_a(); |
int translate_a(); |
void translate_a1(); |
void translate_a1(); |
|
|
int selectside(); |
int selectside(); |
int cmp2n(); |
int cmp2n(); |
void add2eset(); |
void add2eset(); |
|
void seproots(); |
void sp_add2eset(); |
void sp_add2eset(); |
void subgpf(); |
void subgpf(); |
void subref(); |
void subref(); |
|
|
struct oRE { |
struct oRE { |
P p; |
P p; |
P discr; |
P discr; |
|
int rootno; |
int itype; |
int itype; |
}; |
}; |
|
|
Line 161 typedef struct oQVL *QVL; |
|
Line 163 typedef struct oQVL *QVL; |
|
#define MKGP(x,g,p) (NEWGP(x),GUARD(x)=g,POINT(x)=p) |
#define MKGP(x,g,p) (NEWGP(x),GUARD(x)=g,POINT(x)=p) |
|
|
#define NEWRE(x) ((x)=(RE)MALLOC(sizeof(struct oRE))) |
#define NEWRE(x) ((x)=(RE)MALLOC(sizeof(struct oRE))) |
#define MKRE(x,pp,d,i) \ |
#define MKRE(x,pp,d,rn,i) \ |
(NEWRE(x),(x)->p=pp,(x)->discr=d,(x)->itype=i) |
(NEWRE(x),(x)->p=pp,(x)->discr=d,(x)->rootno=rn,(x)->itype=i) |
#define DISC(re) ((re)->discr) |
#define DISC(re) ((re)->discr) |
|
#define ROOTNO(re) ((re)->rootno) |
#define ITYPE(re) ((re)->itype) |
#define ITYPE(re) ((re)->itype) |
|
|
#define STD 0 |
#define STD 0 |
|
|
if (!w) |
if (!w) |
continue; |
continue; |
*px = v; |
*px = v; |
delvip(v,pvl); |
delv(v,*pvl,pvl); |
if (a) { |
if (a) { |
gauss_mkeset2(rlhs,a,b,c,peset); |
gauss_mkeset2(rlhs,a,b,c,peset); |
return 2; |
return 2; |
|
|
BDY(esetc) = (pointer)hgp; |
BDY(esetc) = (pointer)hgp; |
} |
} |
NEXTNODE(*peset,esetc); |
NEXTNODE(*peset,esetc); |
mkqgp(rlhs,a,b,c,STD,&hgp); |
mkqgp(rlhs,a,b,c,1,STD,&hgp); |
BDY(esetc) = (pointer)hgp; |
BDY(esetc) = (pointer)hgp; |
|
NEXTNODE(*peset,esetc); |
|
mkqgp(rlhs,a,b,c,2,STD,&hgp); |
|
BDY(esetc) = (pointer)hgp; |
} |
} |
|
|
int delvip(v,pvl) |
int delv(v,vl,pnvl) |
V v; |
V v; |
VL *pvl; |
VL vl,*pnvl; |
{ |
{ |
VL prev; |
VL nvl=NULL,nvlc; |
|
|
if (v == VR(*pvl)) { |
if (v == VR(vl)) { |
*pvl = NEXT(*pvl); |
*pnvl = NEXT(vl); |
return 1; |
return 1; |
} |
} |
for (prev=*pvl; NEXT(prev); prev=NEXT(prev)) |
for (; vl && (VR(vl) != v); vl=NEXT(vl)) { |
if (VR(NEXT(prev)) == v) { |
NEXTVL(nvl,nvlc); |
NEXT(prev) = NEXT(NEXT(prev)); |
VR(nvlc) = VR(vl); |
return 1; |
} |
} |
if (vl) { |
|
NEXT(nvlc) = NEXT(vl); |
|
*pnvl = nvl; |
|
return 1; |
|
} |
|
*pnvl = nvl; |
return 0; |
return 0; |
} |
} |
|
|
|
|
RE hre; |
RE hre; |
F hf; |
F hf; |
|
|
MKRE(hre,mp,(P)ONE,itype); |
MKRE(hre,mp,(P)ONE,1,itype); |
MKAF(hf,AL_NEQ,b); |
MKAF(hf,AL_NEQ,b); |
MKGP(*pgp,hf,hre); |
MKGP(*pgp,hf,hre); |
} |
} |
Line 1529 NODE trans[],transc[]; |
|
Line 1540 NODE trans[],transc[]; |
|
} |
} |
indices(op,0,&itype,&btype); |
indices(op,0,&itype,&btype); |
NEXTNODE(trans[btype],transc[btype]); |
NEXTNODE(trans[btype],transc[btype]); |
mkqgp(mp,a,b,c,itype,&hgp); |
mkqgp(mp,a,b,c,-1,itype,&hgp); |
BDY(transc[btype]) = (pointer)hgp; |
BDY(transc[btype]) = (pointer)hgp; |
} |
} |
|
|
void mkqgp(mp,a,b,c,itype,pgp) |
void mkqgp(mp,a,b,c,rootno,itype,pgp) |
P mp,a,b,c; |
P mp,a,b,c; |
|
int rootno; |
int itype; |
int itype; |
GP *pgp; |
GP *pgp; |
{ |
{ |
|
|
NODE n=NULL,nc; |
NODE n=NULL,nc; |
|
|
mkdiscr(a,b,c,&discr); |
mkdiscr(a,b,c,&discr); |
MKRE(hre,mp,discr,itype); |
MKRE(hre,mp,discr,rootno,itype); |
NEXTNODE(n,nc); |
NEXTNODE(n,nc); |
MKAF(hf,AL_NEQ,a); |
MKAF(hf,AL_NEQ,a); |
BDY(nc) = (pointer)hf; |
BDY(nc) = (pointer)hf; |
|
|
add2eset(trans[cs],peset,&esetc); |
add2eset(trans[cs],peset,&esetc); |
sp_add2eset(trans[BTSO],deps,peset,&esetc); |
sp_add2eset(trans[BTSO],deps,peset,&esetc); |
NEXTNODE(*peset,esetc); |
NEXTNODE(*peset,esetc); |
MKRE(hre,0,0,dinf); |
MKRE(hre,0,0,0,dinf); |
MKGP(hgp,F_TRUE,hre); |
MKGP(hgp,F_TRUE,hre); |
BDY(esetc) = (pointer)hgp; |
BDY(esetc) = (pointer)hgp; |
} else { |
} else { |
NEXTNODE(*peset,esetc); |
NEXTNODE(*peset,esetc); |
MKV(x,h); |
MKV(x,h); |
MKRE(hre,h,(P)ONE,STD); |
MKRE(hre,h,(P)ONE,1,STD); |
MKGP(hgp,F_TRUE,hre); |
MKGP(hgp,F_TRUE,hre); |
BDY(esetc) = (pointer)hgp; |
BDY(esetc) = (pointer)hgp; |
} |
} |
Line 1733 NODE n1a,n1b,n2a,n2b; |
|
Line 1745 NODE n1a,n1b,n2a,n2b; |
|
void add2eset(trfield,peset,pesetc) |
void add2eset(trfield,peset,pesetc) |
NODE trfield,*peset,*pesetc; |
NODE trfield,*peset,*pesetc; |
{ |
{ |
|
NODE ntrfield,ntrfieldc; |
|
|
if (trfield == NULL) |
if (trfield == NULL) |
return; |
return; |
if (*peset == NULL) |
seproots(trfield,&ntrfield,&ntrfieldc); |
*peset = *pesetc = trfield; |
if (*peset == NULL) { |
else |
*peset = ntrfield; |
NEXT(*pesetc) = trfield; |
*pesetc = ntrfieldc; |
while (NEXT(*pesetc)) |
} else { |
*pesetc = NEXT(*pesetc); |
NEXT(*pesetc) = ntrfield; |
|
*pesetc = ntrfieldc; |
|
} |
} |
} |
|
|
|
void seproots(trfield,pntrfield,pntrfieldc) |
|
NODE trfield,*pntrfield,*pntrfieldc; |
|
{ |
|
NODE sc; |
|
NODE ntrf=NULL,ntrfc; |
|
RE hre,hre2; |
|
GP hgp,hgp2; |
|
|
|
for (sc=trfield; sc; sc=NEXT(sc)) { |
|
hgp = (GP)BDY(sc); |
|
hre = POINT(hgp); |
|
if (ROOTNO(hre) == -1) { |
|
NEXTNODE(ntrf,ntrfc); |
|
MKRE(hre2,PL(hre),DISC(hre),1,ITYPE(hre)); |
|
MKGP(hgp2,GUARD(hgp),hre2); |
|
BDY(ntrfc) = (pointer)hgp2; |
|
NEXTNODE(ntrf,ntrfc); |
|
ROOTNO(hre) = 2; |
|
BDY(ntrfc) = (pointer)hgp; |
|
} else { |
|
NEXTNODE(ntrf,ntrfc); |
|
BDY(ntrfc) = (pointer)hgp; |
|
} |
|
} |
|
*pntrfield = ntrf; |
|
*pntrfieldc = ntrfc; |
|
} |
|
|
void sp_add2eset(trfield,itype,peset,pesetc) |
void sp_add2eset(trfield,itype,peset,pesetc) |
NODE trfield,*peset,*pesetc; |
NODE trfield,*peset,*pesetc; |
int itype; |
int itype; |
|
|
F *pf; |
F *pf; |
{ |
{ |
P a,b,c,ld; |
P a,b,c,ld; |
F hf; |
|
NODE d=NULL,dc; |
|
|
|
getrecoeffs(prem,fdeg,re,&a,&b,&c,&ld); |
getrecoeffs(prem,fdeg,re,&a,&b,&c,&ld); |
NEXTNODE(d,dc); |
if (ROOTNO(re) == 1) |
substd_a21(op,a,b,c,ld,&hf); |
chsgnp(b,&b); |
BDY(dc) = (pointer)hf; |
else if (ROOTNO(re) != 2) |
NEXTNODE(d,dc); |
error("unspecified quadratic root in substd_a2"); |
chsgnp(b,&b); |
substd_a21(op,a,b,c,ld,pf); |
substd_a21(op,a,b,c,ld,&hf); |
|
BDY(dc) = (pointer)hf; |
|
MKJF(*pf,AL_OR,d); |
|
} |
} |
|
|
void substd_a21(op,a,b,c,d,pf) |
void substd_a21(op,a,b,c,d,pf) |
|
|
RE stdre; |
RE stdre; |
|
|
subpme_a_o1(FOP(af),FPL(af),v,ITYPE(r)==MEPS,&h); |
subpme_a_o1(FOP(af),FPL(af),v,ITYPE(r)==MEPS,&h); |
MKRE(stdre,PL(r),DISC(r),STD); |
MKRE(stdre,PL(r),DISC(r),ROOTNO(r),STD); |
subref(h,v,stdre,pnf); |
subref(h,v,stdre,pnf); |
} |
} |
|
|