version 1.30, 2001/11/19 00:57:12 |
version 1.55, 2004/12/18 16:50:10 |
|
|
* 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.29 2001/10/09 01:36:19 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/include/ca.h,v 1.54 2004/12/10 07:36:34 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_SYMBOL 19 |
|
#define O_RANGE 20 |
|
#define O_TB 21 |
|
#define O_DPV 22 |
|
#define O_QUOTEARG 23 |
#define O_VOID -1 |
#define O_VOID -1 |
|
/* IMAT */ |
|
#define O_IMAT 24 |
|
/* IMAT */ |
|
|
#define N_Q 0 |
#define N_Q 0 |
#define N_R 1 |
#define N_R 1 |
Line 126 typedef void * pointer; |
|
Line 140 typedef void * pointer; |
|
#define N_GFPN 8 |
#define N_GFPN 8 |
#define N_GFS 9 |
#define N_GFS 9 |
#define N_GFSN 10 |
#define N_GFSN 10 |
|
#define N_DA 11 |
|
|
#define ORD_REVGRADLEX 0 |
#define ORD_REVGRADLEX 0 |
#define ORD_GRADLEX 1 |
#define ORD_GRADLEX 1 |
#define ORD_LEX 2 |
#define ORD_LEX 2 |
|
|
#if LONG_IS_32BIT |
typedef enum { |
|
A_end=0,A_fnode,A_arf,A_int,A_str,A_internal,A_node,A_notimpl,A_func |
|
} farg_type; |
|
|
|
#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 149 typedef struct oN { |
|
Line 168 typedef struct oN { |
|
unsigned int b[1]; |
unsigned int b[1]; |
} *N; |
} *N; |
|
|
|
typedef struct oZ { |
|
int p; |
|
unsigned int b[1]; |
|
} *Z; |
|
|
typedef struct oUP2 { |
typedef struct oUP2 { |
int w; |
int w; |
unsigned int b[1]; |
unsigned int b[1]; |
Line 231 typedef struct oGFPN { |
|
Line 255 typedef struct oGFPN { |
|
struct oUP *body; |
struct oUP *body; |
} *GFPN; |
} *GFPN; |
|
|
|
typedef struct oDAlg { |
|
short id; |
|
char nid; |
|
char pad; |
|
struct oDP *nm; |
|
struct oQ *dn; |
|
} *DAlg; |
|
|
|
|
typedef struct oNum { |
typedef struct oNum { |
short id; |
short id; |
char nid; |
char nid; |
Line 293 typedef struct oGF2MAT { |
|
Line 326 typedef struct oGF2MAT { |
|
unsigned int **body; |
unsigned int **body; |
} *GF2MAT, *GFMMAT; |
} *GF2MAT, *GFMMAT; |
|
|
|
/* IMAT */ |
|
#define IMATCH 64 |
|
|
|
typedef struct oIENT { |
|
int cr; |
|
int row, col; |
|
pointer *body; |
|
} IENT; |
|
|
|
typedef struct oIMATC { |
|
pointer *fore; |
|
pointer *next; |
|
IENT ient[IMATCH]; |
|
} *IMATC; |
|
|
|
typedef struct oIMAT { |
|
short id; |
|
int row, col, clen; |
|
pointer *root; |
|
pointer *toor; |
|
} *IMAT; |
|
/* IMAT */ |
typedef struct oLIST { |
typedef struct oLIST { |
short id; |
short id; |
short pad; |
short pad; |
Line 318 typedef struct oDP { |
|
Line 373 typedef struct oDP { |
|
struct oMP *body; |
struct oMP *body; |
} *DP; |
} *DP; |
|
|
|
typedef struct oDPV { |
|
short id; |
|
int len; |
|
int sugar; |
|
struct oDP **body; |
|
} *DPV; |
|
|
typedef struct oUSINT { |
typedef struct oUSINT { |
short id; |
short id; |
short pad; |
short pad; |
Line 349 typedef struct oQUOTE { |
|
Line 411 typedef struct oQUOTE { |
|
pointer body; |
pointer body; |
} *QUOTE; |
} *QUOTE; |
|
|
|
typedef struct oQUOTEARG { |
|
short id; |
|
short pad; |
|
farg_type type; |
|
pointer body; |
|
} *QUOTEARG; |
|
|
|
typedef struct oOPTLIST { |
|
short id; |
|
short pad; |
|
struct oNODE *body; |
|
} *OPTLIST; |
|
|
|
typedef struct oSYMBOL { |
|
short id; |
|
short pad; |
|
char *name; |
|
int value; |
|
} *SYMBOL; |
|
|
|
typedef struct oRANGE { |
|
short id; |
|
short pad; |
|
struct oObj *start,*end; |
|
} *RANGE; |
|
|
|
typedef struct oTB { |
|
short id; |
|
short pad; |
|
int size,next; |
|
char **body; |
|
} *TB; |
|
|
typedef struct oObj { |
typedef struct oObj { |
short id; |
short id; |
short pad; |
short pad; |
Line 414 typedef struct oDLBUCKET { |
|
Line 509 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; |
Line 474 struct order_pair { |
|
Line 574 struct order_pair { |
|
int order, length; |
int order, length; |
}; |
}; |
|
|
|
struct sparse_weight { |
|
int pos, value; |
|
}; |
|
|
|
#define IS_DENSE_WEIGHT 0 |
|
#define IS_SPARSE_WEIGHT 1 |
|
#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; |
|
}; |
|
|
struct order_spec { |
struct order_spec { |
int id; |
int id; |
Obj obj; |
Obj obj; |
Line 488 struct order_spec { |
|
Line 608 struct order_spec { |
|
int row; |
int row; |
int **matrix; |
int **matrix; |
} matrix; |
} matrix; |
|
struct { |
|
int length; |
|
struct weight_or_block *w_or_b; |
|
} composite; |
} ord; |
} ord; |
}; |
}; |
|
|
|
struct modorder_spec { |
|
/* id : ORD_REVGRADLEX, ORD_GRADLEX, ORD_LEX */ |
|
int id; |
|
Obj obj; |
|
int len; |
|
int *degree_shift; |
|
}; |
|
|
|
typedef struct oNumberField { |
|
int n; |
|
int dim; |
|
VL vl; |
|
P *defpoly; |
|
DP *mb; |
|
DP *ps; |
|
struct oDAlg *one; |
|
NODE ind; |
|
struct order_spec *spec; |
|
} *NumberField; |
|
|
/* structure for cputime */ |
/* structure for cputime */ |
|
|
struct oEGT { |
struct oEGT { |
|
|
|
|
#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 710 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 635 bzero((char *)(q)->b,(w)*sizeof(unsigned int))) |
|
Line 790 bzero((char *)(q)->b,(w)*sizeof(unsigned int))) |
|
#define NEWSTR(l) ((l)=(STRING)MALLOC(sizeof(struct oSTRING)),OID(l)=O_STR) |
#define NEWSTR(l) ((l)=(STRING)MALLOC(sizeof(struct oSTRING)),OID(l)=O_STR) |
#define NEWCOMP(c,n) ((c)=(COMP)MALLOC(sizeof(struct oCOMP)+((n)-1)*sizeof(Obj)),OID(c)=O_COMP) |
#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 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 NEWUSINT(u) ((u)=(USINT)MALLOC_ATOMIC(sizeof(struct oUSINT)),OID(u)=O_USINT) |
#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 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) |
#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 NEWQUOTEARG(e) ((e)=(QUOTEARG)MALLOC(sizeof(struct oQUOTEARG)),OID(e)=O_QUOTEARG) |
|
#define NEWOPTLIST(l) ((l)=(OPTLIST)MALLOC(sizeof(struct oOPTLIST)),OID(l)=O_OPTLIST) |
|
#define NEWSYMBOL(l) ((l)=(SYMBOL)MALLOC(sizeof(struct oSYMBOL)),OID(l)=O_SYMBOL) |
|
#define NEWRANGE(l) ((l)=(RANGE)MALLOC(sizeof(struct oRANGE)),OID(l)=O_RANGE) |
|
#define NEWTB(l) ((l)=(TB)MALLOC(sizeof(struct oTB)),OID(l)=O_TB,(l)->size=256,(l)->next=0,(l)->body=(char **)MALLOC((l)->size*sizeof(char *))) |
|
|
#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 652 bzero((char *)(q)->b,(w)*sizeof(unsigned int))) |
|
Line 813 bzero((char *)(q)->b,(w)*sizeof(unsigned int))) |
|
#define NEWMAT(l) ((l)=(MAT)MALLOC(sizeof(struct oMAT)),OID(l)=O_MAT) |
#define NEWMAT(l) ((l)=(MAT)MALLOC(sizeof(struct oMAT)),OID(l)=O_MAT) |
#define NEWGF2MAT(l) ((l)=(GF2MAT)MALLOC(sizeof(struct oGF2MAT)),OID(l)=O_GF2MAT) |
#define NEWGF2MAT(l) ((l)=(GF2MAT)MALLOC(sizeof(struct oGF2MAT)),OID(l)=O_GF2MAT) |
#define NEWGFMMAT(l) ((l)=(GFMMAT)MALLOC(sizeof(struct oGF2MAT)),OID(l)=O_GFMMAT) |
#define NEWGFMMAT(l) ((l)=(GFMMAT)MALLOC(sizeof(struct oGF2MAT)),OID(l)=O_GFMMAT) |
|
/* IMAT */ |
|
#define NEWIMAT(l) ((l)=(IMAT)MALLOC(sizeof(struct oIMAT)),OID(l)=O_IMAT,l->clen=0,l->root=0,l->toor=0) |
|
#define NEWIENT(l) ((l)=(IMATC)MALLOC(sizeof(struct oIMATC)),l->fore=0,l->next=0) |
|
/* IMAT */ |
#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 NEWBF(q,l) ((q)=(BF)MALLOC_ATOMIC(TRUESIZE(oBF,(l)-1,long)),OID(q)=O_N,NID(q)=N_B) |
#define NEWBF(q,l) ((q)=(BF)MALLOC_ATOMIC(TRUESIZE(oBF,(l)-1,long)),OID(q)=O_N,NID(q)=N_B) |
#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) |
Line 665 bzero((char *)(q)->b,(w)*sizeof(unsigned int))) |
|
Line 831 bzero((char *)(q)->b,(w)*sizeof(unsigned int))) |
|
((d)=(DL)MALLOC_ATOMIC(TRUESIZE(oDL,(n)-1,int))) |
((d)=(DL)MALLOC_ATOMIC(TRUESIZE(oDL,(n)-1,int))) |
|
|
#define MKP(v,dc,p) \ |
#define MKP(v,dc,p) \ |
(!DEG(dc)?((p)=COEF(dc)):(NEWP(p),VR(p)=(v),DC(p)=(dc),(p))) |
((!DEG(dc)&&!NEXT(dc))?((p)=COEF(dc)):(NEWP(p),VR(p)=(v),DC(p)=(dc),(p))) |
#define MKV(v,p) \ |
#define MKV(v,p) \ |
(NEWP(p),VR(p)=(v),NEWDC(DC(p)),\ |
(NEWP(p),VR(p)=(v),NEWDC(DC(p)),\ |
DEG(DC(p))=ONE,COEF(DC(p))=(P)ONE,NEXT(DC(p))=0) |
DEG(DC(p))=ONE,COEF(DC(p))=(P)ONE,NEXT(DC(p))=0) |
Line 685 DEG(DC(p))=ONE,COEF(DC(p))=(P)ONEM,NEXT(DC(p))=0) |
|
Line 851 DEG(DC(p))=ONE,COEF(DC(p))=(P)ONEM,NEXT(DC(p))=0) |
|
#define TOGFMMAT(r,c,b,m) (NEWGFMMAT(m),(m)->row=(r),(m)->col=(c),(m)->body=(b)) |
#define TOGFMMAT(r,c,b,m) (NEWGFMMAT(m),(m)->row=(r),(m)->col=(c),(m)->body=(b)) |
#define MKSTR(a,b) (NEWSTR(a),(a)->body=(char *)(b)) |
#define MKSTR(a,b) (NEWSTR(a),(a)->body=(char *)(b)) |
#define MKDP(n,m,d) (NEWDP(d),(d)->nv=(n),BDY(d)=(m)) |
#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 MKLM(b,l) (!(b)?(l)=0:(NEWLM(l),(l)->body=(b),(l))) |
#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 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))) |
#define MKGFPN(b,l) (!(b)?(l)=0:(NEWGFPN(l),(l)->body=(b),(l))) |
Line 694 DEG(DC(p))=ONE,COEF(DC(p))=(P)ONEM,NEXT(DC(p))=0) |
|
Line 861 DEG(DC(p))=ONE,COEF(DC(p))=(P)ONEM,NEXT(DC(p))=0) |
|
#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=(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 NEXTDC(r,c) \ |
#define NEXTDC(r,c) \ |
if(!(r)){NEWDC(r);(c)=(r);}else{NEWDC(NEXT(c));(c)=NEXT(c);} |
if(!(r)){NEWDC(r);(c)=(r);}else{NEWDC(NEXT(c));(c)=NEXT(c);} |
Line 744 PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q) |
|
Line 912 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)) |
|
|
#if PARI |
#define IMM_MAX 1073741823 |
|
#define IMM_MIN -1073741823 |
|
|
|
#define SL(n) ((n)->p) |
|
#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)?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 988 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 1009 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 1047 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 955 void square_rem_tab_up_gf2n(UP,UP *,UP *); |
|
Line 1135 void square_rem_tab_up_gf2n(UP,UP *,UP *); |
|
void powertabup_gf2n(UP,UP,UP *); |
void powertabup_gf2n(UP,UP,UP *); |
void find_root_gf2n(UP,GF2N *); |
void find_root_gf2n(UP,GF2N *); |
|
|
|
int cmpdl_composite(int,DL,DL); |
int cmpdl_matrix(int,DL,DL); |
int cmpdl_matrix(int,DL,DL); |
int cmpdl_order_pair(int,DL,DL); |
int cmpdl_order_pair(int,DL,DL); |
int cmpdl_elim(int,DL,DL); |
int cmpdl_elim(int,DL,DL); |
Line 983 void dtop(VL,VL,DP,P *); |
|
Line 1164 void dtop(VL,VL,DP,P *); |
|
void ptod(VL,VL,P,DP *); |
void ptod(VL,VL,P,DP *); |
void initd(struct order_spec *); |
void initd(struct order_spec *); |
|
|
|
void adddv(VL,DPV,DPV,DPV *); |
|
void subdv(VL,DPV,DPV,DPV *); |
|
void muldv(VL,DP,DPV,DPV *); |
|
void chsgndv(DPV,DPV *); |
|
int compdv(VL,DPV,DPV); |
|
|
void _printdp(DP); |
void _printdp(DP); |
void _dp_sp_mod(DP,DP,int,DP *); |
void _dp_sp_mod(DP,DP,int,DP *); |
void _dp_mod(DP,int,NODE,DP *); |
void _dp_mod(DP,int,NODE,DP *); |
Line 1316 void chsgngfsn(GFSN,GFSN *); |
|
Line 1503 void chsgngfsn(GFSN,GFSN *); |
|
void pwrgfsn(GFSN,Q, GFSN *); |
void pwrgfsn(GFSN,Q, GFSN *); |
int cmpgfsn(GFSN,GFSN); |
int cmpgfsn(GFSN,GFSN); |
|
|
|
void adddalg(DAlg,DAlg,DAlg *); |
|
void subdalg(DAlg,DAlg,DAlg *); |
|
void muldalg(DAlg,DAlg,DAlg *); |
|
void divdalg(DAlg,DAlg,DAlg *); |
|
void chsgndalg(DAlg,DAlg *); |
|
void pwrdalg(DAlg,Q, DAlg *); |
|
int cmpdalg(DAlg,DAlg); |
|
|
void addalg(Num,Num,Num *); |
void addalg(Num,Num,Num *); |
void addbf(Num,Num,Num *); |
void addbf(Num,Num,Num *); |
void addcplx(Num,Num,Num *); |
void addcplx(Num,Num,Num *); |
Line 1412 void dtestroot(int,int,P,LUM,struct oDUM *,DCP *); |
|
Line 1607 void dtestroot(int,int,P,LUM,struct oDUM *,DCP *); |
|
void dtestroot1(int,int,P,LUM,P *); |
void dtestroot1(int,int,P,LUM,P *); |
void dtestsq(int,int,P,LUM,P *); |
void dtestsq(int,int,P,LUM,P *); |
void dtestsql(P,ML,struct oDUM *,DCP *); |
void dtestsql(P,ML,struct oDUM *,DCP *); |
|
void ediffp(VL,P,V,P *); |
void estimatelc(VL,Q,DCP,VN,P *); |
void estimatelc(VL,Q,DCP,VN,P *); |
void eucum(register int,UM,UM,UM,UM); |
void eucum(register int,UM,UM,UM,UM); |
void exthp(VL,P,int,P *); |
void exthp(VL,P,int,P *); |
Line 1636 void savep(FILE *,P); |
|
Line 1832 void savep(FILE *,P); |
|
void savegf2n(FILE *,GF2N); |
void savegf2n(FILE *,GF2N); |
void savegfpn(FILE *,GFPN); |
void savegfpn(FILE *,GFPN); |
void savegfs(FILE *,GFS); |
void savegfs(FILE *,GFS); |
|
void savedalg(FILE *,DAlg); |
void savelm(FILE *,LM); |
void savelm(FILE *,LM); |
void savemi(FILE *,MQ); |
void savemi(FILE *,MQ); |
void savecplx(FILE *,C); |
void savecplx(FILE *,C); |
Line 1661 void loadgf2n(FILE *,GF2N *); |
|
Line 1858 void loadgf2n(FILE *,GF2N *); |
|
void loadgfpn(FILE *,GFPN *); |
void loadgfpn(FILE *,GFPN *); |
void loadgfs(FILE *,GFS *); |
void loadgfs(FILE *,GFS *); |
void loadgfsn(FILE *,GFSN *); |
void loadgfsn(FILE *,GFSN *); |
|
void loaddalg(FILE *,DAlg *); |
void loadlm(FILE *,LM *); |
void loadlm(FILE *,LM *); |
void loadmi(FILE *,MQ *); |
void loadmi(FILE *,MQ *); |
void loadcplx(FILE *,C *); |
void loadcplx(FILE *,C *); |
Line 1852 int berlekampsf(UM p,int df,UM *tab,UM *r); |
|
Line 2050 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,int degbound,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 2362 void afctrmain(VL vl,P p0,P p,int init,DCP *dcp); |
|
Line 2560 void afctrmain(VL vl,P p0,P p,int init,DCP *dcp); |
|
int divtmp(VL vl,int mod,P p1,P p2,P *q); |
int divtmp(VL vl,int mod,P p1,P p2,P *q); |
int divtdcmp(VL vl,int mod,P p1,P p2,P *q); |
int divtdcmp(VL vl,int mod,P p1,P p2,P *q); |
void GC_gcollect(); |
void GC_gcollect(); |
|
|
|
/* IMAT */ |
|
void Pnewimat(NODE, IMAT *); |
|
void PChsgnI(NODE, IMAT *); |
|
void Pm2Im(NODE, IMAT *); |
|
void PIm2m(NODE, MAT *); |
|
|
|
void AddMatI(VL, IMAT, IMAT, IMAT *); |
|
void MulMatI(VL, IMAT, IMAT, IMAT *); |
|
void MulMatG(VL, Obj, Obj, Obj *); |
|
void MulrMatI(VL, Obj, Obj, Obj *); |
|
void MulMatS(VL, IMAT, IMAT, IMAT *); |
|
void PutIent(IMAT, int, int, Obj); |
|
void GetIent(IMAT, int, int, Obj); |
|
void GetIbody(IMAT, int, int, Obj *); |
|
void ChsgnI(IMAT, IMAT *c); |
|
void AppendIent(IMAT, int, int, Obj); |
|
void MEnt(int, int, int, Obj, IENT *); |
|
void GetForeIent(IMATC *, IENT *, int *); |
|
void GetNextIent(IMATC *, IENT *, int *); |
|
void SubMatI(VL, IMAT, IMAT, IMAT *); |
|
/* IMAT */ |
|
|
|
Z stoz(int c); |
|
Z utoz(unsigned int c); |
|
Z qtoz(Q n); |
|
Q ztoq(Z n); |
|
Z chsgnz(Z n); |
|
Z simpz(Z n); |
|
Z dupz(Z n); |
|
Z absz(Z n); |
|
Z addz(Z n1,Z n2); |
|
Z subz(Z n1,Z n2); |
|
Z mulz(Z n1,Z n2); |
|
Z divsz(Z n1,Z n2); |
|
Z divz(Z n1,Z n2,Z *rem); |
|
Z gcdz(Z n1,Z n2); |
|
Z gcdz_cofactor(Z n1,Z n2,Z *c1,Z *c2); |
|
Z estimate_array_gcdz(Z *a,int n); |
|
Z array_gcdz(Z *a,int n); |
|
void mkwcz(int k,int l,Z *t); |
|
int remzi(Z n,int m); |
|
|
|
|
#if 0 && !defined(VISUAL) |
#if 0 && !defined(VISUAL) |
void bzero(const void *,int); |
void bzero(const void *,int); |