version 1.29, 2001/10/09 01:36:19 |
version 1.40, 2003/12/23 06:30:14 |
|
|
* 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.28 2001/09/17 10:32:41 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/include/ca.h,v 1.39 2003/11/08 01:12:03 noro Exp $ |
*/ |
*/ |
#include <stdio.h> |
#include <stdio.h> |
|
#include <stdlib.h> |
|
|
#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) |
#include <stdlib.h> |
#include <unistd.h> |
#endif |
#endif |
|
|
#if !defined(VISUAL) |
#if !defined(VISUAL) |
Line 81 typedef caddr_t pointer; |
|
Line 82 typedef caddr_t pointer; |
|
|
|
typedef void * pointer; |
typedef void * pointer; |
|
|
#if defined(VISUAL) |
#if defined(sun) |
|
#include <strings.h> |
|
#else |
#include <string.h> |
#include <string.h> |
|
#if defined(VISUAL) |
#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) |
#endif |
#endif |
|
#endif |
|
|
#define COPY(a,b) ((b)=(a)) |
#define COPY(a,b) ((b)=(a)) |
#define FREEN(p) |
#define FREEN(p) |
Line 113 typedef void * pointer; |
|
Line 118 typedef void * pointer; |
|
#define O_GFMMAT 15 |
#define O_GFMMAT 15 |
#define O_BYTEARRAY 16 |
#define O_BYTEARRAY 16 |
#define O_QUOTE 17 |
#define O_QUOTE 17 |
|
#define O_OPTLIST 18 |
#define O_VOID -1 |
#define O_VOID -1 |
|
|
#define N_Q 0 |
#define N_Q 0 |
Line 131 typedef void * pointer; |
|
Line 137 typedef void * pointer; |
|
#define ORD_GRADLEX 1 |
#define ORD_GRADLEX 1 |
#define ORD_LEX 2 |
#define ORD_LEX 2 |
|
|
#if LONG_IS_32BIT |
#if defined(LONG_IS_32BIT) |
#if defined(VISUAL) |
#if defined(VISUAL) |
typedef _int64 L; |
typedef _int64 L; |
typedef unsigned _int64 UL; |
typedef unsigned _int64 UL; |
Line 349 typedef struct oQUOTE { |
|
Line 355 typedef struct oQUOTE { |
|
pointer body; |
pointer body; |
} *QUOTE; |
} *QUOTE; |
|
|
|
typedef struct oOPTLIST { |
|
short id; |
|
short pad; |
|
struct oNODE *body; |
|
} *OPTLIST; |
|
|
typedef struct oObj { |
typedef struct oObj { |
short id; |
short id; |
short pad; |
short pad; |
Line 414 typedef struct oDLBUCKET { |
|
Line 426 typedef struct oDLBUCKET { |
|
struct oDLBUCKET *next; |
struct oDLBUCKET *next; |
} *DLBUCKET; |
} *DLBUCKET; |
|
|
|
typedef struct oGeoBucket { |
|
int m; |
|
struct oNODE *body[32]; |
|
} *GeoBucket; |
|
|
typedef struct oVL { |
typedef struct oVL { |
V v; |
V v; |
struct oVL *next; |
struct oVL *next; |
|
|
|
|
#define INDEX 100 |
#define INDEX 100 |
|
|
#if USE_FLOAT |
#if defined(USE_FLOAT) |
typedef float ModNum; |
typedef float ModNum; |
#define NPrimes 536 |
#define NPrimes 536 |
#else |
#else |
Line 566 typedef unsigned int ModNum; |
|
Line 583 typedef unsigned int ModNum; |
|
#endif |
#endif |
#define CALLOC(d,e) MALLOC((d)*(e)) |
#define CALLOC(d,e) MALLOC((d)*(e)) |
|
|
#if (defined(__GNUC__) || defined(vax) || defined(apollo) || defined(alloca) || defined(VISUAL)) |
#if !defined(__CYGWIN__) && (defined(__GNUC__) || defined(vax) || defined(apollo) || defined(alloca) || defined(VISUAL)) |
#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 */ |
|
#if defined(__CYGWIN__) || defined(__x86_64) |
|
#define JMP_BUF sigjmp_buf |
|
#define SETJMP(x) sigsetjmp(x,~0) |
|
#define LONGJMP(x,y) siglongjmp(x,y) |
|
#else |
|
#define JMP_BUF jmp_buf |
|
#define SETJMP(x) setjmp(x) |
|
#define LONGJMP(x,y) longjmp(x,y) |
|
#endif |
|
|
#define TRUESIZE(type,n,atype) (sizeof(struct type)+MAX((n),0)*sizeof(atype)) |
#define TRUESIZE(type,n,atype) (sizeof(struct type)+MAX((n),0)*sizeof(atype)) |
#define NALLOC(d) ((N)MALLOC_ATOMIC(TRUESIZE(oN,(d)-1,int))) |
#define NALLOC(d) ((N)MALLOC_ATOMIC(TRUESIZE(oN,(d)-1,int))) |
#define UMALLOC(d) ((UM)MALLOC(TRUESIZE(oUM,d,int))) |
#define UMALLOC(d) ((UM)MALLOC(TRUESIZE(oUM,d,int))) |
Line 640 bzero((char *)(q)->b,(w)*sizeof(unsigned int))) |
|
Line 668 bzero((char *)(q)->b,(w)*sizeof(unsigned int))) |
|
#define NEWMATHCAP(e) ((e)=(MATHCAP)MALLOC(sizeof(struct oMATHCAP)),OID(e)=O_MATHCAP) |
#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 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 NEWQUOTE(e) ((e)=(QUOTE)MALLOC(sizeof(struct oQUOTE)),OID(e)=O_QUOTE) |
|
#define NEWOPTLIST(l) ((l)=(OPTLIST)MALLOC(sizeof(struct oOPTLIST)),OID(l)=O_OPTLIST) |
|
|
#define NEWNODE(a) ((a)=(NODE)MALLOC(sizeof(struct oNODE))) |
#define NEWNODE(a) ((a)=(NODE)MALLOC(sizeof(struct oNODE))) |
#define NEWDC(dc) ((dc)=(DCP)MALLOC(sizeof(struct oDCP))) |
#define NEWDC(dc) ((dc)=(DCP)MALLOC(sizeof(struct oDCP))) |
Line 745 PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q) |
|
Line 774 PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q) |
|
#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))) |
|
|
#if PARI |
#if defined(PARI) |
#define ToReal(a) (!(a)?(double)0.0:REAL(a)?BDY((Real)a):RATN(a)?RatnToReal((Q)a):BIGFLOAT(a)?rtodbl(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 |
#else |
#define ToReal(a) (!(a)?(double)0.0:REAL(a)?BDY((Real)a):RATN(a)?RatnToReal((Q)a):0.0) |
#define ToReal(a) (!(a)?(double)0.0:REAL(a)?BDY((Real)a):RATN(a)?RatnToReal((Q)a):0.0) |
Line 813 if(!(r)){(c)=(r)=(s);}else{NEXT(c)=(s);(c)=(s);} |
|
Line 842 if(!(r)){(c)=(r)=(s);}else{NEXT(c)=(s);(c)=(s);} |
|
#define _FREEMP(m) NEXT(m)=_mp_free_list; _mp_free_list=(m) |
#define _FREEMP(m) NEXT(m)=_mp_free_list; _mp_free_list=(m) |
#define _FREEDP(m) BDY(m)=(MP)_dp_free_list; _dp_free_list=(m) |
#define _FREEDP(m) BDY(m)=(MP)_dp_free_list; _dp_free_list=(m) |
|
|
|
#define MUL_WEIGHT(a,i) (current_dl_weight_vector?(a)*current_dl_weight_vector[i]:(a)) |
|
|
/* externals */ |
/* externals */ |
#if 0 |
#if 0 |
double NatToReal(); |
double NatToReal(); |
Line 832 extern VL CO,ALG; |
|
Line 863 extern VL CO,ALG; |
|
extern VL PVL; |
extern VL PVL; |
extern R ONER; |
extern R ONER; |
extern Q ONE; |
extern Q ONE; |
|
extern Q TWO; |
extern MQ ONEM; |
extern MQ ONEM; |
extern LM ONELM; |
extern LM ONELM; |
extern N ONEN; |
extern N ONEN; |
Line 869 extern int *current_gfs_plus1; |
|
Line 901 extern int *current_gfs_plus1; |
|
extern int *current_gfs_ntoi; |
extern int *current_gfs_ntoi; |
extern int *current_gfs_iton; |
extern int *current_gfs_iton; |
|
|
|
extern int *current_dl_weight_vector; |
|
|
/* prototypes */ |
/* prototypes */ |
int compui(VL,USINT,USINT); |
int compui(VL,USINT,USINT); |
int compbytearray(VL,BYTEARRAY,BYTEARRAY); |
int compbytearray(VL,BYTEARRAY,BYTEARRAY); |
Line 1852 int berlekampsf(UM p,int df,UM *tab,UM *r); |
|
Line 1886 int berlekampsf(UM p,int df,UM *tab,UM *r); |
|
void minipolysf(UM f,UM p,UM mp); |
void minipolysf(UM f,UM p,UM mp); |
int find_rootsf(UM p,int *root); |
int find_rootsf(UM p,int *root); |
void canzassf(UM f,int d,UM *r); |
void canzassf(UM f,int d,UM *r); |
void sfhensel(int count,P f,V x,GFS *evp,P *sfp,ML *listp); |
void sfhensel(int count,P f,V x,V y,int degbound,GFS *evp,P *sfp,ML *listp); |
int sfberle(VL vl,P f,int count,GFS *ev,DCP *dcp); |
int sfberle(V x,V y,P f,int count,GFS *ev,DCP *dcp); |
void sfgcdgen(P f,ML blist,ML *clistp); |
void sfgcdgen(P f,ML blist,ML *clistp); |
void sfhenmain2(BM f,UM g0,UM h0,int dy,BM *gp); |
void sfhenmain2(BM f,UM g0,UM h0,int dy,BM *gp); |
void ptosfbm(int dy,P f,BM fl); |
void ptosfbm(int dy,P f,BM fl); |
Line 1861 void sfbmtop(BM f,V x,V y,P *fp); |
|
Line 1895 void sfbmtop(BM f,V x,V y,P *fp); |
|
void sfsqfr(P f,DCP *dcp); |
void sfsqfr(P f,DCP *dcp); |
void sfusqfr(P f,DCP *dcp); |
void sfusqfr(P f,DCP *dcp); |
void sfbsqfr(P f,V x,V y,DCP *dcp); |
void sfbsqfr(P f,V x,V y,DCP *dcp); |
void sfbfctr(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); |
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 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); |