=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/include/ca.h,v retrieving revision 1.58 retrieving revision 1.72 diff -u -p -r1.58 -r1.72 --- OpenXM_contrib2/asir2000/include/ca.h 2005/10/31 10:03:48 1.58 +++ OpenXM_contrib2/asir2000/include/ca.h 2008/08/11 16:58:30 1.72 @@ -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.57 2005/08/02 07:16:42 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/include/ca.h,v 1.71 2008/08/11 16:51:30 ohara Exp $ */ #include #include @@ -93,6 +93,8 @@ typedef void * pointer; #endif #endif +#define TODO printf("%s: not implemented!\n", __func__) + #define COPY(a,b) ((b)=(a)) #define FREEN(p) #define FREEQ(p) @@ -128,6 +130,7 @@ typedef void * pointer; /* IMAT */ #define O_IMAT 24 /* IMAT */ +#define O_NBP 25 #define N_Q 0 #define N_R 1 @@ -407,8 +410,7 @@ typedef struct oBYTEARRAY { typedef struct oQUOTE { short id; - char normalized; - char expanded; + short pad; pointer body; } *QUOTE; @@ -445,6 +447,30 @@ typedef struct oTB { char **body; } *TB; +typedef struct oNBP { + short id; + short pad; + struct oNODE *body; +} *NBP; + +/* non-commutative bivariate monomial */ + +typedef struct oNBM { + int d; + P c; + unsigned int *b; +} *NBM; + +#define NEWNBM(p) ((p)=(NBM)MALLOC(sizeof(struct oNBM))) +#define NEWNBMBDY(p,d) \ +((p)->b=(unsigned int *)MALLOC((((d)+31)/32)*sizeof(unsigned int))) +#define NEWNBP(p) ((p)=(NBP)MALLOC(sizeof(struct oNBP)),OID(p)=O_NBP) +#define MKNBP(p,b) (NEWNBP(p),BDY(p)=(b)) + +#define NBM_GET(a,j) (((a)[(j)>>5]&(1<<((j)&31)))?1:0) +#define NBM_SET(a,j) ((a)[(j)>>5]|=(1<<((j)&31))) +#define NBM_CLR(a,j) ((a)[(j)>>5]&=(~(1<<((j)&31)))) + typedef struct oObj { short id; short pad; @@ -861,7 +887,7 @@ DEG(DC(p))=ONE,COEF(DC(p))=(P)ONEM,NEXT(DC(p))=0) #define MKERR(e,b) (NEWERR(e),(e)->body=(Obj)(b)) #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))) +(NEWBYTEARRAY(m),(m)->len=(l),(m)->body=(unsigned char *)MALLOC_ATOMIC((l)),bzero((m)->body,(l))) #define MKQUOTE(q,b) (NEWQUOTE(q),(q)->body=(pointer)(b)) #define MKQUOTEARG(q,t,b) (NEWQUOTEARG(q),(q)->type=(t),(q)->body=(pointer)(b)) @@ -914,7 +940,7 @@ PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q) #define MKReal(a,b) (!(a)?((b)=0):(NEWReal(b),BDY(b)=(a),(b))) #define MKAlg(b,r) \ (!(b)?((r)=0):NUM(b)?((r)=(Alg)(b)):(NEWAlg(r),BDY(r)=(Obj)(b),(r))) -#define MKDAlg(dp,den,r) (NEWDAlg(r),(r)->nm = (dp),(r)->dn=(den)) +#define MKDAlg(dp,den,r) (!(dp)?(void *)((r)=0):(void *)(NEWDAlg(r),(r)->nm = (dp),(r)->dn=(den))) #define IMM_MAX 1073741823 #define IMM_MIN -1073741823 @@ -932,6 +958,7 @@ PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q) #define NUM(p) (OID(p)==O_N) #define RAT(p) (OID(p)==O_R) #define RATN(a) (NID(a)==N_Q) +#define POLY(a) (!(a) ||(OID(a)<=O_P)) #define INT(q) (!(q)||(NUM(q)&&RATN((Num)q)&&!DN((Q)q))) #define REAL(a) (NID(a)==N_R) #define BIGFLOAT(a) (NID(a)==N_B) @@ -1294,7 +1321,7 @@ void copyn(N,int,int *); void kmulnmain(N,N,N *); int qcoefp(Obj); int qcoefr(Obj); -int get_allocwords(void); +long get_allocwords(void); double get_clock(void); void get_eg(struct oEGT *); void printtime(struct oEGT *,struct oEGT *,double); @@ -2448,7 +2475,7 @@ void resume_timer() ; void reset_engine() ; unsigned int get_asir_version() ; char *get_asir_distribution(); -void create_error(ERR *err,unsigned int serial,char *msg); +void create_error(ERR *err,unsigned int serial,char *msg,LIST trace); void init_lprime(); int get_lprime(int index); void create_new_lprimes(int index); @@ -2607,4 +2634,16 @@ int remzi(Z n,int m); void bzero(const void *,int); void bcopy(const void *,void *,int); char *index(char *,int); +#endif + +void chsgnnbp(NBP p,NBP *rp); +void subnbp(VL vl,NBP p1,NBP p2, NBP *rp); +void addnbp(VL vl,NBP p1,NBP p2, NBP *rp); +void mulnbp(VL vl,NBP p1,NBP p2, NBP *rp); +void pwrnbp(VL vl,NBP p1,Q n, NBP *rp); +int compnbp(VL vl,NBP p1,NBP p2); + +#if defined(PARI23) +#define prec precreal +#define mppgcd(a,b) (gcdii((a),(b))) #endif