Annotation of OpenXM_contrib2/asir2000/include/ca.h, Revision 1.1
1.1 ! noro 1: /* $OpenXM: OpenXM/src/asir99/include/ca.h,v 1.1.1.1 1999/11/10 08:12:30 noro Exp $ */
! 2: #include <stdio.h>
! 3:
! 4: #if defined(hpux)
! 5: #include <netinet/in.h>
! 6: # define setbuffer(FP,buf,siz) setvbuf(FP,buf,_IOFBF,siz)
! 7: #endif
! 8:
! 9: #if defined(VISUAL)
! 10: #include <stdlib.h>
! 11: #endif
! 12:
! 13: #if defined(__MWERKS__)
! 14: #define THINK_C
! 15: #endif
! 16:
! 17: #if defined(linux) || (defined(sun) && !defined(SYSV)) || defined(news5000) || (defined(mips) && defined(ultrix))
! 18: #include <alloca.h>
! 19: #endif
! 20:
! 21: #if (defined(sun) && defined(SYSV))
! 22: #define alloca(x) __builtin_alloca(x)
! 23: #endif
! 24:
! 25: #if defined(VISUAL)
! 26: #include <malloc.h>
! 27: #endif
! 28:
! 29: #if 0
! 30: #include <sys/types.h>
! 31: typedef caddr_t pointer;
! 32: #endif
! 33:
! 34: #ifndef PARI
! 35: /* for THINK C ... */
! 36: #define PARI 1
! 37: #endif
! 38:
! 39: typedef void * pointer;
! 40:
! 41: #if defined(VISUAL)
! 42: #include <string.h>
! 43: #define index(s,c) strchr(s,c)
! 44: #define bzero(s,len) memset(s,0,len)
! 45: #define bcopy(x,y,len) memcpy(y,x,len)
! 46: #endif
! 47:
! 48: #define COPY(a,b) ((b)=(a))
! 49: #define FREEN(p)
! 50: #define FREEQ(p)
! 51: #define FREE(p)
! 52: #define INITRC(p)
! 53:
! 54: /* data structures */
! 55:
! 56: #define O_N 1
! 57: #define O_P 2
! 58: #define O_R 3
! 59: #define O_LIST 4
! 60: #define O_VECT 5
! 61: #define O_MAT 6
! 62: #define O_STR 7
! 63: #define O_COMP 8
! 64: #define O_DP 9
! 65: #define O_USINT 10
! 66: #define O_ERR 11
! 67: #define O_GF2MAT 12
! 68: #define O_MATHCAP 13
! 69: #define O_F 14
! 70: #define O_GFMMAT 15
! 71: #define O_VOID -1
! 72:
! 73: #define N_Q 0
! 74: #define N_R 1
! 75: #define N_A 2
! 76: #define N_B 3
! 77: #define N_C 4
! 78: #define N_M 5
! 79: #define N_LM 6
! 80: #define N_GF2N 7
! 81: #define N_GFPN 8
! 82:
! 83: #define ORD_REVGRADLEX 0
! 84: #define ORD_GRADLEX 1
! 85: #define ORD_LEX 2
! 86:
! 87: #if LONG_IS_32BIT
! 88: #if defined(VISUAL)
! 89: typedef _int64 L;
! 90: typedef unsigned _int64 UL;
! 91: #else
! 92: typedef long long L;
! 93: typedef unsigned long long UL;
! 94: #endif
! 95: #else
! 96: typedef long L;
! 97: typedef unsigned long UL;
! 98: #endif
! 99:
! 100: typedef struct oN {
! 101: int p;
! 102: unsigned int b[1];
! 103: } *N;
! 104:
! 105: typedef struct oUP2 {
! 106: int w;
! 107: unsigned int b[1];
! 108: } *UP2;
! 109:
! 110: typedef struct _oUP2 {
! 111: int w;
! 112: unsigned int *b;
! 113: } *_UP2;
! 114:
! 115: #define UP2_DENSE 0
! 116: #define UP2_SPARSE 1
! 117:
! 118: typedef struct oGEN_UP2 {
! 119: int id;
! 120: UP2 dense;
! 121: UP2 sparse;
! 122: } *GEN_UP2;
! 123:
! 124: typedef struct oV {
! 125: char *name;
! 126: pointer attr;
! 127: pointer priv;
! 128: } *V;
! 129:
! 130: typedef struct oQ {
! 131: short id;
! 132: char nid;
! 133: char sgn;
! 134: N nm;
! 135: N dn;
! 136: } *Q;
! 137:
! 138: typedef struct oReal {
! 139: short id;
! 140: char nid;
! 141: char pad;
! 142: double body;
! 143: } *Real;
! 144:
! 145: typedef struct oAlg {
! 146: short id;
! 147: char nid;
! 148: char pad;
! 149: struct oObj *body;
! 150: } *Alg;
! 151:
! 152: typedef struct oBF {
! 153: short id;
! 154: char nid;
! 155: char pad;
! 156: long body[1];
! 157: } *BF;
! 158:
! 159: typedef struct oC {
! 160: short id;
! 161: char nid;
! 162: char pad;
! 163: struct oNum *r,*i;
! 164: } *C;
! 165:
! 166: typedef struct oLM {
! 167: short id;
! 168: char nid;
! 169: char pad;
! 170: struct oN *body;
! 171: } *LM;
! 172:
! 173: typedef struct oGF2N {
! 174: short id;
! 175: char nid;
! 176: char pad;
! 177: struct oUP2 *body;
! 178: } *GF2N;
! 179:
! 180: typedef struct oGFPN {
! 181: short id;
! 182: char nid;
! 183: char pad;
! 184: struct oUP *body;
! 185: } *GFPN;
! 186:
! 187: typedef struct oNum {
! 188: short id;
! 189: char nid;
! 190: char pad;
! 191: } *Num;
! 192:
! 193: typedef struct oMQ {
! 194: short id;
! 195: char nid;
! 196: char pad;
! 197: int cont;
! 198: } *MQ;
! 199:
! 200: typedef struct oP {
! 201: short id;
! 202: short pad;
! 203: V v;
! 204: struct oDCP *dc;
! 205: } *P;
! 206:
! 207: typedef struct oR {
! 208: short id;
! 209: short reduced;
! 210: P nm;
! 211: P dn;
! 212: } *R;
! 213:
! 214: typedef struct oVECT {
! 215: short id;
! 216: short pad;
! 217: int len;
! 218: pointer *body;
! 219: } *VECT;
! 220:
! 221: typedef struct oMAT {
! 222: short id;
! 223: short pad;
! 224: int row,col;
! 225: pointer **body;
! 226: } *MAT;
! 227:
! 228: typedef struct oGF2MAT {
! 229: short id;
! 230: short pad;
! 231: int row,col;
! 232: unsigned int **body;
! 233: } *GF2MAT, *GFMMAT;
! 234:
! 235: typedef struct oLIST {
! 236: short id;
! 237: short pad;
! 238: struct oNODE *body;
! 239: } *LIST;
! 240:
! 241: typedef struct oSTRING {
! 242: short id;
! 243: short pad;
! 244: char *body;
! 245: } *STRING;
! 246:
! 247: typedef struct oCOMP {
! 248: short id;
! 249: short type;
! 250: struct oObj *member[1];
! 251: } *COMP;
! 252:
! 253: typedef struct oDP {
! 254: short id;
! 255: short nv;
! 256: int sugar;
! 257: struct oMP *body;
! 258: } *DP;
! 259:
! 260: typedef struct oUSINT {
! 261: short id;
! 262: short pad;
! 263: unsigned body;
! 264: } *USINT;
! 265:
! 266: typedef struct oERR {
! 267: short id;
! 268: short pad;
! 269: struct oObj *body;
! 270: } *ERR;
! 271:
! 272: typedef struct oMATHCAP {
! 273: short id;
! 274: short pad;
! 275: struct oLIST *body;
! 276: } *MATHCAP;
! 277:
! 278: typedef struct oObj {
! 279: short id;
! 280: short pad;
! 281: } *Obj;
! 282:
! 283: typedef struct oDCP {
! 284: Q d;
! 285: P c;
! 286: struct oDCP *next;
! 287: } *DCP;
! 288:
! 289: typedef struct oMP {
! 290: struct oDL *dl;
! 291: P c;
! 292: struct oMP *next;
! 293: } *MP;
! 294:
! 295: typedef struct oDL {
! 296: int td;
! 297: int d[1];
! 298: } *DL;
! 299:
! 300: typedef struct oVL {
! 301: V v;
! 302: struct oVL *next;
! 303: } *VL;
! 304:
! 305: typedef struct oNODE {
! 306: pointer body;
! 307: struct oNODE *next;
! 308: } *NODE;
! 309:
! 310: typedef struct oUM {
! 311: int d;
! 312: int c[1];
! 313: } *UM;
! 314:
! 315: typedef struct oLUM {
! 316: int d;
! 317: int *c[1];
! 318: } *LUM;
! 319:
! 320: typedef struct oML {
! 321: int n;
! 322: int mod;
! 323: int bound;
! 324: pointer c[1];
! 325: } *ML;
! 326:
! 327: typedef struct oUB {
! 328: int d;
! 329: N c[1];
! 330: } *UB;
! 331:
! 332: typedef struct oVN {
! 333: V v;
! 334: int n;
! 335: } *VN;
! 336:
! 337: typedef struct oUP {
! 338: int d;
! 339: Num c[1];
! 340: } *UP;
! 341:
! 342: typedef struct oDUM {
! 343: int n;
! 344: UM f;
! 345: } *DUM;
! 346:
! 347: struct order_pair {
! 348: int order, length;
! 349: };
! 350:
! 351: struct order_spec {
! 352: int id;
! 353: Obj obj;
! 354: int nv;
! 355: union {
! 356: int simple;
! 357: struct {
! 358: int length;
! 359: struct order_pair *order_pair;
! 360: } block;
! 361: struct {
! 362: int row;
! 363: int **matrix;
! 364: } matrix;
! 365: } ord;
! 366: };
! 367:
! 368: /* structure for cputime */
! 369:
! 370: struct oEGT {
! 371: double exectime,gctime;
! 372: };
! 373:
! 374: /* constant */
! 375:
! 376: /* ground finite field specification */
! 377: #define FF_NOT_SET 0
! 378: #define FF_GFP 1
! 379: #define FF_GF2N 2
! 380: #define FF_GFPN 3
! 381:
! 382: #define INDEX 100
! 383:
! 384: #if USE_FLOAT
! 385: typedef float ModNum;
! 386: #define NPrimes 536
! 387: #else
! 388: typedef unsigned int ModNum;
! 389: #define NPrimes 13681
! 390: #endif
! 391:
! 392: /* general macros */
! 393: #define MAX(a,b) ((a) > (b) ? (a) : (b) )
! 394: #define MIN(a,b) ((a) > (b) ? (b) : (a) )
! 395: #ifdef ABS
! 396: #undef ABS
! 397: #endif
! 398: #define ABS(a) ((a)>0?(a):-(a))
! 399: #define ID(p) ((p)->id)
! 400: #define OID(p) (((Obj)(p))->id)
! 401: #define NID(p) (((Num)(p))->nid)
! 402: #define BDY(p) ((p)->body)
! 403: #define VR(p) ((p)->v)
! 404: #define NAME(p) ((p)->name)
! 405: #define NEXT(p) ((p)->next)
! 406: #define NM(q) ((q)->nm)
! 407: #define DN(q) ((q)->dn)
! 408: #define SGN(q) ((q)->sgn)
! 409: #define DC(p) ((p)->dc)
! 410: #define COEF(p) ((p)->c)
! 411: #define DEG(p) ((p)->d)
! 412: #define PL(n) ((n)->p)
! 413: #define BD(n) ((n)->b)
! 414: #define CONT(a) ((a)->cont)
! 415: #define UDEG(f) BD(NM(DEG(DC(f))))[0]
! 416: #define UCOEF(f) (COEF(DC(f)))
! 417: #define LC(f) (NUM(f)?(f):COEF(DC(f)))
! 418:
! 419: /* memory allocators (W_... : uses alloca) */
! 420:
! 421: #if 0
! 422: #define MALLOC(d) Risa_GC_malloc(d)
! 423: #define MALLOC_ATOMIC(d) Risa_GC_malloc_atomic(d)
! 424: #define REALLOC(p,d) Risa_GC_realloc(p,d)
! 425: #else
! 426: #define MALLOC(d) GC_malloc(d)
! 427: #define MALLOC_ATOMIC(d) GC_malloc_atomic(d)
! 428: #define REALLOC(p,d) GC_realloc(p,d)
! 429: #endif
! 430: #define CALLOC(d,e) MALLOC((d)*(e))
! 431:
! 432: #if (defined(__GNUC__) || defined(vax) || defined(apollo) || defined(alloca) || defined(VISUAL))
! 433: #define ALLOCA(d) alloca(d)
! 434: #else
! 435: #define ALLOCA(d) MALLOC(d)
! 436: #endif
! 437:
! 438: #define TRUESIZE(type,n,atype) (sizeof(struct type)+MAX((n),0)*sizeof(atype))
! 439: #define NALLOC(d) ((N)MALLOC_ATOMIC(TRUESIZE(oN,(d)-1,int)))
! 440: #define UMALLOC(d) ((UM)MALLOC(TRUESIZE(oUM,d,int)))
! 441: #define UPALLOC(d) ((UP)MALLOC(TRUESIZE(oUP,(d),Num)))
! 442: #define C_UMALLOC(d) ((UM)MALLOC(TRUESIZE(oUM,d,int)))
! 443: #define MLALLOC(d) ((ML)MALLOC(TRUESIZE(oML,d,pointer)))
! 444:
! 445: #define W_ALLOC(d) ((int *)ALLOCA(((d)+1)*sizeof(int)))
! 446: #define W_CALLOC(n,type,p) \
! 447: ((p)=(type *)ALLOCA(((n)+1)*sizeof(type)),\
! 448: bzero((char *)(p),(int)(((n)+1)*sizeof(type))))
! 449: #define W_UMALLOC(d) ((UM)ALLOCA(TRUESIZE(oUM,d,int)))
! 450: #define W_UPALLOC(d) ((UP)ALLOCA(TRUESIZE(oUP,(d),Num)))
! 451: #define W_MLALLOC(d) ((ML)ALLOCA(TRUESIZE(oML,d,pointer)))
! 452: #define W_LUMALLOC(n,bound,p)\
! 453: {\
! 454: LUM ___q___;\
! 455: int ___i___,**___c___;\
! 456: (___q___) = (LUM)ALLOCA(TRUESIZE(oLUM,(n),int *));\
! 457: DEG(___q___) = n;\
! 458: for ( ___i___ = 0, ___c___ = (int **)COEF(___q___); ___i___ <= n; ___i___++ ) {\
! 459: ___c___[___i___] = (int *)ALLOCA(((bound)+1)*sizeof(int));\
! 460: bzero((char *)___c___[___i___],((bound)+1)*sizeof(int));\
! 461: }\
! 462: (p) = ___q___;\
! 463: }
! 464:
! 465: #define NEWUP2(q,w)\
! 466: ((q)=(UP2)MALLOC_ATOMIC(TRUESIZE(oUP2,(w)-1,unsigned int)),\
! 467: bzero((char *)(q)->b,(w)*sizeof(unsigned int)))
! 468: #define W_NEWUP2(q,w)\
! 469: ((q)=(UP2)ALLOCA(TRUESIZE(oUP2,(w)-1,unsigned int)),\
! 470: bzero((char *)(q)->b,(w)*sizeof(unsigned int)))
! 471: #define W_NEW_UP2(q,w)\
! 472: ((q).b=(unsigned int *)ALLOCA((w)*sizeof(unsigned int)))
! 473:
! 474: /* cell allocators */
! 475: #define NEWQ(q) ((q)=(Q)MALLOC(sizeof(struct oQ)),OID(q)=O_N,NID(q)=N_Q)
! 476: #define NEWMQ(q) ((q)=(MQ)MALLOC_ATOMIC(sizeof(struct oMQ)),OID(q)=O_N,NID(q)=N_M)
! 477: #define NEWP(p) ((p)=(P)MALLOC(sizeof(struct oP)),OID(p)=O_P)
! 478: #define NEWR(r) ((r)=(R)MALLOC(sizeof(struct oR)),OID(r)=O_R,(r)->reduced=0)
! 479: #define NEWLIST(l) ((l)=(LIST)MALLOC(sizeof(struct oLIST)),OID(l)=O_LIST)
! 480: #define NEWVECT(l) ((l)=(VECT)MALLOC(sizeof(struct oVECT)),OID(l)=O_VECT)
! 481: #define NEWSTR(l) ((l)=(STRING)MALLOC(sizeof(struct oSTRING)),OID(l)=O_STR)
! 482: #define NEWCOMP(c,n) ((c)=(COMP)MALLOC(sizeof(struct oCOMP)+((n)-1)*sizeof(Obj)),OID(c)=O_COMP)
! 483: #define NEWDP(d) ((d)=(DP)MALLOC(sizeof(struct oDP)),OID(d)=O_DP)
! 484: #define NEWUSINT(u) ((u)=(USINT)MALLOC_ATOMIC(sizeof(struct oUSINT)),OID(u)=O_USINT)
! 485: #define NEWERR(e) ((e)=(ERR)MALLOC(sizeof(struct oERR)),OID(e)=O_ERR)
! 486: #define NEWMATHCAP(e) ((e)=(MATHCAP)MALLOC(sizeof(struct oMATHCAP)),OID(e)=O_MATHCAP)
! 487:
! 488: #define NEWNODE(a) ((a)=(NODE)MALLOC(sizeof(struct oNODE)))
! 489: #define NEWDC(dc) ((dc)=(DCP)MALLOC(sizeof(struct oDCP)))
! 490: #define NEWV(v) ((v)=(V)MALLOC(sizeof(struct oV)))
! 491: #define NEWVL(vl) ((vl)=(VL)MALLOC(sizeof(struct oVL)))
! 492: #define NEWMP(m) ((m)=(MP)MALLOC(sizeof(struct oMP)))
! 493:
! 494: #define NEWMAT(l) ((l)=(MAT)MALLOC(sizeof(struct oMAT)),OID(l)=O_MAT)
! 495: #define NEWGF2MAT(l) ((l)=(GF2MAT)MALLOC(sizeof(struct oGF2MAT)),OID(l)=O_GF2MAT)
! 496: #define NEWGFMMAT(l) ((l)=(GFMMAT)MALLOC(sizeof(struct oGF2MAT)),OID(l)=O_GFMMAT)
! 497: #define NEWReal(q) ((q)=(Real)MALLOC_ATOMIC(sizeof(struct oReal)),OID(q)=O_N,NID(q)=N_R)
! 498: #define NEWAlg(r) ((r)=(Alg)MALLOC(sizeof(struct oAlg)),OID(r)=O_N,NID(r)=N_A)
! 499: #define NEWBF(q,l) ((q)=(BF)MALLOC_ATOMIC(TRUESIZE(oBF,(l)-1,long)),OID(q)=O_N,NID(q)=N_B)
! 500: #define NEWC(r) ((r)=(C)MALLOC(sizeof(struct oC)),OID(r)=O_N,NID(r)=N_C)
! 501: #define NEWLM(r) ((r)=(LM)MALLOC(sizeof(struct oLM)),OID(r)=O_N,NID(r)=N_LM)
! 502: #define NEWGF2N(r) ((r)=(GF2N)MALLOC(sizeof(struct oGF2N)),OID(r)=O_N,NID(r)=N_GF2N)
! 503: #define NEWGFPN(r) ((r)=(GFPN)MALLOC(sizeof(struct oGFPN)),OID(r)=O_N,NID(r)=N_GFPN)
! 504: #define NEWDL(d,n) \
! 505: ((d)=(DL)MALLOC_ATOMIC(TRUESIZE(oDL,(n)-1,int)),bzero((char *)(d),TRUESIZE(oDL,(n)-1,int)))
! 506:
! 507: #define MKP(v,dc,p) \
! 508: (!DEG(dc)?((p)=COEF(dc)):(NEWP(p),VR(p)=(v),DC(p)=(dc),(p)))
! 509: #define MKV(v,p) \
! 510: (NEWP(p),VR(p)=(v),NEWDC(DC(p)),\
! 511: DEG(DC(p))=ONE,COEF(DC(p))=(P)ONE,NEXT(DC(p))=0)
! 512: #define MKRAT(n,d,r,p) \
! 513: (NEWR(p),NM(p)=(n),DN(p)=(d),(p)->reduced=(r))
! 514: #define MKMV(v,p) \
! 515: (NEWP(p),VR(p)=(v),NEWDC(DC(p)),\
! 516: DEG(DC(p))=ONE,COEF(DC(p))=(P)ONEM,NEXT(DC(p))=0)
! 517: #define MKNODE(a,b,c) \
! 518: (NEWNODE(a),(a)->body=(pointer)b,NEXT(a)=(NODE)(c))
! 519: #define MKLIST(a,b) (NEWLIST(a),(a)->body=(NODE)(b))
! 520: #define MKVECT(m,l) \
! 521: (NEWVECT(m),(m)->len=(l),(m)->body=(pointer *)CALLOC((l),sizeof(pointer)))
! 522: #define MKMAT(m,r,c) \
! 523: (NEWMAT(m),(m)->row=(r),(m)->col=(c),(m)->body=(pointer **)almat_pointer((r),(c)))
! 524: #define TOGF2MAT(r,c,b,m) (NEWGF2MAT(m),(m)->row=(r),(m)->col=(c),(m)->body=(b))
! 525: #define TOGFMMAT(r,c,b,m) (NEWGFMMAT(m),(m)->row=(r),(m)->col=(c),(m)->body=(b))
! 526: #define MKSTR(a,b) (NEWSTR(a),(a)->body=(char *)(b))
! 527: #define MKDP(n,m,d) (NEWDP(d),(d)->nv=(n),BDY(d)=(m))
! 528: #define MKLM(b,l) (!(b)?(l)=0:(NEWLM(l),(l)->body=(b),(l)))
! 529: #define MKGF2N(b,l) (!(b)?(l)=0:(NEWGF2N(l),(l)->body=(b),(l)))
! 530: #define MKGFPN(b,l) (!(b)?(l)=0:(NEWGFPN(l),(l)->body=(b),(l)))
! 531: #define MKUSINT(u,b) (NEWUSINT(u),(u)->body=(unsigned)(b))
! 532: #define MKERR(e,b) (NEWERR(e),(e)->body=(Obj)(b))
! 533: #define MKMATHCAP(e,b) (NEWMATHCAP(e),(e)->body=(LIST)(b))
! 534:
! 535: #define NEXTDC(r,c) \
! 536: if(!(r)){NEWDC(r);(c)=(r);}else{NEWDC(NEXT(c));(c)=NEXT(c);}
! 537: #define NEXTNODE(r,c) \
! 538: if(!(r)){NEWNODE(r);(c)=(r);}else{NEWNODE(NEXT(c));(c)=NEXT(c);}
! 539: #define NEXTMP(r,c) \
! 540: if(!(r)){NEWMP(r);(c)=(r);}else{NEWMP(NEXT(c));(c)=NEXT(c);}
! 541:
! 542: /* convertors */
! 543: #define NTOQ(n,s,q) \
! 544: (!(n)?((q)=0):(NEWQ(q),SGN(q)=(s),NM(q)=(n),DN(q)=0,(q)))
! 545: #define NDTOQ(n,d,s,q) \
! 546: ((!(d)||UNIN(d))?NTOQ(n,s,q):(NEWQ(q),SGN(q)=(s),NM(q)=(n),DN(q)=(d),(q)))
! 547: #define DUPQ(p,q) \
! 548: (NEWQ(q),SGN(q)=SGN(p),NM(q)=NM(p),DN(q)=DN(p))
! 549: #define STOQ(n,q) \
! 550: ((!(n))?((q)=(Q)NULL):(NEWQ(q),\
! 551: SGN(q)=((n)>0?1:-1),NM(q)=NALLOC(1),\
! 552: PL(NM(q))=1,BD(NM(q))[0]=ABS(n),DN(q)=0,(q)))
! 553: #define UTOMQ(a,b) \
! 554: ((a)?(NEWMQ(b),CONT(b)=(unsigned int)(a),(b)):((b)=0))
! 555: #define STOMQ(a,b) \
! 556: ((a)?(NEWMQ(b),CONT(b)=(a),(b)):((b)=0))
! 557: #define UTON(u,n) \
! 558: ((!(u))?((n)=(N)NULL):((n)=NALLOC(1),PL(n)=1,BD(n)[0]=(unsigned int)(u),(n)))
! 559: #define UTOQ(n,q) \
! 560: ((!(n))?((q)=(Q)NULL):(NEWQ(q),\
! 561: SGN(q)=1,NM(q)=NALLOC(1),\
! 562: PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q)))
! 563: #define QTOS(q) (!(q)?0:SGN(q)*((int)BD(NM(q))[0]))
! 564: #define STON(i,n)\
! 565: (i?((n)=NALLOC(1),PL(n)=1,BD(n)[0]=(i),(n)):((n)=(N)0))
! 566: #define PTOR(a,b) \
! 567: (!(a)?((b)=0):(NEWR(b),NM(b)=(a),DN(b)=(P)ONE,(b)->reduced=1,(b)))
! 568: #define RTOS(a) (!(a)?0:QTOS((Q)NM((R)a)))
! 569: #define MKReal(a,b) (!(a)?((b)=0):(NEWReal(b),BDY(b)=(a),(b)))
! 570: #define MKAlg(b,r) \
! 571: (!(b)?((r)=0):NUM(b)?((r)=(Alg)(b)):(NEWAlg(r),BDY(r)=(Obj)(b),(r)))
! 572:
! 573: #define ToReal(a) (!(a)?(double)0.0:REAL(a)?BDY((Real)a):RATN(a)?RatnToReal((Q)a):0)
! 574:
! 575: /* predicates */
! 576: #define NUM(p) (OID(p)==O_N)
! 577: #define RAT(p) (OID(p)==O_R)
! 578: #define INT(q) (!DN((Q)q))
! 579: #define RATN(a) (NID(a)==N_Q)
! 580: #define REAL(a) (NID(a)==N_R)
! 581: #define SFF(a) (NID(a)==N_M)
! 582: #define UNIQ(q) ((q)&&NUM(q)&&RATN(q)&&(SGN((Q)q)==1)&&UNIN(NM((Q)q))&&(!DN((Q)q)))
! 583: #define UNIMQ(q) ((q)&&NUM(q)&&SFF(q)&&(CONT((MQ)q)==1))
! 584: #define MUNIQ(q) ((q)&&NUM(q)&&RATN(q)&&(SGN((Q)q)==-1)&&UNIN(NM((Q)q))&&(!DN((Q)q)))
! 585: #define MUNIMQ(q) ((q)&&NUM(q)&&SFF(q)&&(CONT((MQ)q)==-1))
! 586: #define UNIN(n) ((n)&&(PL(n)==1)&&(BD(n)[0]==1))
! 587: #define EVENN(n) ((!(n))||(!(BD(n)[0]%2)))
! 588:
! 589:
! 590: /* externals */
! 591: #if 0
! 592: double NatToReal();
! 593: double RatnToReal();
! 594: #endif
! 595:
! 596: extern struct oR oUNIR;
! 597: extern struct oQ oUNIQ;
! 598: extern struct oMQ oUNIMQ;
! 599: extern struct oN oUNIN;
! 600: extern struct oUP2 oONEUP2;
! 601: extern struct oV oVAR[];
! 602: extern struct oV oPVAR[];
! 603: extern struct oVL oVLIST[];
! 604: extern struct oVL oPVLIST[];
! 605: extern VL CO,ALG;
! 606: extern VL PVL;
! 607: extern R ONER;
! 608: extern Q ONE;
! 609: extern MQ ONEM;
! 610: extern LM ONELM;
! 611: extern N ONEN;
! 612: extern UP2 ONEUP2;
! 613:
! 614: extern FILE *asir_out;
! 615: #if defined(__GNUC__) || defined(THINK_C)
! 616: extern const int sprime[];
! 617: extern const int lprime[];
! 618: #else
! 619: extern int sprime[];
! 620: extern int lprime[];
! 621: #endif
! 622:
! 623: extern void (*addnumt[])();
! 624: extern void (*subnumt[])();
! 625: extern void (*mulnumt[])();
! 626: extern void (*divnumt[])();
! 627: extern void (*pwrnumt[])();
! 628: extern int (*cmpnumt[])();
! 629: extern void (*chsgnnumt[])();
! 630:
! 631: /* prototypes */
! 632: int compui(VL,USINT,USINT);
! 633:
! 634: void powermodup(UP,UP *);
! 635: void hybrid_powermodup(UP,UP *);
! 636:
! 637: void powertabup(UP,UP,UP *);
! 638: void hybrid_powertabup(UP,UP,UP *);
! 639:
! 640: void generic_powermodup(UP,UP,Q,UP *);
! 641: void hybrid_generic_powermodup(UP,UP,Q,UP *);
! 642:
! 643: void powermod1up(UP,UP *);
! 644: void hybrid_rembymulup_special(int,UP,UP,UP,UP *);
! 645: void hybrid_tmulup(int,UP,UP,int,UP *);
! 646: void hybrid_squareup(int,UP,UP *);
! 647: void hybrid_mulup(int,UP,UP,UP *);
! 648:
! 649: void getmod_lm(N *);
! 650:
! 651: int maxblenup(UP);
! 652: void monicup(UP,UP *);
! 653: void simpup(UP,UP *);
! 654: void simpnum(Num,Num *);
! 655: void decompp(P,Q,P *,P *);
! 656: void truncp(P,Q,P *);
! 657: void uremp(P,P,P *);
! 658: void ugcdp(P,P,P *);
! 659: void reversep(P,Q,P *);
! 660: void invmodp(P,Q,P *);
! 661: void addup(UP,UP,UP *);
! 662: void subup(UP,UP,UP *);
! 663: void chsgnup(UP,UP *);
! 664: void mulup(UP,UP,UP *);
! 665: void tmulup(UP,UP,int,UP *);
! 666: void squareup(UP,UP *);
! 667: void remup(UP,UP,UP *);
! 668: void remup_destructive(UP,UP);
! 669: void qrup(UP,UP,UP *,UP *);
! 670: void qrup_destructive(UP,UP);
! 671: void gcdup(UP,UP,UP *);
! 672: void reverseup(UP,int,UP *);
! 673: void invmodup(UP,int,UP *);
! 674: void pwrup(UP,Q,UP *);
! 675: void squarep_gf2n(VL,P,P *);
! 676: void kmulp(VL,P,P,P *);
! 677: void ksquarep(VL,P,P *);
! 678: void kmulup(UP,UP,UP *);
! 679: void ksquareup(UP,UP *);
! 680: void extractup(UP,int,int,UP *);
! 681: void copyup(UP,UP);
! 682: void c_copyup(UP,int,pointer *);
! 683: void kmulupmain(UP,UP,UP *);
! 684: void ksquareupmain(UP,UP *);
! 685: void rembymulup(UP,UP,UP *);
! 686: void rembymulup_special(UP,UP,UP,UP *);
! 687: void tkmulup(UP,UP,int,UP *);
! 688: void shiftup(UP,int,UP *);
! 689: void set_degreeup(UP,int);
! 690: void decompup(UP,int,UP *,UP *);
! 691: void truncup(UP,int,UP *);
! 692: void uptofmarray(int,UP,ModNum *);
! 693: void fmarraytoup(ModNum *,int,UP *);
! 694: void uiarraytoup(unsigned int **,int,int,UP *);
! 695: void adj_coefup(UP,N,N,UP *);
! 696: void uptolmup(UP,UP *);
! 697: void remcup(UP,N,UP *);
! 698: void fft_mulup(UP,UP,UP *);
! 699: void fft_squareup(UP,UP *);
! 700: void trunc_fft_mulup(UP,UP,int,UP *);
! 701: void shoup_fft_mulup(UP,UP,UP *);
! 702: void shoup_fft_squareup(UP,UP *);
! 703: void shoup_trunc_fft_mulup(UP,UP,int,UP *);
! 704: void crup(ModNum **,int,int *,int,N,UP *);
! 705: void shoup_crup(ModNum **,int,int *,int,N,N,UP *);
! 706: void squareup_gf2n(UP,UP *);
! 707: void powermodup_gf2n(UP,UP *);
! 708: void generic_powermodup_gf2n(UP,UP,Q,UP *);
! 709: void tracemodup_gf2n(UP,UP,Q,UP *);
! 710: void tracemodup_gf2n_slow(UP,UP,Q,UP *);
! 711: void tracemodup_gf2n_tab(UP,UP,Q,UP *);
! 712: void square_rem_tab_up_gf2n(UP,UP *,UP *);
! 713: void powertabup_gf2n(UP,UP,UP *);
! 714: void find_root_gf2n(UP,GF2N *);
! 715:
! 716: int cmpdl_matrix(int,DL,DL);
! 717: int cmpdl_order_pair(int,DL,DL);
! 718: int cmpdl_elim(int,DL,DL);
! 719: int cmpdl_blexrev(int,DL,DL);
! 720: int cmpdl_bgradrev(int,DL,DL);
! 721: int cmpdl_brevrev(int,DL,DL);
! 722: int cmpdl_brevgradlex(int,DL,DL);
! 723: int cmpdl_bgradlex(int,DL,DL);
! 724: int cmpdl_blex(int,DL,DL);
! 725: int cmpdl_revgradlex(int,DL,DL);
! 726: int cmpdl_gradlex(int,DL,DL);
! 727: int cmpdl_revlex(int,DL,DL);
! 728: int cmpdl_lex(int,DL,DL);
! 729: int compd(VL,DP,DP);
! 730: void adddl(int,DL,DL,DL *);
! 731: void divsdc(VL,DP,P,DP *);
! 732: void muldc(VL,DP,P,DP *);
! 733: void muldm(VL,DP,MP,DP *);
! 734: void muld(VL,DP,DP,DP *);
! 735: void chsgnd(DP,DP *);
! 736: void subd(VL,DP,DP,DP *);
! 737: void addd(VL,DP,DP,DP *);
! 738: int sugard(MP);
! 739: void nodetod(NODE,DP *);
! 740: void dtop(VL,VL,DP,P *);
! 741: void ptod(VL,VL,P,DP *);
! 742: void initd(struct order_spec *);
! 743:
! 744: void _printdp(DP);
! 745: void _dp_sp_mod(DP,DP,int,DP *);
! 746: void _dp_mod(DP,int,NODE,DP *);
! 747: void _dp_red_mod(DP,DP,int,DP *);
! 748: void _dtop_mod(VL,VL,DP,P *);
! 749: void _mulmdm(VL,int,DP,MP,DP *);
! 750: void _mulmd(VL,int,DP,DP,DP *);
! 751: void _chsgnmd(int,DP,DP *);
! 752: void _submd(VL,int,DP,DP,DP *);
! 753: void _addmd(VL,int,DP,DP,DP *);
! 754: void _mdtop(VL,int,VL,DP,P *);
! 755: void divsmdc(VL,int,DP,P,DP *);
! 756: void mulmdc(VL,int,DP,P,DP *);
! 757: void mulmdm(VL,int,DP,MP,DP *);
! 758: void mulmd(VL,int,DP,DP,DP *);
! 759: void chsgnmd(int,DP,DP *);
! 760: void submd(VL,int,DP,DP,DP *);
! 761: void addmd(VL,int,DP,DP,DP *);
! 762: void mdtop(VL,int,VL,DP,P *);
! 763: void mptomd(VL,int,VL,P,DP *);
! 764: void ptomd(VL,int,VL,P,DP *);
! 765: int p_mag(P);
! 766: int n_bits(N);
! 767: void gcdBinary_27n(N,N,N *);
! 768: void rtime_init(void);
! 769: void setmod_gf2n(P);
! 770: void mt_sgenrand(unsigned long);
! 771: unsigned long mt_genrand(void);
! 772: #if defined(VISUAL)
! 773: void srandom(unsigned int);
! 774: unsigned int random(void);
! 775: #endif
! 776: void gcdbmodn(N,N,N *);
! 777: void gcdbinn(N,N,N *);
! 778: void gcdmodn(N,N,N *);
! 779: void gcdaccn(N,N,N *);
! 780: void gcdEuclidn(N,N,N *);
! 781: void GC_free(void *);
! 782: void FFT_primes(int,int *,int *,int *);
! 783: int FFT_pol_product(unsigned int,unsigned int *, unsigned int,unsigned int *,
! 784: unsigned int *,int,unsigned int *);
! 785: int FFT_pol_square(unsigned int,unsigned int *,
! 786: unsigned int *,int,unsigned int *);
! 787: void dcptolist(DCP,LIST *);
! 788: void gcdprsmp(VL,int,P,P,P *);
! 789: void mult_mod_tab(UM,int,UM *,UM,int);
! 790: int nfctr_mod(UM,int);
! 791: int irred_check(UM,int);
! 792: void modfctrp(P,int,int,DCP *);
! 793: void pf_init(void);
! 794: void binaryton(char *,N *);
! 795: void hexton(char *,N *);
! 796: void ptolmp(P,P *);
! 797: void lmptop(P,P *);
! 798: void ulmptoum(int,UP,UM);
! 799: void objtobobj(int,Obj,Obj *);
! 800: void bobjtoobj(int,Obj,Obj *);
! 801: void numtobnum(int,Num,Num *);
! 802: void bnumtonum(int,Num,Num *);
! 803: void ptobp(int,P,P *);
! 804: void bptop(int,P,P *);
! 805: void listtoblist(int,LIST,LIST *);
! 806: void blisttolist(int,LIST,LIST *);
! 807: void vecttobvect(int,VECT,VECT *);
! 808: void bvecttovect(int,VECT,VECT *);
! 809: void mattobmat(int,MAT,MAT *);
! 810: void bmattomat(int,MAT,MAT *);
! 811: void n32ton27(N,N *);
! 812: void n27ton32(N,N *);
! 813: void kmulum(int,UM,UM,UM);
! 814: void saveobj(FILE *,Obj);
! 815: void endian_init(void);
! 816: void write_char(FILE *,unsigned char *);
! 817: void write_short(FILE *,unsigned short *);
! 818: void write_int(FILE *,unsigned int *);
! 819: void write_double(FILE *,double *);
! 820: void write_intarray(FILE *,unsigned int *,int);
! 821: void write_string(FILE *,unsigned char *,int);
! 822: void savestr(FILE *,char *);
! 823: void loadstr(FILE *,char **);
! 824: void savevl(FILE *,VL);
! 825: void loadvl(FILE *);
! 826: void skipvl(FILE *);
! 827: void savev(FILE *,V);
! 828: void loadv(FILE *,V *);
! 829: int save_convv(V);
! 830: V load_convv(int);
! 831: void swap_bytes(char *,int,int);
! 832: void read_char(FILE *,unsigned char *);
! 833: void read_short(FILE *,unsigned short *);
! 834: void read_int(FILE *,unsigned int *);
! 835: void read_double(FILE *,double *);
! 836: void read_intarray(FILE *,unsigned int *,int);
! 837: void read_string(FILE *,unsigned char *,int);
! 838: void loadobj(FILE *,Obj *);
! 839: void invum(int,UM,UM,UM);
! 840: void addarray_to(unsigned int *,int,unsigned int *,int);
! 841: void muln_1(unsigned int *,int,unsigned int,unsigned int *);
! 842: unsigned int divn_1(unsigned int *,int,unsigned int,unsigned int *);
! 843: void ptoup(P,UP *);
! 844: void uptop(UP,P *);
! 845: void printnum(Num);
! 846: void printv(VL,V);
! 847: void kmulq(Q,Q,Q *);
! 848: void bshiftn(N,int,N *);
! 849: void remn(N,N,N*);
! 850: void simplm(LM,LM *);
! 851: void qtolm(Q,LM *);
! 852: int qpcheck(Obj);
! 853: int headsgn(P);
! 854: void adjsgn(P,DCP);
! 855: void setmod_g2n(P);
! 856: void simpgf2n(GF2N,GF2N *);
! 857: void ptogf2n(Obj,GF2N *);
! 858: void gf2ntop(GF2N,P *);
! 859: void gf2ntovect(GF2N,VECT *);
! 860: void squaregf2n(GF2N,GF2N *);
! 861: void randomgf2n(GF2N *);
! 862: void invgf2n(GF2N,GF2N *);
! 863: void kmuln(N,N,N *);
! 864: void extractn(N,int,int,N *);
! 865: void copyn(N,int,int *);
! 866: void kmulnmain(N,N,N *);
! 867: int qcoefp(Obj);
! 868: int qcoefr(Obj);
! 869: int get_allocwords(void);
! 870: double get_clock(void);
! 871: void get_eg(struct oEGT *);
! 872: void printtime(struct oEGT *,struct oEGT *,double);
! 873: void init_eg(struct oEGT *);
! 874: void add_eg(struct oEGT *,struct oEGT *,struct oEGT *);
! 875: void print_eg(char *,struct oEGT *);
! 876: void print_split_eg(struct oEGT *,struct oEGT *);
! 877: void print_split_e(struct oEGT *,struct oEGT *);
! 878: void suspend_timer(void);
! 879: void resume_timer(void);
! 880: void reset_engine(void);
! 881: void notdef(VL,Obj,Obj,Obj *);
! 882: void error(char *);
! 883: void ptoup2(P,UP2 *);
! 884: void ptoup2_sparse(P,UP2 *);
! 885: void up2top(UP2,P *);
! 886: void up2tovect(UP2,VECT *);
! 887: void up2ton(UP2,Q *);
! 888: void ntoup2(Q,UP2 *);
! 889: void gen_simpup2(UP2,GEN_UP2,UP2 *);
! 890: void gen_simpup2_destructive(UP2,GEN_UP2);
! 891: void gen_invup2(UP2,GEN_UP2,UP2 *);
! 892: void gen_pwrmodup2(UP2,Q,GEN_UP2,UP2 *);
! 893: void simpup2(UP2,UP2,UP2 *);
! 894: int degup2(UP2);
! 895: int degup2_sparse(UP2);
! 896: int degup2_1(unsigned int);
! 897: void addup2(UP2,UP2,UP2 *);
! 898: void subup2(UP2,UP2,UP2 *);
! 899: void mulup2_n1(unsigned int *,int,unsigned int,unsigned int *);
! 900: void mulup2_nh(unsigned int *,int,unsigned int,unsigned int *);
! 901: void _mulup2_1(UP2,unsigned int,UP2);
! 902: void _mulup2_h(UP2,unsigned int,UP2);
! 903: void mulup2(UP2,UP2,UP2 *);
! 904: void _kmulup2_(unsigned int *,unsigned int *,int,unsigned int *);
! 905: void _mulup2_nn(unsigned int *,unsigned int *,int,unsigned int *);
! 906: void _mulup2(UP2,UP2,UP2);
! 907: void _mulup2_(_UP2,_UP2,_UP2);
! 908: void squareup2(UP2,UP2 *);
! 909: void _adjup2(UP2);
! 910: void _adjup2_(_UP2);
! 911: void _addup2(UP2,UP2,UP2);
! 912: void _addup2_destructive(UP2,UP2);
! 913: void _addup2_(_UP2,_UP2,_UP2);
! 914: void _addtoup2_(_UP2,_UP2);
! 915: unsigned int mulup2_bb(unsigned int,unsigned int);
! 916: void init_up2_tab(void);
! 917: unsigned int quoup2_11(unsigned int,unsigned int);
! 918: void divup2_1(unsigned int,unsigned int,int,int,unsigned int *,unsigned int *);
! 919: void qrup2(UP2,UP2,UP2 *,UP2 *);
! 920: void _qrup2(UP2,UP2,UP2,UP2);
! 921: void remup2(UP2,UP2,UP2 *);
! 922: void _remup2(UP2,UP2,UP2);
! 923: void remup2_sparse(UP2,UP2,UP2 *);
! 924: void remup2_sparse_destructive(UP2,UP2);
! 925: void remup2_type1_destructive(UP2,int);
! 926: void remup2_3_destructive(UP2,UP2);
! 927: void remup2_5_destructive(UP2,UP2);
! 928: void _invup2_1(unsigned int,unsigned int,unsigned int *,unsigned int *);
! 929: void _gcdup2_1(unsigned int,unsigned int,unsigned int *);
! 930: void up2_init_eg(void);
! 931: void up2_show_eg(void);
! 932: void invup2(UP2,UP2,UP2 *);
! 933: void gcdup2(UP2,UP2,UP2 *);
! 934: void chsgnup2(UP2,UP2 *);
! 935: void pwrmodup2(UP2,Q,UP2,UP2 *);
! 936: void pwrmodup2_sparse(UP2,Q,UP2,UP2 *);
! 937: int compup2(UP2,UP2);
! 938: void printup2(UP2);
! 939: void _copyup2(UP2,UP2);
! 940: void _bshiftup2(UP2,int,UP2);
! 941: void _bshiftup2_destructive(UP2,int);
! 942: void diffup2(UP2,UP2 *);
! 943: int sqfrcheckup2(UP2);
! 944: int irredcheckup2(UP2);
! 945: int irredcheck_dddup2(UP2);
! 946: void _copy_up2bits(UP2,unsigned int **,int);
! 947: void _print_frobmat(unsigned int **,int,int);
! 948: int compute_multiplication_matrix(P,GF2MAT *);
! 949: void compute_change_of_basis_matrix(P,P,int,GF2MAT *,GF2MAT *);
! 950: int compute_representation_conversion_matrix(P,GF2MAT *,GF2MAT *);
! 951: void mul_nb(GF2MAT,unsigned int *,unsigned int *,unsigned int *);
! 952: void leftshift(unsigned int *,int);
! 953: void mat_to_gf2mat(MAT,unsigned int ***);
! 954: void gf2mat_to_mat(unsigned int **,int,MAT *);
! 955: void mulgf2mat(int,unsigned int **,unsigned int **,unsigned int **);
! 956: void mulgf2vectmat(int,unsigned int *,unsigned int **,unsigned int *);
! 957: int mulgf2vectvect(int,unsigned int *,unsigned int *);
! 958: int invgf2mat(int,unsigned int **,unsigned int **);
! 959: void _mulup2_11(unsigned int,unsigned int,unsigned int *);
! 960: void _mulup2_22(unsigned int *,unsigned int *,unsigned int *);
! 961: void _mulup2_33(unsigned int *,unsigned int *,unsigned int *);
! 962: void _mulup2_44(unsigned int *,unsigned int *,unsigned int *);
! 963: void _mulup2_55(unsigned int *,unsigned int *,unsigned int *);
! 964: void _mulup2_66(unsigned int *,unsigned int *,unsigned int *);
! 965: void printup2_(unsigned int *,int);
! 966: void type1_bin_invup2(UP2,int,UP2 *);
! 967: int int_bits(int);
! 968:
! 969:
! 970: LUM LUMALLOC(int, int);
! 971: Obj ToAlg(Num);
! 972: UM *berlemain(register int, UM, UM *);
! 973: void *Risa_GC_malloc(size_t);
! 974: void *Risa_GC_malloc_atomic(size_t);
! 975: void *Risa_GC_realloc(void *,size_t);
! 976: void *GC_malloc(size_t);
! 977: void *GC_malloc_atomic(size_t);
! 978: void *GC_realloc(void *,size_t);
! 979: double NatToReal(N,int *);
! 980: double RatnToReal(Q);
! 981: double pwrreal0(double,int);
! 982: int **almat(int,int);
! 983: pointer **almat_pointer(int,int);
! 984: int berlecnt(register int,UM);
! 985: int berlecntmain(register int,int,int,register int **);
! 986: int cmpalg(Num,Num);
! 987: int cmpbf(Num,Num);
! 988: int cmpcplx(Num,Num);
! 989: int cmpn(N,N);
! 990: int cmpq(Q,Q);
! 991: int cmpreal(Real,Real);
! 992: int cmpmi(MQ,MQ);
! 993: int cmplm(LM,LM);
! 994: int compmat(VL,MAT,MAT);
! 995: int compnum(VL,Num,Num);
! 996: int compp(VL,P,P);
! 997: int compr(VL,Obj,Obj);
! 998: int compstr(VL,STRING,STRING);
! 999: int compvect(VL,VECT,VECT);
! 1000: int ctest(P,ML,int,int *);
! 1001: int cycchk(P);
! 1002: int dbound(V,P);
! 1003: int dcomp(P,P);
! 1004: int deg(V,P);
! 1005: int degtest(int,int *,ML,int);
! 1006: int divcheck(VL,P *,int,P,P);
! 1007: unsigned int divin(N,unsigned int,N *);
! 1008: int divtdcpz(VL,P,P,P *);
! 1009: int divtpz(VL,P,P,P *);
! 1010: int divum(register int,UM,UM,UM);
! 1011: int dm(int,int,int *);
! 1012: int dmb(int,int,int,int *);
! 1013: int dma(int,int,int,int *);
! 1014: int dmab(int,int,int,int,int *);
! 1015: int dmar(int,int,int,int);
! 1016: int dtestmain(P,Q,ML,int,int *,P *,P *);
! 1017: int geldb(VL,P);
! 1018: int getchomdeg(V,P);
! 1019: int getdeg(V,P);
! 1020: int getlchomdeg(V,P,int *);
! 1021: int homdeg(P);
! 1022: unsigned int invm(unsigned int,int);
! 1023: int iscycm(P);
! 1024: int iscycp(P);
! 1025: int lengthp(P);
! 1026: int mig(int,int,P);
! 1027: int mignotte(int,P);
! 1028: int minimain(register int,int,int,register int **);
! 1029: int ncombi(int,int,int,int *);
! 1030: int nextbin(VN,int);
! 1031: int nmonop(P);
! 1032: int pcoef(VL,VL,P,P *);
! 1033: int pcoef0(VL,VL,P,P *);
! 1034: unsigned int pwrm(register int,register int,int);
! 1035: unsigned int rem(N,unsigned int);
! 1036: int sqfrchk(P);
! 1037: int subn(N,N,N *);
! 1038: int ucmpp(P,P);
! 1039: int valideval(VL,DCP,VN);
! 1040: int zerovpchk(VL,P,VN);
! 1041:
! 1042: void addgf2n(GF2N,GF2N,GF2N *);
! 1043: void subgf2n(GF2N,GF2N,GF2N *);
! 1044: void mulgf2n(GF2N,GF2N,GF2N *);
! 1045: void divgf2n(GF2N,GF2N,GF2N *);
! 1046: void chsgngf2n(GF2N,GF2N *);
! 1047: void pwrgf2n(GF2N,Q, GF2N *);
! 1048: int cmpgf2n(GF2N,GF2N);
! 1049:
! 1050: void addgfpn(GFPN,GFPN,GFPN *);
! 1051: void subgfpn(GFPN,GFPN,GFPN *);
! 1052: void mulgfpn(GFPN,GFPN,GFPN *);
! 1053: void divgfpn(GFPN,GFPN,GFPN *);
! 1054: void chsgngfpn(GFPN,GFPN *);
! 1055: void pwrgfpn(GFPN,Q, GFPN *);
! 1056: int cmpgfpn(GFPN,GFPN);
! 1057:
! 1058: void addalg(Num,Num,Num *);
! 1059: void addbf(Num,Num,Num *);
! 1060: void addcplx(Num,Num,Num *);
! 1061: void addm2p(VL,Q,Q,P,P,P *);
! 1062: void addm2q(Q,Q,Q,Q,Q *);
! 1063: void addmat(VL,MAT,MAT,MAT *);
! 1064: void addmp(VL,int,P,P,P *);
! 1065: void addmpq(int,P,P,P *);
! 1066: void addmptoc(VL,int,P,P,P *);
! 1067: void addmq(int,MQ,MQ,MQ *);
! 1068: void addn(N,N,N *);
! 1069: void addnum(VL,Num,Num,Num *);
! 1070: void addp(VL,P,P,P *);
! 1071: void addpadic(int,int,unsigned int *,unsigned int *);
! 1072: void addpq(P,P,P *);
! 1073: void addptoc(VL,P,P,P *);
! 1074: void addq(Q,Q,Q *);
! 1075: void addr(VL,Obj,Obj,Obj *);
! 1076: void addreal(Num,Num,Real *);
! 1077: void addmi(MQ,MQ,MQ *);
! 1078: void addlm(LM,LM,LM *);
! 1079: void addstr(VL,STRING,STRING,STRING *);
! 1080: void addum(int,UM,UM,UM);
! 1081: void addvect(VL,VECT,VECT,VECT *);
! 1082: void adjc(VL,P,P,P,Q,P *,P *);
! 1083: void afctr(VL,P,P,DCP *);
! 1084: void afctrmain(VL,P,P,int,DCP *);
! 1085: void affine(VL,P,VN,P *);
! 1086: void affinemain(VL,P,V,int,P *,P *);
! 1087: void berle(int,int,P,ML *);
! 1088: void bnton(register int,N,N *);
! 1089: void cbound(VL,P,Q *);
! 1090: void chnrem(int,V,P,Q,UM,P *,Q *);
! 1091: void chnremp(VL,int,P,Q,P,P *);
! 1092: void chsgnalg(Num,Num *);
! 1093: void chsgnbf(Num a,Num *);
! 1094: void chsgncplx(Num,Num *);
! 1095: void chsgnmat(MAT,MAT *);
! 1096: void chsgnmp(int,P,P *);
! 1097: void chsgnnum(Num,Num *);
! 1098: void chsgnp(P,P *);
! 1099: void chsgnq(Q,Q *);
! 1100: void chsgnr(Obj,Obj *);
! 1101: void chsgnreal(Num,Num *);
! 1102: void chsgnmi(MQ,MQ *);
! 1103: void chsgnlm(LM,LM *);
! 1104: void chsgnvect(VECT,VECT *);
! 1105: void clctv(VL,P,VL *);
! 1106: void clctvr(VL,Obj,VL *);
! 1107: void cm2p(Q,Q,P,P *);
! 1108: void cmax(P,Q *);
! 1109: void cmp(Q,P,P *);
! 1110: void coefp(P,int,P *);
! 1111: void cpylum(int,LUM,LUM);
! 1112: void cpyum(UM,UM);
! 1113: void csump(VL,P,Q *);
! 1114: void cycm(V,register int,DCP *);
! 1115: void cycp(V,register int,DCP *);
! 1116: void degp(V,P,Q *);
! 1117: void degum(UM,int);
! 1118: void detmp(VL,int,P **,int,P *);
! 1119: void detp(VL,P **,int,P *);
! 1120: void diffp(VL,P,V,P *);
! 1121: void diffum(register int,UM,UM);
! 1122: void divalg(Num,Num,Num *);
! 1123: void divbf(Num,Num,Num *);
! 1124: void divcp(P,Q,P *);
! 1125: void divcplx(Num,Num,Num *);
! 1126: void divmat(VL,Obj,Obj,Obj *);
! 1127: void divmq(int,MQ,MQ,MQ *);
! 1128: void divn(N,N,N *,N *);
! 1129: void divnmain(int,int,unsigned int *,unsigned int *,unsigned int *);
! 1130: void divnum(VL,Num,Num,Num *);
! 1131: void divq(Q,Q,Q *);
! 1132: void divr(VL,Obj,Obj,Obj *);
! 1133: void divreal(Num,Num,Real *);
! 1134: void divmi(MQ,MQ,MQ *);
! 1135: void divlm(LM,LM,LM *);
! 1136: void divsdcmp(VL,int,P,P,P *);
! 1137: void divsdcp(VL,P,P,P *);
! 1138: void divsmp(VL,int,P,P,P *);
! 1139: void divsn(N,N,N *);
! 1140: void divsp(VL,P,P,P *);
! 1141: void divsrdcmp(VL,int,P,P,P *,P *);
! 1142: void divsrdcp(VL,P,P,P *,P *);
! 1143: void divsrmp(VL,int,P,P,P *,P *);
! 1144: void divsrp(VL,P,P,P *,P *);
! 1145: void divvect(VL,Obj,Obj,Obj *);
! 1146: void dtest(P,ML,int,DCP *);
! 1147: void dtestroot(int,int,P,LUM,struct oDUM *,DCP *);
! 1148: void dtestroot1(int,int,P,LUM,P *);
! 1149: void dtestsq(int,int,P,LUM,P *);
! 1150: void dtestsql(P,ML,struct oDUM *,DCP *);
! 1151: void estimatelc(VL,Q,DCP,VN,P *);
! 1152: void eucum(register int,UM,UM,UM,UM);
! 1153: void exthp(VL,P,int,P *);
! 1154: void exthpc(VL,V,P,int,P *);
! 1155: void ezgcd1p(VL,P,P,P *);
! 1156: void ezgcdhensel(P,int,UM,UM,ML *);
! 1157: void ezgcdnp(VL,P,P *,int,P *);
! 1158: void ezgcdnpp(VL,DCP,P *,int,P *);
! 1159: void ezgcdnpz(VL,P *,int,P *);
! 1160: void ezgcdp(VL,P,P,P *);
! 1161: void ezgcdpp(VL,DCP,P,P *);
! 1162: void ezgcdpz(VL,P,P,P *);
! 1163: void factorial(int,Q *);
! 1164: void fctrp(VL,P,DCP *);
! 1165: void fctrwithmvp(VL,P,V,DCP *);
! 1166: void gcda(VL,P,P,P,P *);
! 1167: void gcdcp(VL,P,P *);
! 1168: void gcdgen(P,ML,ML *);
! 1169: void gcdmonomial(VL,DCP *,int,P *);
! 1170: void gcdn(N,N,N *);
! 1171: void gcdprsp(VL,P,P,P *);
! 1172: void gcdum(register int,UM,UM,UM);
! 1173: void getmindeg(V,P,Q *);
! 1174: void henmain(LUM,ML,ML,ML *);
! 1175: void henmv(VL,VN,P,P,P,P,P,P,P,P,P,Q,int,P *,P *);
! 1176: void henmvmain(VL,VN,P,P,P,P,P,P,P,Q,Q,int,P *,P *);
! 1177: void henprep(P,ML,ML,ML *,ML *);
! 1178: void hensel(int,int,P,ML *);
! 1179: void henzq(P,P,UM,P,UM,int,int,P *,P *,P *,P *,Q *);
! 1180: void henzq1(P,P,Q,P *,P *,Q *);
! 1181: void hsq(int,int,P,int *,DCP *);
! 1182: void intersectv(VL,VL,VL *);
! 1183: void invl(Q,Q,Q *);
! 1184: void invmq(int,MQ,MQ *);
! 1185: void invq(Q,Q *);
! 1186: void lgp(P,N *,N *);
! 1187: void lumtop(V,int,int,LUM,P *);
! 1188: void markv(VN,int,P);
! 1189: void maxdegp(VL,P,VL *,P *);
! 1190: void mergev(VL,VL,VL,VL *);
! 1191: void mfctr(VL,P,DCP *);
! 1192: void mfctrhen2(VL,VN,P,P,P,P,P,P,P *);
! 1193: void mfctrmain(VL,P,DCP *);
! 1194: void mfctrwithmv(VL,P,V,DCP *);
! 1195: void min_common_vars_in_coefp(VL,P,VL *,P *);
! 1196: void minchdegp(VL,P,VL *,P *);
! 1197: void mindegp(VL,P,VL *,P *);
! 1198: void mini(register int,UM,UM);
! 1199: void minlcdegp(VL,P,VL *,P *);
! 1200: void mkbc(int,Q *);
! 1201: void mkbcm(int,int,MQ *);
! 1202: void mkssum(V,int,int,int,P *);
! 1203: void monomialfctr(VL,P,P *,DCP *);
! 1204: void mptop(P,P *);
! 1205: void mptoum(P,UM);
! 1206: void msqfr(VL,P,DCP *);
! 1207: void msqfrmain(VL,P,DCP *);
! 1208: void msqfrmainmain(VL,P,VN,P,DCP,DCP *,P *);
! 1209: void mulalg(Num,Num,Num *);
! 1210: void mulbf(Num,Num,Num *);
! 1211: void mulcplx(Num,Num,Num *);
! 1212: void mulin(N,unsigned int,unsigned int *);
! 1213: void mullum(int,int,LUM,LUM,LUM);
! 1214: void mullumarray(P,ML,int,int *,P *);
! 1215: void mulm2p(VL,Q,Q,P,P,P *);
! 1216: void mulm2q(Q,Q,Q,Q,Q *);
! 1217: void mulmat(VL,Obj,Obj,Obj *);
! 1218: void mulmatmat(VL,MAT,MAT,MAT *);
! 1219: void mulmatvect(VL,MAT,VECT,VECT *);
! 1220: void mulmp(VL,int,P,P,P *);
! 1221: void mulmpc(VL,int,P,P,P *);
! 1222: void mulmpq(int,P,P,P *);
! 1223: void mulmq(int,MQ,MQ,MQ *);
! 1224: void muln(N,N,N *);
! 1225: void mulnum(VL,Num,Num,Num *);
! 1226: void mulp(VL,P,P,P *);
! 1227: void mulpadic(int,int,unsigned int *,unsigned int *,unsigned int *);
! 1228: void mulpc(VL,P,P,P *);
! 1229: void mulpq(P,P,P *);
! 1230: void mulq(Q,Q,Q *);
! 1231: void mulr(VL,Obj,Obj,Obj *);
! 1232: void mulreal(Num,Num,Real *);
! 1233: void mulmi(MQ,MQ,MQ *);
! 1234: void mullm(LM,LM,LM *);
! 1235: void mulrmat(VL,Obj,MAT,MAT *);
! 1236: void mulrvect(VL,Obj,VECT,VECT *);
! 1237: void mulsgn(VN,VN,int,VN);
! 1238: void mulsum(register int,UM,register int,UM);
! 1239: void mulum(register int,UM,UM,UM);
! 1240: void mulvect(VL,Obj,Obj,Obj *);
! 1241: void mulvectmat(VL,VECT,MAT,VECT *);
! 1242: void next(VN);
! 1243: void nezgcdnp_sqfr_primitive(VL,P,P *,int,P *);
! 1244: void nezgcdnpp(VL,DCP,P *,int,P *);
! 1245: void nezgcdnpz(VL,P *,int,P *);
! 1246: void nezgcdnpzmain(VL,P *,int,P *);
! 1247: void nglob_init(void);
! 1248: void norm(P,Q *);
! 1249: void norm1(P,P *);
! 1250: void norm1c(P,Q *);
! 1251: void normalizemp(int,P);
! 1252: void nthrootchk(P,struct oDUM *,ML,DCP *);
! 1253: void nthrootn(N,int,N *);
! 1254: void ntobn(register int,N,N *);
! 1255: void nuezgcdnpzmain(VL,P *,int,P *);
! 1256: void padictoq(int,int,int *,Q *);
! 1257: void risa_pari_init(void);
! 1258: void pcp(VL,P,P *,P *);
! 1259: void pderivr(VL,Obj,V,Obj *);
! 1260: void pdiva(VL,P,P,P,P *);
! 1261: void pinva(P,P,P *);
! 1262: void plisttop(P *,V,int,P *);
! 1263: void pmonic(VL,P,P,P *);
! 1264: void pqra(VL,P,P,P,P *,P *);
! 1265: void premmp(VL,int,P,P,P *);
! 1266: void premp(VL,P,P,P *);
! 1267: void ptolum(int,int,P,LUM);
! 1268: void ptomp(int,P,P *);
! 1269: void ptoum(int,P,UM);
! 1270: void ptozp(P,int,Q *,P *);
! 1271: void ptozp0(P,P *);
! 1272: void pwralg(Num,Num,Num *);
! 1273: void pwrbf(Num,Num,Num *);
! 1274: void pwrcplx(Num,Num,Num *);
! 1275: void pwrcplx0(Num,int,Num *);
! 1276: void pwrlum(int,int,LUM,int,LUM);
! 1277: void pwrmat(VL,MAT,Obj,MAT *);
! 1278: void pwrmatmain(VL,MAT,int,MAT *);
! 1279: void pwrmp(VL,int,P,Q,P *);
! 1280: void pwrmq(int,MQ,Q,MQ *);
! 1281: void pwrn(N,int,N *);
! 1282: void pwrnum(VL,Num,Num,Num *);
! 1283: void pwrp(VL,P,Q,P *);
! 1284: void pwrq(Q,Q,Q *);
! 1285: void pwrr(VL,Obj,Obj,Obj *);
! 1286: void pwrreal(Num,Num,Real *);
! 1287: void pwrmi(MQ,Q,MQ *);
! 1288: void pwrlm(LM,Q,LM *);
! 1289: void pwrum(int,UM,int,UM);
! 1290: void reallocarray(char **,int *,int *,int);
! 1291: void reductr(VL,Obj,Obj *);
! 1292: void reimtocplx(Num,Num,Num *);
! 1293: void rem2q(Q,Q,Q,Q *);
! 1294: void rema(VL,P,P,P,P *);
! 1295: void remq(Q,Q,Q *);
! 1296: void remsdcp(VL,P,P,P *);
! 1297: void reordermp(VL,int,VL,P,P *);
! 1298: void reorderp(VL,VL,P,P *);
! 1299: void reordvar(VL,V,VL *);
! 1300: void res_ch_det(VL,V,P,P,P *);
! 1301: void res_detmp(VL,int,V,P,P,P *);
! 1302: void restore(VL,P,VN,P *);
! 1303: void resultmp(VL,int,V,P,P,P *);
! 1304: void resultp(VL,V,P,P,P *);
! 1305: void setlum(int,int,LUM);
! 1306: void sort_by_deg(int,P *,P *);
! 1307: void sort_by_deg_rev(int,P *,P *);
! 1308: void sortfs(DCP *);
! 1309: void sortfsrev(DCP *);
! 1310: void sortplist(P *,int);
! 1311: void sortplistbyhomdeg(P *,int);
! 1312: void sprs(VL,V,P,P,P *);
! 1313: void sqa(VL,P,P,DCP *);
! 1314: void sqad(unsigned int,int);
! 1315: void sqfrp(VL,P,DCP *);
! 1316: void sqfrum(int,int,P,int *,struct oDUM **,ML *);
! 1317: void sqfrummain(int,UM,UM,struct oDUM **);
! 1318: void sqrtn(N,N *);
! 1319: void srch2(VL,V,P,P,P *);
! 1320: void srchmp(VL,int,V,P,P,P *);
! 1321: void srchump(int,P,P,P *);
! 1322: void srcr(VL,V,P,P,P *);
! 1323: void strtobf(char *,BF *);
! 1324: void subalg(Num,Num,Num *);
! 1325: void subbf(Num,Num,Num *);
! 1326: void subcplx(Num,Num,Num *);
! 1327: void subm2p(VL,Q,Q,P,P,P *);
! 1328: void subm2q(Q,Q,Q,Q,Q *);
! 1329: void submat(VL,MAT,MAT,MAT *);
! 1330: void submp(VL,int,P,P,P *);
! 1331: void submq(int,MQ,MQ,MQ *);
! 1332: void subnum(VL,Num,Num,Num *);
! 1333: void subp(VL,P,P,P *);
! 1334: void subq(Q,Q,Q *);
! 1335: void subr(VL,Obj,Obj,Obj *);
! 1336: void subreal(Num,Num,Real *);
! 1337: void submi(MQ,MQ,MQ *);
! 1338: void sublm(LM,LM,LM *);
! 1339: void substmp(VL,int,P,V,P,P *);
! 1340: void substp(VL,P,V,P,P *);
! 1341: void substvp(VL,P,VN,P *);
! 1342: void subum(int,UM,UM,UM);
! 1343: void subvect(VL,VECT,VECT,VECT *);
! 1344: void toreim(Num,Num *,Num *);
! 1345: void ucsump(P,Q *);
! 1346: void udivpwm(Q,P,P,P *,P *);
! 1347: void udivpz(P,P,P *,P *);
! 1348: void udivpzwm(Q,P,P,P *,P *);
! 1349: void uexgcdnp(VL,P,P *,int,VN,Q,P *,P *,P *,P *,Q *);
! 1350: void uezgcd1p(P,P,P *);
! 1351: void uezgcdpp(DCP,P,P *);
! 1352: void uezgcdpz(VL,P,P,P *);
! 1353: void ufctr(P,int,DCP *);
! 1354: void ufctrmain(P,int,DCP *);
! 1355: void umtomp(V,UM,P *);
! 1356: void umtop(V,UM,P *);
! 1357: void usqp(P,DCP *);
! 1358: void vntovl(VN,int,VL *);
! 1359:
! 1360: #if 0 && !defined(VISUAL)
! 1361: void bzero(const void *,int);
! 1362: void bcopy(const void *,void *,int);
! 1363: char *index(char *,int);
! 1364: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>