version 1.88, 2015/03/15 19:30:46 |
version 1.95, 2016/03/31 01:40:11 |
|
|
* 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.87 2014/08/19 06:35:01 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/include/ca.h,v 1.94 2015/08/20 08:42:07 noro Exp $ |
*/ |
*/ |
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <gmp.h> |
#include <gmp.h> |
|
#include <mpc.h> |
|
|
|
/* from mpfr-impl.h */ |
|
#define MPFR_PREC(x) ((x)->_mpfr_prec) |
|
#define MPFR_EXP(x) ((x)->_mpfr_exp) |
|
#define MPFR_MANT(x) ((x)->_mpfr_d) |
|
#define MPFR_LAST_LIMB(x) ((MPFR_PREC (x) - 1) / GMP_NUMB_BITS) |
|
#define MPFR_LIMB_SIZE(x) (MPFR_LAST_LIMB (x) + 1) |
|
|
#if defined(hpux) |
#if defined(hpux) |
#include <netinet/in.h> |
#include <netinet/in.h> |
# define setbuffer(FP,buf,siz) setvbuf(FP,buf,_IOFBF,siz) |
# define setbuffer(FP,buf,siz) setvbuf(FP,buf,_IOFBF,siz) |
#endif |
#endif |
|
|
#if !defined(VISUAL) |
#if !defined(VISUAL) && !defined(__MINGW32__) |
#include <unistd.h> |
#include <unistd.h> |
#include <sys/param.h> |
#include <sys/param.h> |
#endif |
#endif |
|
|
#define alloca(x) __builtin_alloca(x) |
#define alloca(x) __builtin_alloca(x) |
#endif |
#endif |
|
|
#if defined(VISUAL) |
#if defined(VISUAL) || defined(__MINGW32__) |
#include <limits.h> |
#include <limits.h> |
#include <malloc.h> |
#include <malloc.h> |
#endif |
#endif |
Line 86 typedef void * pointer; |
|
Line 94 typedef void * pointer; |
|
#include <strings.h> |
#include <strings.h> |
#else |
#else |
#include <string.h> |
#include <string.h> |
#if defined(VISUAL) |
#if defined(VISUAL) || defined(__MINGW32__) |
#define index(s,c) strchr(s,c) |
#define index(s,c) strchr(s,c) |
#define bzero(s,len) memset(s,0,len) |
#define bzero(s,len) memset(s,0,len) |
#define bcopy(x,y,len) memcpy(y,x,len) |
#define bcopy(x,y,len) memcpy(y,x,len) |
Line 160 typedef void * pointer; |
|
Line 168 typedef void * pointer; |
|
#define N_DA (N_BASE+8) |
#define N_DA (N_BASE+8) |
#define N_GZ (N_BASE+9) |
#define N_GZ (N_BASE+9) |
#define N_GQ (N_BASE+10) |
#define N_GQ (N_BASE+10) |
|
#define N_PARIB (N_BASE+11) |
|
|
#define ORD_REVGRADLEX 0 |
#define ORD_REVGRADLEX 0 |
#define ORD_GRADLEX 1 |
#define ORD_GRADLEX 1 |
Line 241 typedef struct oBF { |
|
Line 250 typedef struct oBF { |
|
short id; |
short id; |
char nid; |
char nid; |
char pad; |
char pad; |
long body[1]; |
mpfr_t body; |
} *BF; |
} *BF; |
|
|
typedef struct oC { |
typedef struct oC { |
Line 654 struct order_spec { |
|
Line 663 struct order_spec { |
|
int nv; |
int nv; |
int ispot; /* 1 means Position over Term (Pos then Term) */ |
int ispot; /* 1 means Position over Term (Pos then Term) */ |
int pot_nelim; /* size of positions for pot-elimination order */ |
int pot_nelim; /* size of positions for pot-elimination order */ |
|
int *top_weight; |
|
int module_rank; |
|
int *module_top_weight; |
union { |
union { |
int simple; |
int simple; |
struct { |
struct { |
Line 763 typedef unsigned int ModNum; |
|
Line 775 typedef unsigned int ModNum; |
|
#define GCFREE(p) Risa_GC_free(p) |
#define GCFREE(p) Risa_GC_free(p) |
#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) || defined(__MINGW32__)) |
#define ALLOCA(d) alloca(d) |
#define ALLOCA(d) alloca(d) |
#else |
#else |
#define ALLOCA(d) MALLOC(d) |
#define ALLOCA(d) MALLOC(d) |
#endif |
#endif |
|
|
/* for setjmp/longjmp compatibility */ |
/* for setjmp/longjmp compatibility */ |
#if defined(__CYGWIN__) || defined(__x86_64) |
#if defined(__CYGWIN__) || (defined(__x86_64) && !defined(__MINGW32__)) |
#define JMP_BUF sigjmp_buf |
#define JMP_BUF sigjmp_buf |
#define SETJMP(x) sigsetjmp(x,~0) |
#define SETJMP(x) sigsetjmp(x,~0) |
#define LONGJMP(x,y) siglongjmp(x,y) |
#define LONGJMP(x,y) siglongjmp(x,y) |
Line 875 bzero((char *)(q)->b,(w)*sizeof(unsigned int))) |
|
Line 887 bzero((char *)(q)->b,(w)*sizeof(unsigned int))) |
|
#define NEWReal(q) ((q)=(Real)MALLOC_ATOMIC(sizeof(struct oReal)),OID(q)=O_N,NID(q)=N_R) |
#define NEWReal(q) ((q)=(Real)MALLOC_ATOMIC(sizeof(struct oReal)),OID(q)=O_N,NID(q)=N_R) |
#define NEWAlg(r) ((r)=(Alg)MALLOC(sizeof(struct oAlg)),OID(r)=O_N,NID(r)=N_A) |
#define NEWAlg(r) ((r)=(Alg)MALLOC(sizeof(struct oAlg)),OID(r)=O_N,NID(r)=N_A) |
#define NEWDAlg(r) ((r)=(DAlg)MALLOC(sizeof(struct oDAlg)),OID(r)=O_N,NID(r)=N_DA) |
#define NEWDAlg(r) ((r)=(DAlg)MALLOC(sizeof(struct oDAlg)),OID(r)=O_N,NID(r)=N_DA) |
#define NEWBF(q,l) ((q)=(BF)MALLOC_ATOMIC(TRUESIZE(oBF,(l)-1,long)),OID(q)=O_N,NID(q)=N_B) |
#define NEWBF(q) ((q)=(BF)MALLOC(sizeof(struct oBF)),OID(q)=O_N,NID(q)=N_B) |
|
#define NEWPARIBF(q,l) ((q)=(BF)MALLOC_ATOMIC(TRUESIZE(oBF,(l)-1,long)),OID(q)=O_N,NID(q)=N_PARIB) |
#define NEWC(r) ((r)=(C)MALLOC(sizeof(struct oC)),OID(r)=O_N,NID(r)=N_C) |
#define NEWC(r) ((r)=(C)MALLOC(sizeof(struct oC)),OID(r)=O_N,NID(r)=N_C) |
#define NEWLM(r) ((r)=(LM)MALLOC(sizeof(struct oLM)),OID(r)=O_N,NID(r)=N_LM) |
#define NEWLM(r) ((r)=(LM)MALLOC(sizeof(struct oLM)),OID(r)=O_N,NID(r)=N_LM) |
#define NEWGF2N(r) ((r)=(GF2N)MALLOC(sizeof(struct oGF2N)),OID(r)=O_N,NID(r)=N_GF2N) |
#define NEWGF2N(r) ((r)=(GF2N)MALLOC(sizeof(struct oGF2N)),OID(r)=O_N,NID(r)=N_GF2N) |
Line 975 PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q) |
|
Line 988 PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q) |
|
#define SL(n) ((n)->p) |
#define SL(n) ((n)->p) |
#define ZALLOC(d) ((Z)MALLOC_ATOMIC(TRUESIZE(oZ,(d)-1,int))) |
#define ZALLOC(d) ((Z)MALLOC_ATOMIC(TRUESIZE(oZ,(d)-1,int))) |
|
|
#if defined(PARI) |
#define ToReal(a) (!(a)?(double)0.0:REAL(a)?BDY((Real)a):RATN(a)?RatnToReal((Q)a):BIGFLOAT(a)?mpfrtodbl(BDY((BF)a)):0) |
#define ToReal(a) (!(a)?(double)0.0:REAL(a)?BDY((Real)a):RATN(a)?RatnToReal((Q)a):BIGFLOAT(a)?rtodbl(BDY((BF)a)):0) |
|
#else |
|
#define ToReal(a) (!(a)?(double)0.0:REAL(a)?BDY((Real)a):RATN(a)?RatnToReal((Q)a):0.0) |
|
#endif |
|
|
|
/* predicates */ |
/* predicates */ |
#define NUM(p) (OID(p)==O_N) |
#define NUM(p) (OID(p)==O_N) |
Line 1251 void rtime_init(void); |
|
Line 1260 void rtime_init(void); |
|
void setmod_gf2n(P); |
void setmod_gf2n(P); |
void mt_sgenrand(unsigned long); |
void mt_sgenrand(unsigned long); |
unsigned long mt_genrand(void); |
unsigned long mt_genrand(void); |
#if defined(VISUAL) |
#if defined(VISUAL) || defined(__MINGW32__) |
void srandom(unsigned int); |
void srandom(unsigned int); |
unsigned int random(void); |
unsigned int random(void); |
#endif |
#endif |
Line 1467 double NatToReal(N,int *); |
|
Line 1476 double NatToReal(N,int *); |
|
double RatnToReal(Q); |
double RatnToReal(Q); |
double pwrreal0(double,int); |
double pwrreal0(double,int); |
double rtodbl(); /* XXX */ |
double rtodbl(); /* XXX */ |
|
double mpfrtodbl(mpfr_t a); |
int **almat(int,int); |
int **almat(int,int); |
pointer **almat_pointer(int,int); |
pointer **almat_pointer(int,int); |
int berlecnt(register int,UM); |
int berlecnt(register int,UM); |
Line 2661 void mkwcz(int k,int l,Z *t); |
|
Line 2671 void mkwcz(int k,int l,Z *t); |
|
int remzi(Z n,int m); |
int remzi(Z n,int m); |
|
|
|
|
#if 0 && !defined(VISUAL) |
#if 0 && !defined(VISUAL) && !defined(__MINGW32__) |
void bzero(const void *,int); |
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); |
Line 2695 int compnbp(VL vl,NBP p1,NBP p2); |
|
Line 2705 int compnbp(VL vl,NBP p1,NBP p2); |
|
|
|
#define MPZTOMPQ(z,q) \ |
#define MPZTOMPQ(z,q) \ |
(mpq_init(q),mpq_numref(q)[0] = (z)[0],mpz_set_ui(mpq_denref(q),1)) |
(mpq_init(q),mpq_numref(q)[0] = (z)[0],mpz_set_ui(mpq_denref(q),1)) |
|
|
|
#define MPFRTOBF(g,q) \ |
|
(NEWBF(q),BDY(q)[0]=(g)[0],(q)) |
|
|
extern mpz_t ONEMPZ; |
extern mpz_t ONEMPZ; |
extern GZ ONEGZ; |
extern GZ ONEGZ; |