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