=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/include/ca.h,v retrieving revision 1.12 retrieving revision 1.19 diff -u -p -r1.12 -r1.19 --- OpenXM_contrib2/asir2000/include/ca.h 2001/03/13 01:10:26 1.12 +++ OpenXM_contrib2/asir2000/include/ca.h 2001/08/20 09:03:25 1.19 @@ -45,7 +45,7 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/include/ca.h,v 1.11 2000/12/22 10:03:29 saito Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/include/ca.h,v 1.18 2001/07/03 01:41:26 noro Exp $ */ #include @@ -108,6 +108,7 @@ typedef void * pointer; #define O_F 14 #define O_GFMMAT 15 #define O_BYTEARRAY 16 +#define O_QUOTE 17 #define O_VOID -1 #define N_Q 0 @@ -331,6 +332,12 @@ typedef struct oBYTEARRAY { unsigned char *body; } *BYTEARRAY; +typedef struct oQUOTE { + short id; + short pad; + pointer body; +} *QUOTE; + typedef struct oObj { short id; short pad; @@ -363,16 +370,25 @@ typedef struct oNODE { struct oNODE *next; } *NODE; +/* univariate poly over small finite field; dense */ typedef struct oUM { int d; int c[1]; } *UM; +/* univariate poly with padic coeff */ typedef struct oLUM { int d; int *c[1]; } *LUM; +/* bivariate poly over small finite field; dense */ + +typedef struct oBM { + int d; + UM c[1]; +} *BM; + typedef struct oML { int n; int mod; @@ -522,6 +538,21 @@ bzero((char *)(p),(int)(((n)+1)*sizeof(type)))) (p) = ___q___;\ } +#define W_BMALLOC(dx,dy,p)\ +{\ + BM ___q___;\ + int ___i___;\ + UM *___c___;\ + (___q___) = (BM)ALLOCA(TRUESIZE(oBM,(dy),UM));\ + DEG(___q___) = dy;\ + ___c___ = (UM *)COEF(___q___);\ + for ( ___i___ = 0; ___i___ <= dy; ___i___++ ) {\ + ___c___[___i___] = W_UMALLOC(dx);\ + clearum(___c___[___i___],dx);\ + }\ + (p) = ___q___;\ +} + #define NEWUP2(q,w)\ ((q)=(UP2)MALLOC_ATOMIC(TRUESIZE(oUP2,(w)-1,unsigned int)),\ bzero((char *)(q)->b,(w)*sizeof(unsigned int))) @@ -546,6 +577,7 @@ bzero((char *)(q)->b,(w)*sizeof(unsigned int))) #define NEWERR(e) ((e)=(ERR)MALLOC(sizeof(struct oERR)),OID(e)=O_ERR) #define NEWMATHCAP(e) ((e)=(MATHCAP)MALLOC(sizeof(struct oMATHCAP)),OID(e)=O_MATHCAP) #define NEWBYTEARRAY(e) ((e)=(BYTEARRAY)MALLOC(sizeof(struct oBYTEARRAY)),OID(e)=O_BYTEARRAY) +#define NEWQUOTE(e) ((e)=(QUOTE)MALLOC(sizeof(struct oQUOTE)),OID(e)=O_QUOTE) #define NEWNODE(a) ((a)=(NODE)MALLOC(sizeof(struct oNODE))) #define NEWDC(dc) ((dc)=(DCP)MALLOC(sizeof(struct oDCP))) @@ -597,6 +629,7 @@ DEG(DC(p))=ONE,COEF(DC(p))=(P)ONEM,NEXT(DC(p))=0) #define MKMATHCAP(e,b) (NEWMATHCAP(e),(e)->body=(LIST)(b)) #define MKBYTEARRAY(m,l) \ (NEWBYTEARRAY(m),(m)->len=(l),(m)->body=(char *)MALLOC_ATOMIC((l)),bzero((m)->body,(l))) +#define MKQUOTE(q,b) (NEWQUOTE(q),(q)->body=(pointer)(b)) #define NEXTDC(r,c) \ if(!(r)){NEWDC(r);(c)=(r);}else{NEWDC(NEXT(c));(c)=NEXT(c);} @@ -668,6 +701,11 @@ PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q) #define ITOS(p) (((unsigned int)(p))&0x7fffffff) #define STOI(i) ((P)((unsigned int)(i)|0x80000000)) +/* immediate GFS representation */ + +#define IFTOF(p) ((int)(((unsigned int)(p))&0x7fffffff)) +#define FTOIF(i) ((int)(((unsigned int)(i)|0x80000000))) + struct cdl { P c; DL d; @@ -725,12 +763,13 @@ extern UP2 ONEUP2; extern FILE *asir_out; #if defined(__GNUC__) extern const int sprime[]; -extern const int lprime[]; #else extern int sprime[]; -extern int lprime[]; #endif +extern int lprime_size; +extern int *lprime; + extern void (*addnumt[])(); extern void (*subnumt[])(); extern void (*mulnumt[])(); @@ -1080,6 +1119,7 @@ int int_bits(int); LUM LUMALLOC(int, int); +BM BMALLOC(int, int); Obj ToAlg(Num); UM *berlemain(register int, UM, UM *); void *Risa_GC_malloc(size_t); @@ -1200,6 +1240,7 @@ void addlm(LM,LM,LM *); void addstr(VL,STRING,STRING,STRING *); void addum(int,UM,UM,UM); void addvect(VL,VECT,VECT,VECT *); +void addquote(VL,QUOTE,QUOTE,QUOTE *); void adjc(VL,P,P,P,Q,P *,P *); void afctr(VL,P,P,DCP *); void afctrmain(VL,P,P,int,DCP *); @@ -1223,6 +1264,7 @@ void chsgnreal(Num,Num *); void chsgnmi(MQ,MQ *); void chsgnlm(LM,LM *); void chsgnvect(VECT,VECT *); +void chsgnquote(QUOTE,QUOTE *); void clctv(VL,P,VL *); void clctvr(VL,Obj,VL *); void cm2p(Q,Q,P,P *); @@ -1264,6 +1306,7 @@ void divsrdcp(VL,P,P,P *,P *); void divsrmp(VL,int,P,P,P *,P *); void divsrp(VL,P,P,P *,P *); void divvect(VL,Obj,Obj,Obj *); +void divquote(VL,QUOTE,QUOTE,QUOTE *); void dtest(P,ML,int,DCP *); void dtestroot(int,int,P,LUM,struct oDUM *,DCP *); void dtestroot1(int,int,P,LUM,P *); @@ -1359,6 +1402,7 @@ void mulsgn(VN,VN,int,VN); void mulsum(register int,UM,register int,UM); void mulum(register int,UM,UM,UM); void mulvect(VL,Obj,Obj,Obj *); +void mulquote(VL,QUOTE,QUOTE,QUOTE *); void mulvectmat(VL,VECT,MAT,VECT *); void next(VN); void nezgcdnp_sqfr_primitive(VL,P,P *,int,P *); @@ -1404,6 +1448,7 @@ void pwrnum(VL,Num,Num,Num *); void pwrp(VL,P,Q,P *); void pwrq(Q,Q,Q *); void pwrr(VL,Obj,Obj,Obj *); +void pwrquote(VL,QUOTE,QUOTE,QUOTE *); void pwrreal(Num,Num,Real *); void pwrmi(MQ,Q,MQ *); void pwrlm(LM,Q,LM *); @@ -1462,6 +1507,7 @@ void substp(VL,P,V,P,P *); void substvp(VL,P,VN,P *); void subum(int,UM,UM,UM); void subvect(VL,VECT,VECT,VECT *); +void subquote(VL,QUOTE,QUOTE,QUOTE *); void toreim(Num,Num *,Num *); void ucsump(P,Q *); void udivpwm(Q,P,P,P *,P *);