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