=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/include/ca.h,v retrieving revision 1.94 retrieving revision 1.108 diff -u -p -r1.94 -r1.108 --- OpenXM_contrib2/asir2000/include/ca.h 2015/08/20 08:42:07 1.94 +++ OpenXM_contrib2/asir2000/include/ca.h 2020/10/04 03:14:08 1.108 @@ -45,12 +45,13 @@ * 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.93 2015/08/14 13:51:55 fujimoto Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/include/ca.h,v 1.107 2018/09/04 07:03:38 noro Exp $ */ #include #include #include #include +#include /* from mpfr-impl.h */ #define MPFR_PREC(x) ((x)->_mpfr_prec) @@ -59,6 +60,10 @@ #define MPFR_LAST_LIMB(x) ((MPFR_PREC (x) - 1) / GMP_NUMB_BITS) #define MPFR_LIMB_SIZE(x) (MPFR_LAST_LIMB (x) + 1) +#define RAT_CEIL(nm,dn) (((nm)+(dn)-1)/((dn))) +#define MPFR_LIMB_SIZE_REAL(x) (RAT_CEIL(MPFR_PREC((x)),sizeof(mp_limb_t)*CHAR_BIT) * (sizeof(mp_limb_t)/sizeof(int)) ) +#define MPFR_LIMB_SIZE_BODY(x) (RAT_CEIL(MPFR_PREC((x)),sizeof(unsigned int)*CHAR_BIT)) + #if defined(hpux) #include # define setbuffer(FP,buf,siz) setvbuf(FP,buf,_IOFBF,siz) @@ -103,7 +108,7 @@ typedef void * pointer; #define NULLP ((void *)0) -#define TODO printf("%s: not implemented!\n", __func__) +#define TODO printf("%s: not implemented!\n", __func__) #define COPY(a,b) ((b)=(a)) #define FREEN(p) @@ -141,6 +146,7 @@ typedef void * pointer; #define O_IMAT 24 /* IMAT */ #define O_NBP 25 +#define O_DPM 26 #define N_Q 0 #define N_R 1 @@ -148,12 +154,12 @@ typedef void * pointer; #define N_B 3 #define N_NEXT_B (N_B) #if defined(INTERVAL) -#define N_Quad (N_NEXT_B+1) -#define N_IP (N_NEXT_B+2) -#define N_IntervalDouble (N_NEXT_B+3) -#define N_IntervalQuad (N_NEXT_B+4) -#define N_IntervalBigFloat (N_NEXT_B+5) -#define N_PRE_C N_IntervalBigFloat +#define N_Quad (N_NEXT_B+1) +#define N_IP (N_NEXT_B+2) +#define N_IntervalDouble (N_NEXT_B+3) +#define N_IntervalQuad (N_NEXT_B+4) +#define N_IntervalBigFloat (N_NEXT_B+5) +#define N_PRE_C N_IntervalBigFloat #define N_BASE (N_NEXT_B+5) #else #define N_BASE N_NEXT_B @@ -175,7 +181,7 @@ typedef void * pointer; #define ORD_LEX 2 typedef enum { - A_end=0,A_fnode,A_arf,A_int,A_str,A_internal,A_node,A_notimpl,A_func + A_end=0,A_fnode,A_arf,A_int,A_str,A_internal,A_node,A_notimpl,A_func } farg_type; #if SIZEOF_LONG == 8 @@ -189,312 +195,320 @@ typedef _int64 L; typedef unsigned _int64 UL; #endif +#if defined(__GNUC__) && SIZEOF_LONG == 8 +typedef __uint64_t U64; +typedef __uint128_t U128; +typedef __int64_t L64; +typedef __int128_t L128; +#endif + typedef struct oN { - int p; - unsigned int b[1]; + int p; + unsigned int b[1]; } *N; typedef struct oZ { - int p; - unsigned int b[1]; + int p; + unsigned int b[1]; } *Z; typedef struct oUP2 { - int w; - unsigned int b[1]; + int w; + unsigned int b[1]; } *UP2; typedef struct _oUP2 { - int w; - unsigned int *b; + int w; + unsigned int *b; } *_UP2; #define UP2_DENSE 0 #define UP2_SPARSE 1 typedef struct oGEN_UP2 { - int id; - UP2 dense; - UP2 sparse; + int id; + UP2 dense; + UP2 sparse; } *GEN_UP2; typedef struct oV { - char *name; - pointer attr; - pointer priv; + char *name; + pointer attr; + pointer priv; } *V; typedef struct oQ { - short id; - char nid; - char sgn; - N nm; - N dn; + short id; + char nid; + char sgn; + N nm; + N dn; } *Q; typedef struct oReal { - short id; - char nid; - char pad; - double body; + short id; + char nid; + char pad; + double body; } *Real; typedef struct oAlg { - short id; - char nid; - char pad; - struct oObj *body; + short id; + char nid; + char pad; + struct oObj *body; } *Alg; typedef struct oBF { - short id; - char nid; - char pad; - mpfr_t body; + short id; + char nid; + char pad; + mpfr_t body; } *BF; typedef struct oC { - short id; - char nid; - char pad; - struct oNum *r,*i; + short id; + char nid; + char pad; + struct oNum *r,*i; } *C; typedef struct oLM { - short id; - char nid; - char pad; - struct oN *body; + short id; + char nid; + char pad; + struct oN *body; } *LM; typedef struct oGF2N { - short id; - char nid; - char pad; - struct oUP2 *body; + short id; + char nid; + char pad; + struct oUP2 *body; } *GF2N; typedef struct oGFPN { - short id; - char nid; - char pad; - struct oUP *body; + short id; + char nid; + char pad; + struct oUP *body; } *GFPN; typedef struct oDAlg { - short id; - char nid; - char pad; - struct oDP *nm; - struct oQ *dn; + short id; + char nid; + char pad; + struct oDP *nm; + struct oQ *dn; } *DAlg; typedef struct oGZ { - short id; - char nid; - char pad; - mpz_t body; + short id; + char nid; + char pad; + mpz_t body; } *GZ; typedef struct oGQ { - short id; - char nid; - char pad; - mpq_t body; + short id; + char nid; + char pad; + mpq_t body; } *GQ; typedef struct oNum { - short id; - char nid; - char pad; + short id; + char nid; + char pad; } *Num; typedef struct oMQ { - short id; - char nid; - char pad; - int cont; + short id; + char nid; + char pad; + int cont; } *MQ; typedef struct oGFS { - short id; - char nid; - char pad; - int cont; + short id; + char nid; + char pad; + int cont; } *GFS; typedef struct oGFSN { - short id; - char nid; - char pad; - struct oUM *body; + short id; + char nid; + char pad; + struct oUM *body; } *GFSN; typedef struct oP { - short id; - short pad; - V v; - struct oDCP *dc; + short id; + short pad; + V v; + struct oDCP *dc; } *P; typedef struct oR { - short id; - short reduced; - P nm; - P dn; + short id; + short reduced; + P nm; + P dn; } *R; typedef struct oVECT { - short id; - short pad; - int len; - pointer *body; + short id; + short pad; + int len; + pointer *body; } *VECT; typedef struct oMAT { - short id; - short pad; - int row,col; - pointer **body; + short id; + short pad; + int row,col; + pointer **body; } *MAT; typedef struct oGF2MAT { - short id; - short pad; - int row,col; - unsigned int **body; + short id; + short pad; + int row,col; + unsigned int **body; } *GF2MAT, *GFMMAT; /* IMAT */ #define IMATCH 64 typedef struct oIENT { - int cr; - int row, col; - pointer *body; + int cr; + int row, col; + pointer *body; } IENT; typedef struct oIMATC { - pointer *fore; - pointer *next; - IENT ient[IMATCH]; + pointer *fore; + pointer *next; + IENT ient[IMATCH]; } *IMATC; typedef struct oIMAT { - short id; - int row, col, clen; - pointer *root; - pointer *toor; + short id; + int row, col, clen; + pointer *root; + pointer *toor; } *IMAT; /* IMAT */ typedef struct oLIST { - short id; - short pad; - struct oNODE *body; + short id; + short pad; + struct oNODE *body; } *LIST; typedef struct oSTRING { - short id; - short pad; - char *body; + short id; + short pad; + char *body; } *STRING; typedef struct oCOMP { - short id; - short type; - struct oObj *member[1]; + short id; + short type; + struct oObj *member[1]; } *COMP; typedef struct oDP { - short id; - short nv; - int sugar; - struct oMP *body; + short id; + short nv; + int sugar; + struct oMP *body; } *DP; typedef struct oDPV { - short id; - int len; - int sugar; - struct oDP **body; + short id; + int len; + int sugar; + struct oDP **body; } *DPV; + typedef struct oUSINT { - short id; - short pad; - unsigned body; + short id; + short pad; + unsigned body; } *USINT; typedef struct oERR { - short id; - short pad; - struct oObj *body; + short id; + short pad; + struct oObj *body; } *ERR; typedef struct oMATHCAP { - short id; - short pad; - struct oLIST *body; + short id; + short pad; + struct oLIST *body; } *MATHCAP; typedef struct oBYTEARRAY { - short id; - short pad; - int len; - unsigned char *body; + short id; + short pad; + int len; + unsigned char *body; } *BYTEARRAY; typedef struct oQUOTE { - short id; - short pad; - pointer body; + short id; + short pad; + pointer body; } *QUOTE; typedef struct oQUOTEARG { - short id; - short pad; - farg_type type; - pointer body; + short id; + short pad; + farg_type type; + pointer body; } *QUOTEARG; typedef struct oOPTLIST { - short id; - short pad; - struct oNODE *body; + short id; + short pad; + struct oNODE *body; } *OPTLIST; typedef struct oSYMBOL { - short id; - short pad; - char *name; - int value; + short id; + short pad; + char *name; + int value; } *SYMBOL; typedef struct oRANGE { - short id; - short pad; - struct oObj *start,*end; + short id; + short pad; + struct oObj *start,*end; } *RANGE; typedef struct oTB { - short id; - short pad; - int size,next; - char **body; + short id; + short pad; + int size,next; + char **body; } *TB; typedef struct oNBP { - short id; - short pad; - struct oNODE *body; + short id; + short pad; + struct oNODE *body; } *NBP; /* non-commutative bivariate monomial */ typedef struct oNBM { - int d; - P c; - unsigned int *b; + int d; + P c; + unsigned int *b; } *NBM; #define NEWNBM(p) ((p)=(NBM)MALLOC(sizeof(struct oNBM))) @@ -508,45 +522,59 @@ typedef struct oNBM { #define NBM_CLR(a,j) ((a)[(j)>>5]&=(~(1<<((j)&31)))) typedef struct oObj { - short id; - short pad; + short id; + short pad; } *Obj; typedef struct oDCP { - Q d; - P c; - struct oDCP *next; + Q d; + P c; + struct oDCP *next; } *DCP; typedef struct oMP { - struct oDL *dl; - P c; - struct oMP *next; + struct oDL *dl; + Obj c; + struct oMP *next; } *MP; +typedef struct oDPM { + short id; + short nv; + int sugar; + struct oDMM *body; +} *DPM; + +typedef struct oDMM { + int pos; + struct oDL *dl; + Obj c; + struct oDMM *next; +} *DMM; + typedef struct oDL { - int td; - int d[1]; + int td; + int d[1]; } *DL; struct dp_pairs { - int dp1, dp2; - DL lcm; - int sugar; - struct dp_pairs *next; + int dp1, dp2; + DL lcm; + int sugar; + struct dp_pairs *next; }; typedef struct dp_pairs *DP_pairs; struct p_pair { - struct oUM *p0; - struct oUM *p1; - struct p_pair *next; + struct oUM *p0; + struct oUM *p1; + struct p_pair *next; }; struct oMF { - int m; - P f; + int m; + P f; }; /* @@ -554,91 +582,91 @@ struct oMF { */ typedef struct oCDP { - int len; - int psindex; - unsigned int *body; + int len; + int psindex; + unsigned int *body; } *CDP; typedef struct oCM { - int index; - int c; + int index; + int c; } *CM; /* bucket list for DL */ typedef struct oDLBUCKET { - int td; - struct oNODE *body; - struct oDLBUCKET *next; + int td; + struct oNODE *body; + struct oDLBUCKET *next; } *DLBUCKET; typedef struct oGeoBucket { - int m; - struct oNODE *body[32]; + int m; + struct oNODE *body[32]; } *GeoBucket; typedef struct oVL { - V v; - struct oVL *next; + V v; + struct oVL *next; } *VL; typedef struct oNODE { - pointer body; - struct oNODE *next; + pointer body; + struct oNODE *next; } *NODE; /* univariate poly over small finite field; dense */ typedef struct oUM { - int d; - int c[1]; + int d; + int c[1]; } *UM; /* univariate poly with padic coeff */ typedef struct oLUM { - int d; - int *c[1]; + int d; + int *c[1]; } *LUM; /* bivariate poly over small finite field; dense */ typedef struct oBM { - int d; - UM c[1]; + int d; + UM c[1]; } *BM; typedef struct oML { - int n; - int mod; - int bound; - pointer c[1]; + int n; + int mod; + int bound; + pointer c[1]; } *ML; typedef struct oUB { - int d; - N c[1]; + int d; + N c[1]; } *UB; typedef struct oVN { - V v; - int n; + V v; + int n; } *VN; typedef struct oUP { - int d; - Num c[1]; + int d; + Num c[1]; } *UP; typedef struct oDUM { - int n; - UM f; + int n; + UM f; } *DUM; struct order_pair { - int order, length; + int order, length; }; struct sparse_weight { - int pos, value; + int pos, value; }; #define IS_DENSE_WEIGHT 0 @@ -646,65 +674,68 @@ struct sparse_weight { #define IS_BLOCK 2 struct weight_or_block { - int type; - int length; - union { - int *dense_weight; - struct sparse_weight *sparse_weight; - struct { - int order, start; - } block; - } body; + int type; + int length; + union { + int *dense_weight; + struct sparse_weight *sparse_weight; + struct { + int order, start; + } block; + } body; }; struct order_spec { - int id; - Obj obj; - int nv; - int ispot; /* 1 means Position over Term (Pos then Term) */ - int pot_nelim; /* size of positions for pot-elimination order */ - union { - int simple; - struct { - int length; - struct order_pair *order_pair; - } block; - struct { - int row; - int **matrix; - } matrix; - struct { - int length; - struct weight_or_block *w_or_b; - } composite; - } ord; + int id; + Obj obj; + int nv; + int ispot; /* 1 means Position over Term (Pos then Term) */ + int pot_nelim; /* size of positions for pot-elimination order */ + int *top_weight; + int module_rank; + int *module_top_weight; + union { + int simple; + struct { + int length; + struct order_pair *order_pair; + } block; + struct { + int row; + int **matrix; + } matrix; + struct { + int length; + struct weight_or_block *w_or_b; + } composite; + } ord; }; struct modorder_spec { - /* id : ORD_REVGRADLEX, ORD_GRADLEX, ORD_LEX */ - int id; - Obj obj; - int len; - int *degree_shift; + /* id : ORD_REVGRADLEX, ORD_GRADLEX, ORD_LEX */ + int id; + Obj obj; + int len; + int *degree_shift; }; typedef struct oNumberField { - int n; - int psn; - int dim; - VL vl; - P *defpoly; - DP *mb; - DP *ps; - struct oDAlg *one; - NODE ind; - struct order_spec *spec; + int n; + int psn; + int dim; + VL vl; + P *defpoly; + DP *mb; + DP *ps; + struct oDAlg *one; + NODE ind; + struct order_spec *spec; } *NumberField; /* structure for cputime */ struct oEGT { - double exectime,gctime; + double exectime,gctime; }; /* constant */ @@ -772,14 +803,27 @@ typedef unsigned int ModNum; #define GCFREE(p) Risa_GC_free(p) #define CALLOC(d,e) MALLOC((d)*(e)) +#if 0 #if !defined(__CYGWIN__) && (defined(__GNUC__) || defined(vax) || defined(apollo) || defined(alloca) || defined(VISUAL) || defined(__MINGW32__)) #define ALLOCA(d) alloca(d) #else #define ALLOCA(d) MALLOC(d) #endif +#endif +#define ALLOCA(d) MALLOC(d) + +/* for handling signals */ +#if defined(HAVE_SIGACTION) /* POSIX */ +void (*set_signal(int sig, void (*handler)(int)))(int); +#define set_signal_for_restart(x,y) (0) +#else +#define set_signal(x,y) (signal(x,y)) +#define set_signal_for_restart(x,y) (signal(x,y)) +#endif + /* for setjmp/longjmp compatibility */ -#if defined(__CYGWIN__) || (defined(__x86_64) && !defined(__MINGW32__)) +#if defined(__CYGWIN__) || defined(HAVE_SIGACTION) || (defined(__x86_64) && !defined(__MINGW32__)) #define JMP_BUF sigjmp_buf #define SETJMP(x) sigsetjmp(x,~0) #define LONGJMP(x,y) siglongjmp(x,y) @@ -805,30 +849,30 @@ bzero((char *)(p),(int)(((n)+1)*sizeof(type)))) #define W_MLALLOC(d) ((ML)ALLOCA(TRUESIZE(oML,d,pointer))) #define W_LUMALLOC(n,bound,p)\ {\ - LUM ___q___;\ - int ___i___,**___c___;\ - (___q___) = (LUM)ALLOCA(TRUESIZE(oLUM,(n),int *));\ - DEG(___q___) = n;\ - for ( ___i___ = 0, ___c___ = (int **)COEF(___q___); ___i___ <= n; ___i___++ ) {\ - ___c___[___i___] = (int *)ALLOCA(((bound)+1)*sizeof(int));\ - bzero((char *)___c___[___i___],((bound)+1)*sizeof(int));\ - }\ - (p) = ___q___;\ + LUM ___q___;\ + int ___i___,**___c___;\ + (___q___) = (LUM)ALLOCA(TRUESIZE(oLUM,(n),int *));\ + DEG(___q___) = n;\ + for ( ___i___ = 0, ___c___ = (int **)COEF(___q___); ___i___ <= n; ___i___++ ) {\ + ___c___[___i___] = (int *)ALLOCA(((bound)+1)*sizeof(int));\ + bzero((char *)___c___[___i___],((bound)+1)*sizeof(int));\ + }\ + (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___;\ + 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)\ @@ -855,6 +899,7 @@ bzero((char *)(q)->b,(w)*sizeof(unsigned int))) #define NEWCOMP(c,n) ((c)=(COMP)MALLOC(sizeof(struct oCOMP)+((n)-1)*sizeof(Obj)),OID(c)=O_COMP) #define NEWDP(d) ((d)=(DP)MALLOC(sizeof(struct oDP)),OID(d)=O_DP) #define NEWDPV(d) ((d)=(DPV)MALLOC(sizeof(struct oDPV)),OID(d)=O_DPV) +#define NEWDPM(d) ((d)=(DPM)MALLOC(sizeof(struct oDPM)),OID(d)=O_DPM) #define NEWUSINT(u) ((u)=(USINT)MALLOC_ATOMIC(sizeof(struct oUSINT)),OID(u)=O_USINT) #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) @@ -871,6 +916,7 @@ bzero((char *)(q)->b,(w)*sizeof(unsigned int))) #define NEWV(v) ((v)=(V)MALLOC(sizeof(struct oV))) #define NEWVL(vl) ((vl)=(VL)MALLOC(sizeof(struct oVL))) #define NEWMP(m) ((m)=(MP)MALLOC(sizeof(struct oMP))) +#define NEWDMM(m) ((m)=(DMM)MALLOC(sizeof(struct oDMM))) #define NEWDLBUCKET(a) ((a)=(DLBUCKET)MALLOC(sizeof(struct oDLBUCKET))) #define NEWDPP(a) ((a)=(DP_pairs)MALLOC(sizeof(struct dp_pairs))) @@ -917,6 +963,7 @@ DEG(DC(p))=ONE,COEF(DC(p))=(P)ONEM,NEXT(DC(p))=0) #define MKSTR(a,b) (NEWSTR(a),(a)->body=(char *)(b)) #define MKDP(n,m,d) (NEWDP(d),(d)->nv=(n),BDY(d)=(m)) #define MKDPV(len,m,d) (NEWDPV(d),(d)->len=(len),BDY(d)=(m)) +#define MKDPM(n,m,d) (NEWDPM(d),(d)->nv=(n),BDY(d)=(m)) #define MKLM(b,l) (!(b)?(l)=0:(NEWLM(l),(l)->body=(b),(l))) #define MKGF2N(b,l) (!(b)?(l)=0:(NEWGF2N(l),(l)->body=(b),(l))) #define MKGFPN(b,l) (!(b)?(l)=0:(NEWGFPN(l),(l)->body=(b),(l))) @@ -942,6 +989,8 @@ if(!(r)){NEWDLBUCKET(r);(c)=(r);}else{NEWDLBUCKET(NEXT if(!(r)){NEWVL(r);(c)=(r);}else{NEWVL(NEXT(c));(c)=NEXT(c);} #define NEXTDPP(r,c) \ if(!(r)){NEWDPP(r);(c)=(r);}else{NEWDPP(NEXT(c));(c)=NEXT(c);} +#define NEXTDMM(r,c) \ +if(!(r)){NEWDMM(r);(c)=(r);}else{NEWDMM(NEXT(c));(c)=NEXT(c);} /* convertors */ #define NTOQ(n,s,q) \ @@ -1000,6 +1049,7 @@ PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q) #define UNIMQ(q) ((q)&&NUM(q)&&SFF(q)&&(CONT((MQ)q)==1)) #define MUNIQ(q) ((q)&&NUM(q)&&RATN(q)&&(SGN((Q)q)==-1)&&UNIN(NM((Q)q))&&(!DN((Q)q))) #define MUNIMQ(q) ((q)&&NUM(q)&&SFF(q)&&(CONT((MQ)q)==-1)) +#define UNILM(n) ((n)&&UNIN(BDY(n))) #define UNIN(n) ((n)&&(PL(n)==1)&&(BD(n)[0]==1)) #define EVENN(n) ((!(n))||(!(BD(n)[0]%2))) @@ -1021,13 +1071,13 @@ PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q) #define FTOIF(i) ((int)(((unsigned int)(i)|0x80000000))) struct cdl { - P c; - DL d; + Obj c; + DL d; }; struct cdlm { - int c; - DL d; + int c; + DL d; }; extern MP _mp_free_list; @@ -1067,7 +1117,7 @@ extern struct oV oVAR[]; extern struct oV oPVAR[]; extern struct oVL oVLIST[]; extern struct oVL oPVLIST[]; -extern VL CO,ALG; +extern VL CO,ALG,LASTCO; extern VL PVL; extern R ONER; extern Q ONE; @@ -1129,71 +1179,6 @@ void hybrid_mulup(int,UP,UP,UP *); void getmod_lm(N *); -int maxblenup(UP); -void monicup(UP,UP *); -void simpup(UP,UP *); -void simpnum(Num,Num *); -void decompp(P,Q,P *,P *); -void truncp(P,Q,P *); -void uremp(P,P,P *); -void ugcdp(P,P,P *); -void reversep(P,Q,P *); -void invmodp(P,Q,P *); -void addup(UP,UP,UP *); -void subup(UP,UP,UP *); -void chsgnup(UP,UP *); -void mulup(UP,UP,UP *); -void tmulup(UP,UP,int,UP *); -void squareup(UP,UP *); -void remup(UP,UP,UP *); -void remup_destructive(UP,UP); -void qrup(UP,UP,UP *,UP *); -void qrup_destructive(UP,UP); -void gcdup(UP,UP,UP *); -void reverseup(UP,int,UP *); -void invmodup(UP,int,UP *); -void pwrup(UP,Q,UP *); -void squarep_gf2n(VL,P,P *); -void kmulp(VL,P,P,P *); -void ksquarep(VL,P,P *); -void kmulup(UP,UP,UP *); -void ksquareup(UP,UP *); -void extractup(UP,int,int,UP *); -void copyup(UP,UP); -void c_copyup(UP,int,pointer *); -void kmulupmain(UP,UP,UP *); -void ksquareupmain(UP,UP *); -void rembymulup(UP,UP,UP *); -void rembymulup_special(UP,UP,UP,UP *); -void tkmulup(UP,UP,int,UP *); -void shiftup(UP,int,UP *); -void set_degreeup(UP,int); -void decompup(UP,int,UP *,UP *); -void truncup(UP,int,UP *); -void uptofmarray(int,UP,ModNum *); -void fmarraytoup(ModNum *,int,UP *); -void uiarraytoup(unsigned int **,int,int,UP *); -void adj_coefup(UP,N,N,UP *); -void uptolmup(UP,UP *); -void remcup(UP,N,UP *); -void fft_mulup(UP,UP,UP *); -void fft_squareup(UP,UP *); -void trunc_fft_mulup(UP,UP,int,UP *); -void shoup_fft_mulup(UP,UP,UP *); -void shoup_fft_squareup(UP,UP *); -void shoup_trunc_fft_mulup(UP,UP,int,UP *); -void crup(ModNum **,int,int *,int,N,UP *); -void shoup_crup(ModNum **,int,int *,int,N,N,UP *); -void squareup_gf2n(UP,UP *); -void powermodup_gf2n(UP,UP *); -void generic_powermodup_gf2n(UP,UP,Q,UP *); -void tracemodup_gf2n(UP,UP,Q,UP *); -void tracemodup_gf2n_slow(UP,UP,Q,UP *); -void tracemodup_gf2n_tab(UP,UP,Q,UP *); -void square_rem_tab_up_gf2n(UP,UP *,UP *); -void powertabup_gf2n(UP,UP,UP *); -void find_root_gf2n(UP,GF2N *); - int cmpdl_composite(int,DL,DL); int cmpdl_matrix(int,DL,DL); int cmpdl_order_pair(int,DL,DL); @@ -1208,20 +1193,6 @@ int cmpdl_revgradlex(int,DL,DL); int cmpdl_gradlex(int,DL,DL); int cmpdl_revlex(int,DL,DL); int cmpdl_lex(int,DL,DL); -int compd(VL,DP,DP); -void adddl(int,DL,DL,DL *); -void divsdc(VL,DP,P,DP *); -void muldc(VL,DP,P,DP *); -void muldm(VL,DP,MP,DP *); -void muld(VL,DP,DP,DP *); -void chsgnd(DP,DP *); -void subd(VL,DP,DP,DP *); -void addd(VL,DP,DP,DP *); -int sugard(MP); -void nodetod(NODE,DP *); -void dtop(VL,VL,DP,P *); -void ptod(VL,VL,P,DP *); -void initd(struct order_spec *); void adddv(VL,DPV,DPV,DPV *); void subdv(VL,DPV,DPV,DPV *); @@ -1229,6 +1200,12 @@ void muldv(VL,DP,DPV,DPV *); void chsgndv(DPV,DPV *); int compdv(VL,DPV,DPV); +void adddpm(VL,DPM,DPM,DPM *); +void subdpm(VL,DPM,DPM,DPM *); +void mulobjdpm(VL,Obj,DPM,DPM *); +void chsgndpm(DPM,DPM *); +int compdpm(VL,DPM,DPM); + void _printdp(DP); void _dp_sp_mod(DP,DP,int,DP *); void _dp_mod(DP,int,NODE,DP *); @@ -1269,9 +1246,9 @@ void gcdEuclidn(N,N,N *); void GC_free(void *); void FFT_primes(int,int *,int *,int *); int FFT_pol_product(unsigned int,unsigned int *, unsigned int,unsigned int *, - unsigned int *,int,unsigned int *); + unsigned int *,int,unsigned int *); int FFT_pol_square(unsigned int,unsigned int *, - unsigned int *,int,unsigned int *); + unsigned int *,int,unsigned int *); void dcptolist(DCP,LIST *); void gcdprsmp(VL,int,P,P,P *); void mult_mod_tab(UM,int,UM *,UM,int); @@ -1813,7 +1790,7 @@ void pwrreal(Num,Num,Real *); void pwrmi(MQ,Q,MQ *); void pwrlm(LM,Q,LM *); void pwrum(int,UM,int,UM); -void reallocarray(char **,int *,int *,int); +void asir_reallocarray(char **,int *,int *,int); void reductr(VL,Obj,Obj *); void reimtocplx(Num,Num,Num *); void rem2q(Q,Q,Q,Q *); @@ -2126,7 +2103,7 @@ void sfbsqfr(P f,V x,V y,DCP *dcp); void sfbfctr(P f,V x,V y,int degbound,DCP *dcp); void sfdtest(P f,ML list,V x,V y,DCP *dcp); int sfdtestmain(VL vl,P lcg,UM lcg0,BM lcy,P csum,ML list, - int k,int *in,P *fp,P *cofp); + int k,int *in,P *fp,P *cofp); void const_term(P f,UM c); void const_term_sfbm(BM f,UM c); int sfctest(UM lcg0,BM lcy,ML list,int k,int *in); @@ -2171,7 +2148,7 @@ int has_fcoef(DP f); int has_fcoef_p(P f); void initd(struct order_spec *spec); void ptod(VL vl,VL dvl,P p,DP *pr); -void dtop(VL vl,VL dvl,DP p,P *pr); +void dtop(VL vl,VL dvl,DP p,Obj *pr); void nodetod(NODE node,DP *dp); int sugard(MP m); void addd(VL vl,DP p1,DP p2,DP *pr); @@ -2187,8 +2164,9 @@ void weyl_muld(VL vl,DP p1,DP p2,DP *pr); void weyl_muldm(VL vl,MP m0,DP p,DP *pr); void weyl_mulmm(VL vl,MP m0,MP m1,int n,struct cdl *rtab,int rtablen); void comm_muld_tab(VL vl,int nv,struct cdl *t,int n,struct cdl *t1,int n1,struct cdl *rt); -void muldc(VL vl,DP p,P c,DP *pr); +void muldc(VL vl,DP p,Obj c,DP *pr); void divsdc(VL vl,DP p,P c,DP *pr); +void divdc(VL vl,DP p,Obj c,DP *pr); void adddl(int n,DL d1,DL d2,DL *dr); void adddl_destructive(int n,DL d1,DL d2); int compd(VL vl,DP p1,DP p2); @@ -2688,7 +2666,7 @@ int compnbp(VL vl,NBP p1,NBP p2); #define MPQTOGQ(g,q) \ (!mpq_sgn(g)?((q)=0):(NEWGQ(q),BDY(q)[0]=(g)[0],(q))) -#define INTMPQ(a) (!mpz_cmp_ui(mpq_numref(a),1)) +#define INTMPQ(a) (!mpz_cmp_ui(mpq_denref(a),1)) #define UNIGZ(a) ((a)&&NID(a)==N_GZ&&!mpz_cmp_ui(BDY(a),1)) #define MUNIGZ(a) ((a)&&NID(a)==N_GZ&&!mpz_cmp_si(BDY(a),-1)) @@ -2849,3 +2827,15 @@ int poly_is_dependent(P p,V v); int setsecureflag(char *name,int value); int sfdegtest(int dy,int bound,UM *d1c,int k,int *in); int sgnz(Z n); + +#if defined(VISUAL) || defined(__MINGW32__) +void check_intr(); +void enter_signal_cs(); +void leave_signal_cs(); +void leave_signal_cs_all(); +#define LEAVE_SIGNAL_CS_ALL leave_signal_cs_all() +#else +#define LEAVE_SIGNAL_CS_ALL +#endif + +int equalr(VL,Obj,Obj);