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