[BACK]Return to ca.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / include

Diff for /OpenXM_contrib2/asir2000/include/ca.h between version 1.58 and 1.86

version 1.58, 2005/10/31 10:03:48 version 1.86, 2014/01/07 06:22:08
Line 45 
Line 45 
  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,   * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.   * 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.85 2013/12/20 02:02:24 noro Exp $
 */  */
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
   #include <gmp.h>
   
 #if defined(hpux)  #if defined(hpux)
 #include <netinet/in.h>  #include <netinet/in.h>
Line 57 
Line 58 
   
 #if !defined(VISUAL)  #if !defined(VISUAL)
 #include <unistd.h>  #include <unistd.h>
 #endif  
   
 #if !defined(VISUAL)  
 #include <sys/param.h>  #include <sys/param.h>
 #endif  #endif
   
Line 72 
Line 70 
 #endif  #endif
   
 #if defined(VISUAL)  #if defined(VISUAL)
   #include <limits.h>
 #include <malloc.h>  #include <malloc.h>
 #endif  #endif
   
Line 80 
Line 79 
 typedef caddr_t pointer;  typedef caddr_t pointer;
 #endif  #endif
   
   
 typedef void * pointer;  typedef void * pointer;
   
 #if defined(sun)  #if defined(sun)
Line 93  typedef void * pointer;
Line 93  typedef void * pointer;
 #endif  #endif
 #endif  #endif
   
   #define NULLP ((void *)0)
   
   #define TODO            printf("%s: not implemented!\n", __func__)
   
 #define COPY(a,b) ((b)=(a))  #define COPY(a,b) ((b)=(a))
 #define FREEN(p)  #define FREEN(p)
 #define FREEQ(p)  #define FREEQ(p)
Line 128  typedef void * pointer;
Line 132  typedef void * pointer;
 /* IMAT */  /* IMAT */
 #define O_IMAT 24  #define O_IMAT 24
 /* IMAT */  /* IMAT */
   #define O_NBP 25
   
 #define N_Q 0  #define N_Q 0
 #define N_R 1  #define N_R 1
 #define N_A 2  #define N_A 2
 #define N_B 3  #define N_B 3
 #define N_C 4  #define N_NEXT_B    (N_B)
 #define N_M 5  #if defined(INTERVAL)
 #define N_LM 6  #define N_Quad  (N_NEXT_B+1)
 #define N_GF2N 7  #define N_IP    (N_NEXT_B+2)
 #define N_GFPN 8  #define N_IntervalDouble        (N_NEXT_B+3)
 #define N_GFS 9  #define N_IntervalQuad  (N_NEXT_B+4)
 #define N_GFSN 10  #define N_IntervalBigFloat      (N_NEXT_B+5)
 #define N_DA 11  #define N_PRE_C N_IntervalBigFloat
   #define N_BASE (N_NEXT_B+5)
   #else
   #define N_BASE N_NEXT_B
   #endif
   #define N_C (N_BASE+1)
   #define N_M (N_BASE+2)
   #define N_LM (N_BASE+3)
   #define N_GF2N (N_BASE+4)
   #define N_GFPN (N_BASE+5)
   #define N_GFS (N_BASE+6)
   #define N_GFSN (N_BASE+7)
   #define N_DA (N_BASE+8)
   #define N_GZ (N_BASE+9)
   #define N_GQ (N_BASE+10)
   
 #define ORD_REVGRADLEX 0  #define ORD_REVGRADLEX 0
 #define ORD_GRADLEX 1  #define ORD_GRADLEX 1
Line 150  typedef enum {
Line 169  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;  } farg_type;
   
 #if defined(LONG_IS_32BIT)  #if SIZEOF_LONG == 8
 #if defined(VISUAL)  typedef long L;
 typedef _int64 L;  typedef unsigned long UL;
 typedef unsigned _int64 UL;  #elif defined(HAVE_UNSIGNED_LONG_LONG)
 #else  
 typedef long long L;  typedef long long L;
 typedef unsigned long long UL;  typedef unsigned long long UL;
   #elif defined(_MSC_VER)
   typedef _int64 L;
   typedef unsigned _int64 UL;
 #endif  #endif
 #else  
 typedef long L;  
 typedef unsigned long UL;  
 #endif  
   
 typedef struct oN {  typedef struct oN {
         int p;          int p;
Line 263  typedef struct oDAlg {
Line 280  typedef struct oDAlg {
         struct oQ *dn;          struct oQ *dn;
 } *DAlg;  } *DAlg;
   
   typedef struct oGZ {
           short id;
           char nid;
           char pad;
           mpz_t body;
   } *GZ;
   
   typedef struct oGQ {
           short id;
           char nid;
           char pad;
           mpq_t body;
   } *GQ;
   
 typedef struct oNum {  typedef struct oNum {
         short id;          short id;
         char nid;          char nid;
Line 407  typedef struct oBYTEARRAY {
Line 437  typedef struct oBYTEARRAY {
   
 typedef struct oQUOTE {  typedef struct oQUOTE {
         short id;          short id;
         char normalized;          short pad;
         char expanded;  
         pointer body;          pointer body;
 } *QUOTE;  } *QUOTE;
   
Line 445  typedef struct oTB {
Line 474  typedef struct oTB {
         char **body;          char **body;
 } *TB;  } *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 {  typedef struct oObj {
         short id;          short id;
         short pad;          short pad;
Line 599  struct order_spec {
Line 652  struct order_spec {
         int id;          int id;
         Obj obj;          Obj obj;
         int nv;          int nv;
           int ispot; /* 1 means Position over Term (Pos then Term) */
           int pot_nelim; /* size of positions for pot-elimination order */
         union {          union {
                 int simple;                  int simple;
                 struct {                  struct {
Line 701  typedef unsigned int ModNum;
Line 756  typedef unsigned int ModNum;
   
 /* memory allocators (W_... : uses alloca) */  /* memory allocators (W_... : uses alloca) */
   
 #if 0  
 #define MALLOC(d) Risa_GC_malloc(d)  #define MALLOC(d) Risa_GC_malloc(d)
 #define MALLOC_ATOMIC(d) Risa_GC_malloc_atomic(d)  #define MALLOC_ATOMIC(d) Risa_GC_malloc_atomic(d)
   #define MALLOC_ATOMIC_IGNORE_OFF_PAGE(d) Risa_GC_malloc_atomic_ignore_off_page(d)
 #define REALLOC(p,d) Risa_GC_realloc(p,d)  #define REALLOC(p,d) Risa_GC_realloc(p,d)
 #else  #define GCFREE(p) Risa_GC_free(p)
 #define MALLOC(d) GC_malloc(d)  
 #define MALLOC_ATOMIC(d) GC_malloc_atomic(d)  
 #define REALLOC(p,d) GC_realloc(p,d)  
 #endif  
 #define CALLOC(d,e) MALLOC((d)*(e))  #define CALLOC(d,e) MALLOC((d)*(e))
   
 #if !defined(__CYGWIN__) && (defined(__GNUC__) || defined(vax) || defined(apollo) || defined(alloca) || defined(VISUAL))  #if !defined(__CYGWIN__) && (defined(__GNUC__) || defined(vax) || defined(apollo) || defined(alloca) || defined(VISUAL))
Line 781  bzero((char *)(q)->b,(w)*sizeof(unsigned int)))
Line 832  bzero((char *)(q)->b,(w)*sizeof(unsigned int)))
 ((q).b=(unsigned int *)ALLOCA((w)*sizeof(unsigned int)))  ((q).b=(unsigned int *)ALLOCA((w)*sizeof(unsigned int)))
   
 /* cell allocators */  /* cell allocators */
   #define NEWGZ(q) ((q)=(GZ)MALLOC(sizeof(struct oGZ)),OID(q)=O_N,NID(q)=N_GZ)
   #define NEWGQ(q) ((q)=(GQ)MALLOC(sizeof(struct oGQ)),OID(q)=O_N,NID(q)=N_GQ)
 #define NEWQ(q) ((q)=(Q)MALLOC(sizeof(struct oQ)),OID(q)=O_N,NID(q)=N_Q)  #define NEWQ(q) ((q)=(Q)MALLOC(sizeof(struct oQ)),OID(q)=O_N,NID(q)=N_Q)
 #define NEWMQ(q) ((q)=(MQ)MALLOC_ATOMIC(sizeof(struct oMQ)),OID(q)=O_N,NID(q)=N_M)  #define NEWMQ(q) ((q)=(MQ)MALLOC_ATOMIC(sizeof(struct oMQ)),OID(q)=O_N,NID(q)=N_M)
 #define NEWGFS(q) ((q)=(GFS)MALLOC_ATOMIC(sizeof(struct oGFS)),OID(q)=O_N,NID(q)=N_GFS)  #define NEWGFS(q) ((q)=(GFS)MALLOC_ATOMIC(sizeof(struct oGFS)),OID(q)=O_N,NID(q)=N_GFS)
Line 861  DEG(DC(p))=ONE,COEF(DC(p))=(P)ONEM,NEXT(DC(p))=0)
Line 914  DEG(DC(p))=ONE,COEF(DC(p))=(P)ONEM,NEXT(DC(p))=0)
 #define MKERR(e,b) (NEWERR(e),(e)->body=(Obj)(b))  #define MKERR(e,b) (NEWERR(e),(e)->body=(Obj)(b))
 #define MKMATHCAP(e,b) (NEWMATHCAP(e),(e)->body=(LIST)(b))  #define MKMATHCAP(e,b) (NEWMATHCAP(e),(e)->body=(LIST)(b))
 #define MKBYTEARRAY(m,l) \  #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 MKQUOTE(q,b) (NEWQUOTE(q),(q)->body=(pointer)(b))
 #define MKQUOTEARG(q,t,b) (NEWQUOTEARG(q),(q)->type=(t),(q)->body=(pointer)(b))  #define MKQUOTEARG(q,t,b) (NEWQUOTEARG(q),(q)->type=(t),(q)->body=(pointer)(b))
   
Line 914  PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q)
Line 967  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 MKReal(a,b) (!(a)?((b)=0):(NEWReal(b),BDY(b)=(a),(b)))
 #define MKAlg(b,r) \  #define MKAlg(b,r) \
 (!(b)?((r)=0):NUM(b)?((r)=(Alg)(b)):(NEWAlg(r),BDY(r)=(Obj)(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_MAX 1073741823
 #define IMM_MIN -1073741823  #define IMM_MIN -1073741823
Line 932  PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q)
Line 985  PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q)
 #define NUM(p) (OID(p)==O_N)  #define NUM(p) (OID(p)==O_N)
 #define RAT(p) (OID(p)==O_R)  #define RAT(p) (OID(p)==O_R)
 #define RATN(a) (NID(a)==N_Q)  #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 INT(q) (!(q)||(NUM(q)&&RATN((Num)q)&&!DN((Q)q)))
 #define REAL(a) (NID(a)==N_R)  #define REAL(a) (NID(a)==N_R)
 #define BIGFLOAT(a) (NID(a)==N_B)  #define BIGFLOAT(a) (NID(a)==N_B)
Line 1294  void copyn(N,int,int *);
Line 1348  void copyn(N,int,int *);
 void kmulnmain(N,N,N *);  void kmulnmain(N,N,N *);
 int qcoefp(Obj);  int qcoefp(Obj);
 int qcoefr(Obj);  int qcoefr(Obj);
 int get_allocwords(void);  size_t get_allocwords(void);
 double get_clock(void);  double get_clock(void);
 void get_eg(struct oEGT *);  void get_eg(struct oEGT *);
 void printtime(struct oEGT *,struct oEGT *,double);  void printtime(struct oEGT *,struct oEGT *,double);
Line 1399  LUM LUMALLOC(int, int);
Line 1453  LUM LUMALLOC(int, int);
 BM BMALLOC(int, int);  BM BMALLOC(int, int);
 Obj ToAlg(Num);  Obj ToAlg(Num);
 UM *berlemain(register int, UM, UM *);  UM *berlemain(register int, UM, UM *);
   void Risa_GC_set_adj(int,int);
   void Risa_GC_get_adj(int *,int *);
 void *Risa_GC_malloc(size_t);  void *Risa_GC_malloc(size_t);
 void *Risa_GC_malloc_atomic(size_t);  void *Risa_GC_malloc_atomic(size_t);
 void *Risa_GC_realloc(void *,size_t);  void *Risa_GC_realloc(void *,size_t);
   void Risa_GC_free(void *);
   void *Risa_GC_malloc_atomic_ignore_off_page(size_t);
 void *GC_malloc(size_t);  void *GC_malloc(size_t);
 void *GC_malloc_atomic(size_t);  void *GC_malloc_atomic(size_t);
 void *GC_realloc(void *,size_t);  void *GC_realloc(void *,size_t);
Line 2448  void resume_timer() ;
Line 2506  void resume_timer() ;
 void reset_engine() ;  void reset_engine() ;
 unsigned int get_asir_version() ;  unsigned int get_asir_version() ;
 char *get_asir_distribution();  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();  void init_lprime();
 int get_lprime(int index);  int get_lprime(int index);
 void create_new_lprimes(int index);  void create_new_lprimes(int index);
Line 2608  void bzero(const void *,int);
Line 2666  void bzero(const void *,int);
 void bcopy(const void *,void *,int);  void bcopy(const void *,void *,int);
 char *index(char *,int);  char *index(char *,int);
 #endif  #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);
   
   #define WORDSIZE_IN_N(a) (ABS((a)->_mp_size)*GMP_LIMB_BITS/32)
   
   #define MPZTOGZ(g,q) \
   (!mpz_sgn(g)?((q)=0):(NEWGZ(q),BDY(q)[0]=(g)[0],(q)))
   #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 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))
   
   #define INTGQ(a) ((a)&&NID(a)==N_GQ&&!mpz_cmp_ui(mpq_denref(BDY(a)),1))
   
   #define UNIGQ(a) \
   ((a)&&NID(a)==N_GQ&&!mpz_cmp_ui(mpq_numref(BDY(a)),1)&&!mpz_cmp_ui(mpq_denref(BDY(a)),1))
   #define MUNIGQ(a) \
   ((a)&&NID(a)==N_GQ&&!mpz_cmp_si(mpq_numref(BDY(a)),-1)&&!mpz_cmp_ui(mpq_denref(BDY(a)),1))
   
   #define MPZTOMPQ(z,q) \
   (mpq_init(q),mpq_numref(q)[0] = (z)[0],mpz_set_ui(mpq_denref(q),1))
   
   extern mpz_t ONEMPZ;
   extern GZ ONEGZ;
   
   void *gc_realloc(void *p,size_t osize,size_t nsize);
   void gc_free(void *p,size_t size);
   void init_gmpq();
   GQ mpqtogzq(mpq_t a);
   GQ qtogq(Q a);
   Q gqtoq(GQ a);
   GZ ztogz(Q a);
   Q gztoz(GZ a);
   P ptogp(P a);
   P gptop(P a);
   void addgz(GZ n1,GZ n2,GZ *nr);
   void subgz(GZ n1,GZ n2,GZ *nr);
   void mulgz(GZ n1,GZ n2,GZ *nr);
   void divgz(GZ n1,GZ n2,GZ *nq);
   void chsgngz(GZ n,GZ *nr);
   void pwrgz(GZ n1,Q n,GZ *nr);
   int cmpgz(GZ q1,GZ q2);
   void gcdgz(GZ n1,GZ n2,GZ *nq);
   void gcdvgz(VECT v,GZ *q);
   void addgq(GQ n1,GQ n2,GQ *nr);
   void subgq(GQ n1,GQ n2,GQ *nr);
   void mulgq(GQ n1,GQ n2,GQ *nr);
   void divgq(GQ n1,GQ n2,GQ *nq);
   void chsgngq(GQ n,GQ *nr);
   void pwrgq(GQ n1,Q n,GQ *nr);
   int cmpgq(GQ n1,GQ n2);
   void mkgwc(int k,int l,GZ *t);
   void gz_ptozp(P p,int sgn,GQ *c,P *pr);
   void gz_lgp(P p,GZ *g,GZ *l);
   void gz_qltozl(GQ *w,int n,GZ *dvr);

Legend:
Removed from v.1.58  
changed lines
  Added in v.1.86

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>