Annotation of OpenXM_contrib2/asir2000/include/ca.h, Revision 1.86
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.86 ! saito 48: * $OpenXM: OpenXM_contrib2/asir2000/include/ca.h,v 1.85 2013/12/20 02:02:24 noro Exp $
1.4 noro 49: */
1.1 noro 50: #include <stdio.h>
1.36 ohara 51: #include <stdlib.h>
1.85 noro 52: #include <gmp.h>
1.1 noro 53:
54: #if defined(hpux)
55: #include <netinet/in.h>
56: # define setbuffer(FP,buf,siz) setvbuf(FP,buf,_IOFBF,siz)
57: #endif
58:
1.36 ohara 59: #if !defined(VISUAL)
60: #include <unistd.h>
1.28 noro 61: #include <sys/param.h>
62: #endif
63:
1.1 noro 64: #if defined(linux) || (defined(sun) && !defined(SYSV)) || defined(news5000) || (defined(mips) && defined(ultrix))
65: #include <alloca.h>
66: #endif
67:
68: #if (defined(sun) && defined(SYSV))
69: #define alloca(x) __builtin_alloca(x)
70: #endif
71:
72: #if defined(VISUAL)
1.84 noro 73: #include <limits.h>
1.1 noro 74: #include <malloc.h>
75: #endif
76:
77: #if 0
78: #include <sys/types.h>
79: typedef caddr_t pointer;
80: #endif
81:
1.85 noro 82:
1.1 noro 83: typedef void * pointer;
84:
1.36 ohara 85: #if defined(sun)
86: #include <strings.h>
87: #else
88: #include <string.h>
1.1 noro 89: #if defined(VISUAL)
90: #define index(s,c) strchr(s,c)
91: #define bzero(s,len) memset(s,0,len)
92: #define bcopy(x,y,len) memcpy(y,x,len)
1.36 ohara 93: #endif
1.1 noro 94: #endif
95:
1.81 noro 96: #define NULLP ((void *)0)
97:
1.67 saito 98: #define TODO printf("%s: not implemented!\n", __func__)
99:
1.1 noro 100: #define COPY(a,b) ((b)=(a))
101: #define FREEN(p)
102: #define FREEQ(p)
103: #define FREE(p)
104: #define INITRC(p)
105:
106: /* data structures */
107:
108: #define O_N 1
109: #define O_P 2
110: #define O_R 3
111: #define O_LIST 4
112: #define O_VECT 5
113: #define O_MAT 6
114: #define O_STR 7
115: #define O_COMP 8
116: #define O_DP 9
117: #define O_USINT 10
118: #define O_ERR 11
119: #define O_GF2MAT 12
120: #define O_MATHCAP 13
121: #define O_F 14
122: #define O_GFMMAT 15
1.6 noro 123: #define O_BYTEARRAY 16
1.13 noro 124: #define O_QUOTE 17
1.39 noro 125: #define O_OPTLIST 18
1.43 noro 126: #define O_SYMBOL 19
1.45 noro 127: #define O_RANGE 20
1.46 noro 128: #define O_TB 21
1.49 noro 129: #define O_DPV 22
1.50 noro 130: #define O_QUOTEARG 23
1.1 noro 131: #define O_VOID -1
1.55 saito 132: /* IMAT */
133: #define O_IMAT 24
134: /* IMAT */
1.61 noro 135: #define O_NBP 25
1.1 noro 136:
137: #define N_Q 0
138: #define N_R 1
139: #define N_A 2
140: #define N_B 3
1.86 ! saito 141: #define N_NEXT_B (N_B)
! 142: #if defined(INTERVAL)
! 143: #define N_Quad (N_NEXT_B+1)
! 144: #define N_IP (N_NEXT_B+2)
! 145: #define N_IntervalDouble (N_NEXT_B+3)
! 146: #define N_IntervalQuad (N_NEXT_B+4)
! 147: #define N_IntervalBigFloat (N_NEXT_B+5)
! 148: #define N_PRE_C N_IntervalBigFloat
! 149: #define N_BASE (N_NEXT_B+5)
! 150: #else
! 151: #define N_BASE N_NEXT_B
! 152: #endif
! 153: #define N_C (N_BASE+1)
! 154: #define N_M (N_BASE+2)
! 155: #define N_LM (N_BASE+3)
! 156: #define N_GF2N (N_BASE+4)
! 157: #define N_GFPN (N_BASE+5)
! 158: #define N_GFS (N_BASE+6)
! 159: #define N_GFSN (N_BASE+7)
! 160: #define N_DA (N_BASE+8)
! 161: #define N_GZ (N_BASE+9)
! 162: #define N_GQ (N_BASE+10)
1.1 noro 163:
164: #define ORD_REVGRADLEX 0
165: #define ORD_GRADLEX 1
166: #define ORD_LEX 2
167:
1.50 noro 168: typedef enum {
169: A_end=0,A_fnode,A_arf,A_int,A_str,A_internal,A_node,A_notimpl,A_func
170: } farg_type;
171:
1.77 ohara 172: #if SIZEOF_LONG == 8
173: typedef long L;
174: typedef unsigned long UL;
175: #elif defined(HAVE_UNSIGNED_LONG_LONG)
176: typedef long long L;
177: typedef unsigned long long UL;
178: #elif defined(_MSC_VER)
1.1 noro 179: typedef _int64 L;
180: typedef unsigned _int64 UL;
181: #endif
182:
183: typedef struct oN {
184: int p;
185: unsigned int b[1];
186: } *N;
187:
1.52 noro 188: typedef struct oZ {
189: int p;
190: unsigned int b[1];
191: } *Z;
192:
1.1 noro 193: typedef struct oUP2 {
194: int w;
195: unsigned int b[1];
196: } *UP2;
197:
198: typedef struct _oUP2 {
199: int w;
200: unsigned int *b;
201: } *_UP2;
202:
203: #define UP2_DENSE 0
204: #define UP2_SPARSE 1
205:
206: typedef struct oGEN_UP2 {
207: int id;
208: UP2 dense;
209: UP2 sparse;
210: } *GEN_UP2;
211:
212: typedef struct oV {
213: char *name;
214: pointer attr;
215: pointer priv;
216: } *V;
217:
218: typedef struct oQ {
219: short id;
220: char nid;
221: char sgn;
222: N nm;
223: N dn;
224: } *Q;
225:
226: typedef struct oReal {
227: short id;
228: char nid;
229: char pad;
230: double body;
231: } *Real;
232:
233: typedef struct oAlg {
234: short id;
235: char nid;
236: char pad;
237: struct oObj *body;
238: } *Alg;
239:
240: typedef struct oBF {
241: short id;
242: char nid;
243: char pad;
244: long body[1];
245: } *BF;
246:
247: typedef struct oC {
248: short id;
249: char nid;
250: char pad;
251: struct oNum *r,*i;
252: } *C;
253:
254: typedef struct oLM {
255: short id;
256: char nid;
257: char pad;
258: struct oN *body;
259: } *LM;
260:
261: typedef struct oGF2N {
262: short id;
263: char nid;
264: char pad;
265: struct oUP2 *body;
266: } *GF2N;
267:
268: typedef struct oGFPN {
269: short id;
270: char nid;
271: char pad;
272: struct oUP *body;
273: } *GFPN;
274:
1.53 noro 275: typedef struct oDAlg {
276: short id;
277: char nid;
278: char pad;
279: struct oDP *nm;
280: struct oQ *dn;
281: } *DAlg;
282:
1.85 noro 283: typedef struct oGZ {
284: short id;
285: char nid;
286: char pad;
287: mpz_t body;
288: } *GZ;
289:
290: typedef struct oGQ {
291: short id;
292: char nid;
293: char pad;
294: mpq_t body;
295: } *GQ;
1.53 noro 296:
1.1 noro 297: typedef struct oNum {
298: short id;
299: char nid;
300: char pad;
301: } *Num;
302:
303: typedef struct oMQ {
304: short id;
305: char nid;
306: char pad;
307: int cont;
308: } *MQ;
309:
1.12 noro 310: typedef struct oGFS {
311: short id;
312: char nid;
313: char pad;
314: int cont;
315: } *GFS;
316:
1.21 noro 317: typedef struct oGFSN {
1.20 noro 318: short id;
319: char nid;
320: char pad;
321: struct oUM *body;
1.21 noro 322: } *GFSN;
1.12 noro 323:
1.1 noro 324: typedef struct oP {
325: short id;
326: short pad;
327: V v;
328: struct oDCP *dc;
329: } *P;
330:
331: typedef struct oR {
332: short id;
333: short reduced;
334: P nm;
335: P dn;
336: } *R;
337:
338: typedef struct oVECT {
339: short id;
340: short pad;
341: int len;
342: pointer *body;
343: } *VECT;
344:
345: typedef struct oMAT {
346: short id;
347: short pad;
348: int row,col;
349: pointer **body;
350: } *MAT;
351:
352: typedef struct oGF2MAT {
353: short id;
354: short pad;
355: int row,col;
356: unsigned int **body;
357: } *GF2MAT, *GFMMAT;
358:
1.55 saito 359: /* IMAT */
360: #define IMATCH 64
361:
362: typedef struct oIENT {
363: int cr;
364: int row, col;
365: pointer *body;
366: } IENT;
367:
368: typedef struct oIMATC {
369: pointer *fore;
370: pointer *next;
371: IENT ient[IMATCH];
372: } *IMATC;
373:
374: typedef struct oIMAT {
375: short id;
376: int row, col, clen;
377: pointer *root;
378: pointer *toor;
379: } *IMAT;
380: /* IMAT */
1.1 noro 381: typedef struct oLIST {
382: short id;
383: short pad;
384: struct oNODE *body;
385: } *LIST;
386:
387: typedef struct oSTRING {
388: short id;
389: short pad;
390: char *body;
391: } *STRING;
392:
393: typedef struct oCOMP {
394: short id;
395: short type;
396: struct oObj *member[1];
397: } *COMP;
398:
399: typedef struct oDP {
400: short id;
401: short nv;
402: int sugar;
403: struct oMP *body;
404: } *DP;
405:
1.49 noro 406: typedef struct oDPV {
407: short id;
408: int len;
409: int sugar;
410: struct oDP **body;
411: } *DPV;
412:
1.1 noro 413: typedef struct oUSINT {
414: short id;
415: short pad;
416: unsigned body;
417: } *USINT;
418:
419: typedef struct oERR {
420: short id;
421: short pad;
422: struct oObj *body;
423: } *ERR;
424:
425: typedef struct oMATHCAP {
426: short id;
427: short pad;
428: struct oLIST *body;
429: } *MATHCAP;
430:
1.6 noro 431: typedef struct oBYTEARRAY {
432: short id;
433: short pad;
434: int len;
435: unsigned char *body;
436: } *BYTEARRAY;
437:
1.13 noro 438: typedef struct oQUOTE {
439: short id;
1.59 noro 440: short pad;
1.13 noro 441: pointer body;
442: } *QUOTE;
443:
1.50 noro 444: typedef struct oQUOTEARG {
445: short id;
446: short pad;
447: farg_type type;
448: pointer body;
449: } *QUOTEARG;
450:
1.39 noro 451: typedef struct oOPTLIST {
452: short id;
453: short pad;
454: struct oNODE *body;
455: } *OPTLIST;
456:
1.45 noro 457: typedef struct oSYMBOL {
1.43 noro 458: short id;
459: short pad;
460: char *name;
461: int value;
1.45 noro 462: } *SYMBOL;
463:
464: typedef struct oRANGE {
465: short id;
466: short pad;
467: struct oObj *start,*end;
468: } *RANGE;
469:
1.46 noro 470: typedef struct oTB {
471: short id;
472: short pad;
473: int size,next;
474: char **body;
475: } *TB;
1.43 noro 476:
1.61 noro 477: typedef struct oNBP {
478: short id;
479: short pad;
480: struct oNODE *body;
481: } *NBP;
482:
483: /* non-commutative bivariate monomial */
484:
485: typedef struct oNBM {
486: int d;
1.65 noro 487: P c;
1.61 noro 488: unsigned int *b;
489: } *NBM;
490:
491: #define NEWNBM(p) ((p)=(NBM)MALLOC(sizeof(struct oNBM)))
492: #define NEWNBMBDY(p,d) \
493: ((p)->b=(unsigned int *)MALLOC((((d)+31)/32)*sizeof(unsigned int)))
494: #define NEWNBP(p) ((p)=(NBP)MALLOC(sizeof(struct oNBP)),OID(p)=O_NBP)
495: #define MKNBP(p,b) (NEWNBP(p),BDY(p)=(b))
496:
497: #define NBM_GET(a,j) (((a)[(j)>>5]&(1<<((j)&31)))?1:0)
498: #define NBM_SET(a,j) ((a)[(j)>>5]|=(1<<((j)&31)))
499: #define NBM_CLR(a,j) ((a)[(j)>>5]&=(~(1<<((j)&31))))
500:
1.1 noro 501: typedef struct oObj {
502: short id;
503: short pad;
504: } *Obj;
505:
506: typedef struct oDCP {
507: Q d;
508: P c;
509: struct oDCP *next;
510: } *DCP;
511:
512: typedef struct oMP {
513: struct oDL *dl;
514: P c;
515: struct oMP *next;
516: } *MP;
517:
518: typedef struct oDL {
519: int td;
520: int d[1];
521: } *DL;
1.23 noro 522:
1.29 noro 523: struct dp_pairs {
524: int dp1, dp2;
525: DL lcm;
526: int sugar;
527: struct dp_pairs *next;
528: };
529:
530: typedef struct dp_pairs *DP_pairs;
531:
532: struct p_pair {
533: struct oUM *p0;
534: struct oUM *p1;
535: struct p_pair *next;
536: };
537:
538: struct oMF {
539: int m;
540: P f;
541: };
542:
1.23 noro 543: /*
544: * compressed DP
545: */
546:
547: typedef struct oCDP {
548: int len;
1.26 noro 549: int psindex;
1.27 noro 550: unsigned int *body;
1.23 noro 551: } *CDP;
552:
1.24 noro 553: typedef struct oCM {
1.23 noro 554: int index;
555: int c;
1.24 noro 556: } *CM;
1.1 noro 557:
1.25 noro 558: /* bucket list for DL */
559:
560: typedef struct oDLBUCKET {
561: int td;
562: struct oNODE *body;
563: struct oDLBUCKET *next;
564: } *DLBUCKET;
1.37 noro 565:
566: typedef struct oGeoBucket {
567: int m;
568: struct oNODE *body[32];
569: } *GeoBucket;
1.25 noro 570:
1.1 noro 571: typedef struct oVL {
572: V v;
573: struct oVL *next;
574: } *VL;
575:
576: typedef struct oNODE {
577: pointer body;
578: struct oNODE *next;
579: } *NODE;
580:
1.16 noro 581: /* univariate poly over small finite field; dense */
1.1 noro 582: typedef struct oUM {
583: int d;
584: int c[1];
585: } *UM;
586:
1.16 noro 587: /* univariate poly with padic coeff */
1.1 noro 588: typedef struct oLUM {
589: int d;
590: int *c[1];
591: } *LUM;
592:
1.16 noro 593: /* bivariate poly over small finite field; dense */
594:
595: typedef struct oBM {
596: int d;
597: UM c[1];
598: } *BM;
599:
1.1 noro 600: typedef struct oML {
601: int n;
602: int mod;
603: int bound;
604: pointer c[1];
605: } *ML;
606:
607: typedef struct oUB {
608: int d;
609: N c[1];
610: } *UB;
611:
612: typedef struct oVN {
613: V v;
614: int n;
615: } *VN;
616:
617: typedef struct oUP {
618: int d;
619: Num c[1];
620: } *UP;
621:
622: typedef struct oDUM {
623: int n;
624: UM f;
625: } *DUM;
626:
627: struct order_pair {
628: int order, length;
629: };
630:
1.42 noro 631: struct sparse_weight {
632: int pos, value;
633: };
634:
635: #define IS_DENSE_WEIGHT 0
636: #define IS_SPARSE_WEIGHT 1
637: #define IS_BLOCK 2
638:
639: struct weight_or_block {
640: int type;
641: int length;
642: union {
643: int *dense_weight;
644: struct sparse_weight *sparse_weight;
645: struct {
646: int order, start;
647: } block;
648: } body;
649: };
650:
1.1 noro 651: struct order_spec {
652: int id;
653: Obj obj;
654: int nv;
1.74 noro 655: int ispot; /* 1 means Position over Term (Pos then Term) */
1.79 noro 656: int pot_nelim; /* size of positions for pot-elimination order */
1.1 noro 657: union {
658: int simple;
659: struct {
660: int length;
661: struct order_pair *order_pair;
662: } block;
663: struct {
664: int row;
665: int **matrix;
666: } matrix;
1.42 noro 667: struct {
668: int length;
669: struct weight_or_block *w_or_b;
670: } composite;
1.1 noro 671: } ord;
672: };
673:
1.49 noro 674: struct modorder_spec {
675: /* id : ORD_REVGRADLEX, ORD_GRADLEX, ORD_LEX */
676: int id;
677: Obj obj;
678: int len;
679: int *degree_shift;
680: };
681:
1.53 noro 682: typedef struct oNumberField {
683: int n;
1.57 noro 684: int psn;
1.53 noro 685: int dim;
686: VL vl;
687: P *defpoly;
688: DP *mb;
689: DP *ps;
690: struct oDAlg *one;
691: NODE ind;
692: struct order_spec *spec;
693: } *NumberField;
694:
1.1 noro 695: /* structure for cputime */
696:
697: struct oEGT {
698: double exectime,gctime;
699: };
700:
701: /* constant */
702:
703: /* ground finite field specification */
704: #define FF_NOT_SET 0
705: #define FF_GFP 1
706: #define FF_GF2N 2
707: #define FF_GFPN 3
1.12 noro 708: #define FF_GFS 4
1.21 noro 709: #define FF_GFSN 5
1.11 saito 710:
711: /* include interval.h */
712: #include "interval.h"
1.1 noro 713:
714: #define INDEX 100
715:
1.35 ohara 716: #if defined(USE_FLOAT)
1.1 noro 717: typedef float ModNum;
718: #define NPrimes 536
719: #else
720: typedef unsigned int ModNum;
721: #define NPrimes 13681
722: #endif
723:
724: /* general macros */
1.28 noro 725: #if defined(MAX)
726: #undef MAX
727: #endif
728: #if defined(MIN)
729: #undef MIN
730: #endif
1.1 noro 731: #define MAX(a,b) ((a) > (b) ? (a) : (b) )
732: #define MIN(a,b) ((a) > (b) ? (b) : (a) )
733: #ifdef ABS
734: #undef ABS
735: #endif
736: #define ABS(a) ((a)>0?(a):-(a))
737: #define ID(p) ((p)->id)
738: #define OID(p) (((Obj)(p))->id)
739: #define NID(p) (((Num)(p))->nid)
740: #define BDY(p) ((p)->body)
741: #define VR(p) ((p)->v)
742: #define NAME(p) ((p)->name)
743: #define NEXT(p) ((p)->next)
744: #define NM(q) ((q)->nm)
745: #define DN(q) ((q)->dn)
746: #define SGN(q) ((q)->sgn)
747: #define DC(p) ((p)->dc)
748: #define COEF(p) ((p)->c)
749: #define DEG(p) ((p)->d)
750: #define PL(n) ((n)->p)
751: #define BD(n) ((n)->b)
752: #define CONT(a) ((a)->cont)
753: #define UDEG(f) BD(NM(DEG(DC(f))))[0]
754: #define UCOEF(f) (COEF(DC(f)))
755: #define LC(f) (NUM(f)?(f):COEF(DC(f)))
756:
757: /* memory allocators (W_... : uses alloca) */
758:
759: #define MALLOC(d) Risa_GC_malloc(d)
760: #define MALLOC_ATOMIC(d) Risa_GC_malloc_atomic(d)
1.82 noro 761: #define MALLOC_ATOMIC_IGNORE_OFF_PAGE(d) Risa_GC_malloc_atomic_ignore_off_page(d)
1.1 noro 762: #define REALLOC(p,d) Risa_GC_realloc(p,d)
1.82 noro 763: #define GCFREE(p) Risa_GC_free(p)
1.1 noro 764: #define CALLOC(d,e) MALLOC((d)*(e))
765:
1.32 noro 766: #if !defined(__CYGWIN__) && (defined(__GNUC__) || defined(vax) || defined(apollo) || defined(alloca) || defined(VISUAL))
1.1 noro 767: #define ALLOCA(d) alloca(d)
768: #else
769: #define ALLOCA(d) MALLOC(d)
1.32 noro 770: #endif
771:
772: /* for setjmp/longjmp compatibility */
1.40 noro 773: #if defined(__CYGWIN__) || defined(__x86_64)
1.32 noro 774: #define JMP_BUF sigjmp_buf
775: #define SETJMP(x) sigsetjmp(x,~0)
776: #define LONGJMP(x,y) siglongjmp(x,y)
777: #else
778: #define JMP_BUF jmp_buf
779: #define SETJMP(x) setjmp(x)
780: #define LONGJMP(x,y) longjmp(x,y)
1.1 noro 781: #endif
782:
783: #define TRUESIZE(type,n,atype) (sizeof(struct type)+MAX((n),0)*sizeof(atype))
784: #define NALLOC(d) ((N)MALLOC_ATOMIC(TRUESIZE(oN,(d)-1,int)))
785: #define UMALLOC(d) ((UM)MALLOC(TRUESIZE(oUM,d,int)))
786: #define UPALLOC(d) ((UP)MALLOC(TRUESIZE(oUP,(d),Num)))
787: #define C_UMALLOC(d) ((UM)MALLOC(TRUESIZE(oUM,d,int)))
788: #define MLALLOC(d) ((ML)MALLOC(TRUESIZE(oML,d,pointer)))
789:
790: #define W_ALLOC(d) ((int *)ALLOCA(((d)+1)*sizeof(int)))
791: #define W_CALLOC(n,type,p) \
792: ((p)=(type *)ALLOCA(((n)+1)*sizeof(type)),\
793: bzero((char *)(p),(int)(((n)+1)*sizeof(type))))
794: #define W_UMALLOC(d) ((UM)ALLOCA(TRUESIZE(oUM,d,int)))
795: #define W_UPALLOC(d) ((UP)ALLOCA(TRUESIZE(oUP,(d),Num)))
796: #define W_MLALLOC(d) ((ML)ALLOCA(TRUESIZE(oML,d,pointer)))
797: #define W_LUMALLOC(n,bound,p)\
798: {\
799: LUM ___q___;\
800: int ___i___,**___c___;\
801: (___q___) = (LUM)ALLOCA(TRUESIZE(oLUM,(n),int *));\
802: DEG(___q___) = n;\
803: for ( ___i___ = 0, ___c___ = (int **)COEF(___q___); ___i___ <= n; ___i___++ ) {\
804: ___c___[___i___] = (int *)ALLOCA(((bound)+1)*sizeof(int));\
805: bzero((char *)___c___[___i___],((bound)+1)*sizeof(int));\
806: }\
807: (p) = ___q___;\
808: }
809:
1.18 noro 810: #define W_BMALLOC(dx,dy,p)\
1.16 noro 811: {\
812: BM ___q___;\
813: int ___i___;\
814: UM *___c___;\
1.18 noro 815: (___q___) = (BM)ALLOCA(TRUESIZE(oBM,(dy),UM));\
816: DEG(___q___) = dy;\
1.16 noro 817: ___c___ = (UM *)COEF(___q___);\
1.18 noro 818: for ( ___i___ = 0; ___i___ <= dy; ___i___++ ) {\
819: ___c___[___i___] = W_UMALLOC(dx);\
820: clearum(___c___[___i___],dx);\
1.16 noro 821: }\
822: (p) = ___q___;\
823: }
824:
1.1 noro 825: #define NEWUP2(q,w)\
826: ((q)=(UP2)MALLOC_ATOMIC(TRUESIZE(oUP2,(w)-1,unsigned int)),\
827: bzero((char *)(q)->b,(w)*sizeof(unsigned int)))
828: #define W_NEWUP2(q,w)\
829: ((q)=(UP2)ALLOCA(TRUESIZE(oUP2,(w)-1,unsigned int)),\
830: bzero((char *)(q)->b,(w)*sizeof(unsigned int)))
831: #define W_NEW_UP2(q,w)\
832: ((q).b=(unsigned int *)ALLOCA((w)*sizeof(unsigned int)))
833:
834: /* cell allocators */
1.85 noro 835: #define NEWGZ(q) ((q)=(GZ)MALLOC(sizeof(struct oGZ)),OID(q)=O_N,NID(q)=N_GZ)
836: #define NEWGQ(q) ((q)=(GQ)MALLOC(sizeof(struct oGQ)),OID(q)=O_N,NID(q)=N_GQ)
1.1 noro 837: #define NEWQ(q) ((q)=(Q)MALLOC(sizeof(struct oQ)),OID(q)=O_N,NID(q)=N_Q)
838: #define NEWMQ(q) ((q)=(MQ)MALLOC_ATOMIC(sizeof(struct oMQ)),OID(q)=O_N,NID(q)=N_M)
1.12 noro 839: #define NEWGFS(q) ((q)=(GFS)MALLOC_ATOMIC(sizeof(struct oGFS)),OID(q)=O_N,NID(q)=N_GFS)
1.21 noro 840: #define NEWGFSN(q) ((q)=(GFSN)MALLOC(sizeof(struct oGFSN)),OID(q)=O_N,NID(q)=N_GFSN)
1.1 noro 841: #define NEWP(p) ((p)=(P)MALLOC(sizeof(struct oP)),OID(p)=O_P)
842: #define NEWR(r) ((r)=(R)MALLOC(sizeof(struct oR)),OID(r)=O_R,(r)->reduced=0)
843: #define NEWLIST(l) ((l)=(LIST)MALLOC(sizeof(struct oLIST)),OID(l)=O_LIST)
844: #define NEWVECT(l) ((l)=(VECT)MALLOC(sizeof(struct oVECT)),OID(l)=O_VECT)
845: #define NEWSTR(l) ((l)=(STRING)MALLOC(sizeof(struct oSTRING)),OID(l)=O_STR)
846: #define NEWCOMP(c,n) ((c)=(COMP)MALLOC(sizeof(struct oCOMP)+((n)-1)*sizeof(Obj)),OID(c)=O_COMP)
847: #define NEWDP(d) ((d)=(DP)MALLOC(sizeof(struct oDP)),OID(d)=O_DP)
1.49 noro 848: #define NEWDPV(d) ((d)=(DPV)MALLOC(sizeof(struct oDPV)),OID(d)=O_DPV)
1.1 noro 849: #define NEWUSINT(u) ((u)=(USINT)MALLOC_ATOMIC(sizeof(struct oUSINT)),OID(u)=O_USINT)
850: #define NEWERR(e) ((e)=(ERR)MALLOC(sizeof(struct oERR)),OID(e)=O_ERR)
851: #define NEWMATHCAP(e) ((e)=(MATHCAP)MALLOC(sizeof(struct oMATHCAP)),OID(e)=O_MATHCAP)
1.6 noro 852: #define NEWBYTEARRAY(e) ((e)=(BYTEARRAY)MALLOC(sizeof(struct oBYTEARRAY)),OID(e)=O_BYTEARRAY)
1.13 noro 853: #define NEWQUOTE(e) ((e)=(QUOTE)MALLOC(sizeof(struct oQUOTE)),OID(e)=O_QUOTE)
1.50 noro 854: #define NEWQUOTEARG(e) ((e)=(QUOTEARG)MALLOC(sizeof(struct oQUOTEARG)),OID(e)=O_QUOTEARG)
1.39 noro 855: #define NEWOPTLIST(l) ((l)=(OPTLIST)MALLOC(sizeof(struct oOPTLIST)),OID(l)=O_OPTLIST)
1.43 noro 856: #define NEWSYMBOL(l) ((l)=(SYMBOL)MALLOC(sizeof(struct oSYMBOL)),OID(l)=O_SYMBOL)
1.45 noro 857: #define NEWRANGE(l) ((l)=(RANGE)MALLOC(sizeof(struct oRANGE)),OID(l)=O_RANGE)
1.46 noro 858: #define NEWTB(l) ((l)=(TB)MALLOC(sizeof(struct oTB)),OID(l)=O_TB,(l)->size=256,(l)->next=0,(l)->body=(char **)MALLOC((l)->size*sizeof(char *)))
1.1 noro 859:
860: #define NEWNODE(a) ((a)=(NODE)MALLOC(sizeof(struct oNODE)))
861: #define NEWDC(dc) ((dc)=(DCP)MALLOC(sizeof(struct oDCP)))
862: #define NEWV(v) ((v)=(V)MALLOC(sizeof(struct oV)))
863: #define NEWVL(vl) ((vl)=(VL)MALLOC(sizeof(struct oVL)))
864: #define NEWMP(m) ((m)=(MP)MALLOC(sizeof(struct oMP)))
1.25 noro 865: #define NEWDLBUCKET(a) ((a)=(DLBUCKET)MALLOC(sizeof(struct oDLBUCKET)))
1.29 noro 866: #define NEWDPP(a) ((a)=(DP_pairs)MALLOC(sizeof(struct dp_pairs)))
1.1 noro 867:
868: #define NEWMAT(l) ((l)=(MAT)MALLOC(sizeof(struct oMAT)),OID(l)=O_MAT)
869: #define NEWGF2MAT(l) ((l)=(GF2MAT)MALLOC(sizeof(struct oGF2MAT)),OID(l)=O_GF2MAT)
870: #define NEWGFMMAT(l) ((l)=(GFMMAT)MALLOC(sizeof(struct oGF2MAT)),OID(l)=O_GFMMAT)
1.55 saito 871: /* IMAT */
872: #define NEWIMAT(l) ((l)=(IMAT)MALLOC(sizeof(struct oIMAT)),OID(l)=O_IMAT,l->clen=0,l->root=0,l->toor=0)
873: #define NEWIENT(l) ((l)=(IMATC)MALLOC(sizeof(struct oIMATC)),l->fore=0,l->next=0)
874: /* IMAT */
1.1 noro 875: #define NEWReal(q) ((q)=(Real)MALLOC_ATOMIC(sizeof(struct oReal)),OID(q)=O_N,NID(q)=N_R)
876: #define NEWAlg(r) ((r)=(Alg)MALLOC(sizeof(struct oAlg)),OID(r)=O_N,NID(r)=N_A)
1.53 noro 877: #define NEWDAlg(r) ((r)=(DAlg)MALLOC(sizeof(struct oDAlg)),OID(r)=O_N,NID(r)=N_DA)
1.1 noro 878: #define NEWBF(q,l) ((q)=(BF)MALLOC_ATOMIC(TRUESIZE(oBF,(l)-1,long)),OID(q)=O_N,NID(q)=N_B)
879: #define NEWC(r) ((r)=(C)MALLOC(sizeof(struct oC)),OID(r)=O_N,NID(r)=N_C)
880: #define NEWLM(r) ((r)=(LM)MALLOC(sizeof(struct oLM)),OID(r)=O_N,NID(r)=N_LM)
881: #define NEWGF2N(r) ((r)=(GF2N)MALLOC(sizeof(struct oGF2N)),OID(r)=O_N,NID(r)=N_GF2N)
882: #define NEWGFPN(r) ((r)=(GFPN)MALLOC(sizeof(struct oGFPN)),OID(r)=O_N,NID(r)=N_GFPN)
883: #define NEWDL(d,n) \
884: ((d)=(DL)MALLOC_ATOMIC(TRUESIZE(oDL,(n)-1,int)),bzero((char *)(d),TRUESIZE(oDL,(n)-1,int)))
1.9 noro 885: #define NEWDL_NOINIT(d,n) \
886: ((d)=(DL)MALLOC_ATOMIC(TRUESIZE(oDL,(n)-1,int)))
1.1 noro 887:
888: #define MKP(v,dc,p) \
1.51 noro 889: ((!DEG(dc)&&!NEXT(dc))?((p)=COEF(dc)):(NEWP(p),VR(p)=(v),DC(p)=(dc),(p)))
1.1 noro 890: #define MKV(v,p) \
891: (NEWP(p),VR(p)=(v),NEWDC(DC(p)),\
892: DEG(DC(p))=ONE,COEF(DC(p))=(P)ONE,NEXT(DC(p))=0)
893: #define MKRAT(n,d,r,p) \
894: (NEWR(p),NM(p)=(n),DN(p)=(d),(p)->reduced=(r))
895: #define MKMV(v,p) \
896: (NEWP(p),VR(p)=(v),NEWDC(DC(p)),\
897: DEG(DC(p))=ONE,COEF(DC(p))=(P)ONEM,NEXT(DC(p))=0)
898: #define MKNODE(a,b,c) \
899: (NEWNODE(a),(a)->body=(pointer)b,NEXT(a)=(NODE)(c))
900: #define MKLIST(a,b) (NEWLIST(a),(a)->body=(NODE)(b))
901: #define MKVECT(m,l) \
902: (NEWVECT(m),(m)->len=(l),(m)->body=(pointer *)CALLOC((l),sizeof(pointer)))
903: #define MKMAT(m,r,c) \
904: (NEWMAT(m),(m)->row=(r),(m)->col=(c),(m)->body=(pointer **)almat_pointer((r),(c)))
905: #define TOGF2MAT(r,c,b,m) (NEWGF2MAT(m),(m)->row=(r),(m)->col=(c),(m)->body=(b))
906: #define TOGFMMAT(r,c,b,m) (NEWGFMMAT(m),(m)->row=(r),(m)->col=(c),(m)->body=(b))
907: #define MKSTR(a,b) (NEWSTR(a),(a)->body=(char *)(b))
908: #define MKDP(n,m,d) (NEWDP(d),(d)->nv=(n),BDY(d)=(m))
1.49 noro 909: #define MKDPV(len,m,d) (NEWDPV(d),(d)->len=(len),BDY(d)=(m))
1.1 noro 910: #define MKLM(b,l) (!(b)?(l)=0:(NEWLM(l),(l)->body=(b),(l)))
911: #define MKGF2N(b,l) (!(b)?(l)=0:(NEWGF2N(l),(l)->body=(b),(l)))
912: #define MKGFPN(b,l) (!(b)?(l)=0:(NEWGFPN(l),(l)->body=(b),(l)))
913: #define MKUSINT(u,b) (NEWUSINT(u),(u)->body=(unsigned)(b))
914: #define MKERR(e,b) (NEWERR(e),(e)->body=(Obj)(b))
915: #define MKMATHCAP(e,b) (NEWMATHCAP(e),(e)->body=(LIST)(b))
1.6 noro 916: #define MKBYTEARRAY(m,l) \
1.64 noro 917: (NEWBYTEARRAY(m),(m)->len=(l),(m)->body=(unsigned char *)MALLOC_ATOMIC((l)),bzero((m)->body,(l)))
1.48 noro 918: #define MKQUOTE(q,b) (NEWQUOTE(q),(q)->body=(pointer)(b))
1.50 noro 919: #define MKQUOTEARG(q,t,b) (NEWQUOTEARG(q),(q)->type=(t),(q)->body=(pointer)(b))
1.1 noro 920:
921: #define NEXTDC(r,c) \
922: if(!(r)){NEWDC(r);(c)=(r);}else{NEWDC(NEXT(c));(c)=NEXT(c);}
923: #define NEXTNODE(r,c) \
924: if(!(r)){NEWNODE(r);(c)=(r);}else{NEWNODE(NEXT(c));(c)=NEXT(c);}
925: #define NEXTMP(r,c) \
926: if(!(r)){NEWMP(r);(c)=(r);}else{NEWMP(NEXT(c));(c)=NEXT(c);}
1.9 noro 927: #define NEXTMP2(r,c,s) \
928: if(!(r)){(c)=(r)=(s);}else{NEXT(c)=(s);(c)=(s);}
1.25 noro 929: #define NEXTDLBUCKET(r,c) \
930: if(!(r)){NEWDLBUCKET(r);(c)=(r);}else{NEWDLBUCKET(NEXT(c));(c)=NEXT(c);}
1.29 noro 931: #define NEXTVL(r,c) \
932: if(!(r)){NEWVL(r);(c)=(r);}else{NEWVL(NEXT(c));(c)=NEXT(c);}
933: #define NEXTDPP(r,c) \
934: if(!(r)){NEWDPP(r);(c)=(r);}else{NEWDPP(NEXT(c));(c)=NEXT(c);}
1.1 noro 935:
936: /* convertors */
937: #define NTOQ(n,s,q) \
938: (!(n)?((q)=0):(NEWQ(q),SGN(q)=(s),NM(q)=(n),DN(q)=0,(q)))
939: #define NDTOQ(n,d,s,q) \
940: ((!(d)||UNIN(d))?NTOQ(n,s,q):(NEWQ(q),SGN(q)=(s),NM(q)=(n),DN(q)=(d),(q)))
941: #define DUPQ(p,q) \
942: (NEWQ(q),SGN(q)=SGN(p),NM(q)=NM(p),DN(q)=DN(p))
943: #define STOQ(n,q) \
944: ((!(n))?((q)=(Q)NULL):(NEWQ(q),\
945: SGN(q)=((n)>0?1:-1),NM(q)=NALLOC(1),\
946: PL(NM(q))=1,BD(NM(q))[0]=ABS(n),DN(q)=0,(q)))
947: #define UTOMQ(a,b) \
948: ((a)?(NEWMQ(b),CONT(b)=(unsigned int)(a),(b)):((b)=0))
1.12 noro 949: #define MKGFS(a,b) \
950: ((NEWGFS(b),CONT(b)=(a),(b)))
1.21 noro 951: #define MKGFSN(a,b) \
952: ((DEG(a)>=0)?(NEWGFSN(b),BDY(b)=(a),(b)):((b)=0))
1.1 noro 953: #define STOMQ(a,b) \
954: ((a)?(NEWMQ(b),CONT(b)=(a),(b)):((b)=0))
955: #define UTON(u,n) \
956: ((!(u))?((n)=(N)NULL):((n)=NALLOC(1),PL(n)=1,BD(n)[0]=(unsigned int)(u),(n)))
957: #define UTOQ(n,q) \
958: ((!(n))?((q)=(Q)NULL):(NEWQ(q),\
959: SGN(q)=1,NM(q)=NALLOC(1),\
960: PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q)))
961: #define QTOS(q) (!(q)?0:SGN(q)*((int)BD(NM(q))[0]))
962: #define STON(i,n)\
963: (i?((n)=NALLOC(1),PL(n)=1,BD(n)[0]=(i),(n)):((n)=(N)0))
964: #define PTOR(a,b) \
965: (!(a)?((b)=0):(NEWR(b),NM(b)=(a),DN(b)=(P)ONE,(b)->reduced=1,(b)))
966: #define RTOS(a) (!(a)?0:QTOS((Q)NM((R)a)))
967: #define MKReal(a,b) (!(a)?((b)=0):(NEWReal(b),BDY(b)=(a),(b)))
968: #define MKAlg(b,r) \
969: (!(b)?((r)=0):NUM(b)?((r)=(Alg)(b)):(NEWAlg(r),BDY(r)=(Obj)(b),(r)))
1.68 noro 970: #define MKDAlg(dp,den,r) (!(dp)?(void *)((r)=0):(void *)(NEWDAlg(r),(r)->nm = (dp),(r)->dn=(den)))
1.1 noro 971:
1.52 noro 972: #define IMM_MAX 1073741823
973: #define IMM_MIN -1073741823
974:
975: #define SL(n) ((n)->p)
976: #define ZALLOC(d) ((Z)MALLOC_ATOMIC(TRUESIZE(oZ,(d)-1,int)))
977:
1.35 ohara 978: #if defined(PARI)
1.3 noro 979: #define ToReal(a) (!(a)?(double)0.0:REAL(a)?BDY((Real)a):RATN(a)?RatnToReal((Q)a):BIGFLOAT(a)?rtodbl(BDY((BF)a)):0)
980: #else
981: #define ToReal(a) (!(a)?(double)0.0:REAL(a)?BDY((Real)a):RATN(a)?RatnToReal((Q)a):0.0)
982: #endif
1.1 noro 983:
984: /* predicates */
985: #define NUM(p) (OID(p)==O_N)
986: #define RAT(p) (OID(p)==O_R)
987: #define RATN(a) (NID(a)==N_Q)
1.65 noro 988: #define POLY(a) (!(a) ||(OID(a)<=O_P))
1.22 noro 989: #define INT(q) (!(q)||(NUM(q)&&RATN((Num)q)&&!DN((Q)q)))
1.1 noro 990: #define REAL(a) (NID(a)==N_R)
1.3 noro 991: #define BIGFLOAT(a) (NID(a)==N_B)
1.1 noro 992: #define SFF(a) (NID(a)==N_M)
993: #define UNIQ(q) ((q)&&NUM(q)&&RATN(q)&&(SGN((Q)q)==1)&&UNIN(NM((Q)q))&&(!DN((Q)q)))
994: #define UNIMQ(q) ((q)&&NUM(q)&&SFF(q)&&(CONT((MQ)q)==1))
995: #define MUNIQ(q) ((q)&&NUM(q)&&RATN(q)&&(SGN((Q)q)==-1)&&UNIN(NM((Q)q))&&(!DN((Q)q)))
996: #define MUNIMQ(q) ((q)&&NUM(q)&&SFF(q)&&(CONT((MQ)q)==-1))
997: #define UNIN(n) ((n)&&(PL(n)==1)&&(BD(n)[0]==1))
998: #define EVENN(n) ((!(n))||(!(BD(n)[0]%2)))
999:
1.8 noro 1000: /* special macros for private memory management */
1001:
1002: #define NV(p) ((p)->nv)
1003: #define C(p) ((p)->c)
1.28 noro 1004: #if 0
1.8 noro 1005: #define ITOS(p) (((unsigned int)(p))&0x7fffffff)
1006: #define STOI(i) ((P)((unsigned int)(i)|0x80000000))
1.28 noro 1007: #else
1008: #define ITOS(p) (((unsigned int)(p)))
1009: #define STOI(i) ((P)((unsigned int)(i)))
1010: #endif
1.15 noro 1011:
1012: /* immediate GFS representation */
1013:
1014: #define IFTOF(p) ((int)(((unsigned int)(p))&0x7fffffff))
1015: #define FTOIF(i) ((int)(((unsigned int)(i)|0x80000000)))
1.8 noro 1016:
1017: struct cdl {
1018: P c;
1019: DL d;
1020: };
1021:
1022: struct cdlm {
1023: int c;
1024: DL d;
1025: };
1026:
1027: extern MP _mp_free_list;
1028: extern DP _dp_free_list;
1029: extern DL _dl_free_list;
1030: extern int current_dl_length;
1031:
1032: #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)
1033: #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)))
1034: #define _NEWMP(m) if(!_mp_free_list)_MP_alloc(); (m)=_mp_free_list; _mp_free_list = NEXT(_mp_free_list)
1.10 noro 1035: #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 1036:
1037: #define _NEXTMP(r,c) \
1038: if(!(r)){_NEWMP(r);(c)=(r);}else{_NEWMP(NEXT(c));(c)=NEXT(c);}
1039:
1040: #define _NEXTMP2(r,c,s) \
1041: if(!(r)){(c)=(r)=(s);}else{NEXT(c)=(s);(c)=(s);}
1042:
1043: #define _FREEDL(m) *((DL *)m)=_dl_free_list; _dl_free_list=(m)
1044: #define _FREEMP(m) NEXT(m)=_mp_free_list; _mp_free_list=(m)
1045: #define _FREEDP(m) BDY(m)=(MP)_dp_free_list; _dp_free_list=(m)
1.1 noro 1046:
1.33 noro 1047: #define MUL_WEIGHT(a,i) (current_dl_weight_vector?(a)*current_dl_weight_vector[i]:(a))
1048:
1.1 noro 1049: /* externals */
1050: #if 0
1051: double NatToReal();
1052: double RatnToReal();
1053: #endif
1054:
1055: extern struct oR oUNIR;
1056: extern struct oQ oUNIQ;
1057: extern struct oMQ oUNIMQ;
1058: extern struct oN oUNIN;
1059: extern struct oUP2 oONEUP2;
1060: extern struct oV oVAR[];
1061: extern struct oV oPVAR[];
1062: extern struct oVL oVLIST[];
1063: extern struct oVL oPVLIST[];
1064: extern VL CO,ALG;
1065: extern VL PVL;
1066: extern R ONER;
1067: extern Q ONE;
1.38 saito 1068: extern Q TWO;
1.1 noro 1069: extern MQ ONEM;
1070: extern LM ONELM;
1071: extern N ONEN;
1072: extern UP2 ONEUP2;
1073:
1074: extern FILE *asir_out;
1.7 noro 1075: #if defined(__GNUC__)
1.1 noro 1076: extern const int sprime[];
1077: #else
1078: extern int sprime[];
1079: #endif
1080:
1081: extern void (*addnumt[])();
1082: extern void (*subnumt[])();
1083: extern void (*mulnumt[])();
1084: extern void (*divnumt[])();
1085: extern void (*pwrnumt[])();
1086: extern int (*cmpnumt[])();
1087: extern void (*chsgnnumt[])();
1088:
1.29 noro 1089: extern int current_mod;
1090: extern GEN_UP2 current_mod_gf2n;
1091: extern int lm_lazy;
1092: extern int current_ff;
1093: extern V up_var;
1094: extern V up2_var;
1095: extern P current_gfs_ext;
1096: extern int current_gfs_p;
1097: extern int current_gfs_q;
1098: extern int current_gfs_q1;
1099: extern int *current_gfs_plus1;
1100: extern int *current_gfs_ntoi;
1101: extern int *current_gfs_iton;
1.33 noro 1102:
1103: extern int *current_dl_weight_vector;
1.29 noro 1104:
1.1 noro 1105: /* prototypes */
1106: int compui(VL,USINT,USINT);
1.6 noro 1107: int compbytearray(VL,BYTEARRAY,BYTEARRAY);
1.1 noro 1108:
1109: void powermodup(UP,UP *);
1110: void hybrid_powermodup(UP,UP *);
1111:
1112: void powertabup(UP,UP,UP *);
1113: void hybrid_powertabup(UP,UP,UP *);
1114:
1115: void generic_powermodup(UP,UP,Q,UP *);
1116: void hybrid_generic_powermodup(UP,UP,Q,UP *);
1117:
1118: void powermod1up(UP,UP *);
1119: void hybrid_rembymulup_special(int,UP,UP,UP,UP *);
1120: void hybrid_tmulup(int,UP,UP,int,UP *);
1121: void hybrid_squareup(int,UP,UP *);
1122: void hybrid_mulup(int,UP,UP,UP *);
1123:
1124: void getmod_lm(N *);
1125:
1126: int maxblenup(UP);
1127: void monicup(UP,UP *);
1128: void simpup(UP,UP *);
1129: void simpnum(Num,Num *);
1130: void decompp(P,Q,P *,P *);
1131: void truncp(P,Q,P *);
1132: void uremp(P,P,P *);
1133: void ugcdp(P,P,P *);
1134: void reversep(P,Q,P *);
1135: void invmodp(P,Q,P *);
1136: void addup(UP,UP,UP *);
1137: void subup(UP,UP,UP *);
1138: void chsgnup(UP,UP *);
1139: void mulup(UP,UP,UP *);
1140: void tmulup(UP,UP,int,UP *);
1141: void squareup(UP,UP *);
1142: void remup(UP,UP,UP *);
1143: void remup_destructive(UP,UP);
1144: void qrup(UP,UP,UP *,UP *);
1145: void qrup_destructive(UP,UP);
1146: void gcdup(UP,UP,UP *);
1147: void reverseup(UP,int,UP *);
1148: void invmodup(UP,int,UP *);
1149: void pwrup(UP,Q,UP *);
1150: void squarep_gf2n(VL,P,P *);
1151: void kmulp(VL,P,P,P *);
1152: void ksquarep(VL,P,P *);
1153: void kmulup(UP,UP,UP *);
1154: void ksquareup(UP,UP *);
1155: void extractup(UP,int,int,UP *);
1156: void copyup(UP,UP);
1157: void c_copyup(UP,int,pointer *);
1158: void kmulupmain(UP,UP,UP *);
1159: void ksquareupmain(UP,UP *);
1160: void rembymulup(UP,UP,UP *);
1161: void rembymulup_special(UP,UP,UP,UP *);
1162: void tkmulup(UP,UP,int,UP *);
1163: void shiftup(UP,int,UP *);
1164: void set_degreeup(UP,int);
1165: void decompup(UP,int,UP *,UP *);
1166: void truncup(UP,int,UP *);
1167: void uptofmarray(int,UP,ModNum *);
1168: void fmarraytoup(ModNum *,int,UP *);
1169: void uiarraytoup(unsigned int **,int,int,UP *);
1170: void adj_coefup(UP,N,N,UP *);
1171: void uptolmup(UP,UP *);
1172: void remcup(UP,N,UP *);
1173: void fft_mulup(UP,UP,UP *);
1174: void fft_squareup(UP,UP *);
1175: void trunc_fft_mulup(UP,UP,int,UP *);
1176: void shoup_fft_mulup(UP,UP,UP *);
1177: void shoup_fft_squareup(UP,UP *);
1178: void shoup_trunc_fft_mulup(UP,UP,int,UP *);
1179: void crup(ModNum **,int,int *,int,N,UP *);
1180: void shoup_crup(ModNum **,int,int *,int,N,N,UP *);
1181: void squareup_gf2n(UP,UP *);
1182: void powermodup_gf2n(UP,UP *);
1183: void generic_powermodup_gf2n(UP,UP,Q,UP *);
1184: void tracemodup_gf2n(UP,UP,Q,UP *);
1185: void tracemodup_gf2n_slow(UP,UP,Q,UP *);
1186: void tracemodup_gf2n_tab(UP,UP,Q,UP *);
1187: void square_rem_tab_up_gf2n(UP,UP *,UP *);
1188: void powertabup_gf2n(UP,UP,UP *);
1189: void find_root_gf2n(UP,GF2N *);
1190:
1.44 noro 1191: int cmpdl_composite(int,DL,DL);
1.1 noro 1192: int cmpdl_matrix(int,DL,DL);
1193: int cmpdl_order_pair(int,DL,DL);
1194: int cmpdl_elim(int,DL,DL);
1195: int cmpdl_blexrev(int,DL,DL);
1196: int cmpdl_bgradrev(int,DL,DL);
1197: int cmpdl_brevrev(int,DL,DL);
1198: int cmpdl_brevgradlex(int,DL,DL);
1199: int cmpdl_bgradlex(int,DL,DL);
1200: int cmpdl_blex(int,DL,DL);
1201: int cmpdl_revgradlex(int,DL,DL);
1202: int cmpdl_gradlex(int,DL,DL);
1203: int cmpdl_revlex(int,DL,DL);
1204: int cmpdl_lex(int,DL,DL);
1205: int compd(VL,DP,DP);
1206: void adddl(int,DL,DL,DL *);
1207: void divsdc(VL,DP,P,DP *);
1208: void muldc(VL,DP,P,DP *);
1209: void muldm(VL,DP,MP,DP *);
1210: void muld(VL,DP,DP,DP *);
1211: void chsgnd(DP,DP *);
1212: void subd(VL,DP,DP,DP *);
1213: void addd(VL,DP,DP,DP *);
1214: int sugard(MP);
1215: void nodetod(NODE,DP *);
1216: void dtop(VL,VL,DP,P *);
1217: void ptod(VL,VL,P,DP *);
1218: void initd(struct order_spec *);
1.49 noro 1219:
1220: void adddv(VL,DPV,DPV,DPV *);
1221: void subdv(VL,DPV,DPV,DPV *);
1222: void muldv(VL,DP,DPV,DPV *);
1223: void chsgndv(DPV,DPV *);
1224: int compdv(VL,DPV,DPV);
1.1 noro 1225:
1226: void _printdp(DP);
1227: void _dp_sp_mod(DP,DP,int,DP *);
1228: void _dp_mod(DP,int,NODE,DP *);
1229: void _dp_red_mod(DP,DP,int,DP *);
1230: void _dtop_mod(VL,VL,DP,P *);
1231: void _mulmdm(VL,int,DP,MP,DP *);
1232: void _mulmd(VL,int,DP,DP,DP *);
1233: void _chsgnmd(int,DP,DP *);
1234: void _submd(VL,int,DP,DP,DP *);
1235: void _addmd(VL,int,DP,DP,DP *);
1236: void _mdtop(VL,int,VL,DP,P *);
1237: void divsmdc(VL,int,DP,P,DP *);
1238: void mulmdc(VL,int,DP,P,DP *);
1239: void mulmdm(VL,int,DP,MP,DP *);
1240: void mulmd(VL,int,DP,DP,DP *);
1241: void chsgnmd(int,DP,DP *);
1242: void submd(VL,int,DP,DP,DP *);
1243: void addmd(VL,int,DP,DP,DP *);
1244: void mdtop(VL,int,VL,DP,P *);
1245: void mptomd(VL,int,VL,P,DP *);
1246: void ptomd(VL,int,VL,P,DP *);
1247: int p_mag(P);
1248: int n_bits(N);
1249: void gcdBinary_27n(N,N,N *);
1250: void rtime_init(void);
1251: void setmod_gf2n(P);
1252: void mt_sgenrand(unsigned long);
1253: unsigned long mt_genrand(void);
1254: #if defined(VISUAL)
1255: void srandom(unsigned int);
1256: unsigned int random(void);
1257: #endif
1258: void gcdbmodn(N,N,N *);
1259: void gcdbinn(N,N,N *);
1260: void gcdmodn(N,N,N *);
1261: void gcdaccn(N,N,N *);
1262: void gcdEuclidn(N,N,N *);
1263: void GC_free(void *);
1264: void FFT_primes(int,int *,int *,int *);
1265: int FFT_pol_product(unsigned int,unsigned int *, unsigned int,unsigned int *,
1266: unsigned int *,int,unsigned int *);
1267: int FFT_pol_square(unsigned int,unsigned int *,
1268: unsigned int *,int,unsigned int *);
1269: void dcptolist(DCP,LIST *);
1270: void gcdprsmp(VL,int,P,P,P *);
1271: void mult_mod_tab(UM,int,UM *,UM,int);
1272: int nfctr_mod(UM,int);
1273: int irred_check(UM,int);
1274: void modfctrp(P,int,int,DCP *);
1275: void pf_init(void);
1276: void binaryton(char *,N *);
1277: void hexton(char *,N *);
1278: void ptolmp(P,P *);
1279: void lmptop(P,P *);
1280: void ulmptoum(int,UP,UM);
1281: void objtobobj(int,Obj,Obj *);
1282: void bobjtoobj(int,Obj,Obj *);
1283: void numtobnum(int,Num,Num *);
1284: void bnumtonum(int,Num,Num *);
1285: void ptobp(int,P,P *);
1286: void bptop(int,P,P *);
1287: void listtoblist(int,LIST,LIST *);
1288: void blisttolist(int,LIST,LIST *);
1289: void vecttobvect(int,VECT,VECT *);
1290: void bvecttovect(int,VECT,VECT *);
1291: void mattobmat(int,MAT,MAT *);
1292: void bmattomat(int,MAT,MAT *);
1293: void n32ton27(N,N *);
1294: void n27ton32(N,N *);
1295: void kmulum(int,UM,UM,UM);
1296: void saveobj(FILE *,Obj);
1297: void endian_init(void);
1298: void write_char(FILE *,unsigned char *);
1299: void write_short(FILE *,unsigned short *);
1300: void write_int(FILE *,unsigned int *);
1301: void write_double(FILE *,double *);
1302: void write_intarray(FILE *,unsigned int *,int);
1303: void write_string(FILE *,unsigned char *,int);
1304: void savestr(FILE *,char *);
1305: void loadstr(FILE *,char **);
1306: void savevl(FILE *,VL);
1307: void loadvl(FILE *);
1308: void skipvl(FILE *);
1309: void savev(FILE *,V);
1310: void loadv(FILE *,V *);
1311: int save_convv(V);
1312: V load_convv(int);
1313: void swap_bytes(char *,int,int);
1314: void read_char(FILE *,unsigned char *);
1315: void read_short(FILE *,unsigned short *);
1316: void read_int(FILE *,unsigned int *);
1317: void read_double(FILE *,double *);
1318: void read_intarray(FILE *,unsigned int *,int);
1319: void read_string(FILE *,unsigned char *,int);
1320: void loadobj(FILE *,Obj *);
1321: void invum(int,UM,UM,UM);
1322: void addarray_to(unsigned int *,int,unsigned int *,int);
1323: void muln_1(unsigned int *,int,unsigned int,unsigned int *);
1324: unsigned int divn_1(unsigned int *,int,unsigned int,unsigned int *);
1325: void ptoup(P,UP *);
1326: void uptop(UP,P *);
1327: void printnum(Num);
1328: void printv(VL,V);
1329: void kmulq(Q,Q,Q *);
1330: void bshiftn(N,int,N *);
1331: void remn(N,N,N*);
1332: void simplm(LM,LM *);
1333: void qtolm(Q,LM *);
1334: int qpcheck(Obj);
1335: int headsgn(P);
1336: void adjsgn(P,DCP);
1337: void setmod_g2n(P);
1338: void simpgf2n(GF2N,GF2N *);
1339: void ptogf2n(Obj,GF2N *);
1340: void gf2ntop(GF2N,P *);
1341: void gf2ntovect(GF2N,VECT *);
1342: void squaregf2n(GF2N,GF2N *);
1343: void randomgf2n(GF2N *);
1344: void invgf2n(GF2N,GF2N *);
1345: void kmuln(N,N,N *);
1346: void extractn(N,int,int,N *);
1347: void copyn(N,int,int *);
1348: void kmulnmain(N,N,N *);
1349: int qcoefp(Obj);
1350: int qcoefr(Obj);
1.80 ohara 1351: size_t get_allocwords(void);
1.1 noro 1352: double get_clock(void);
1353: void get_eg(struct oEGT *);
1354: void printtime(struct oEGT *,struct oEGT *,double);
1355: void init_eg(struct oEGT *);
1356: void add_eg(struct oEGT *,struct oEGT *,struct oEGT *);
1357: void print_eg(char *,struct oEGT *);
1358: void print_split_eg(struct oEGT *,struct oEGT *);
1359: void print_split_e(struct oEGT *,struct oEGT *);
1360: void suspend_timer(void);
1361: void resume_timer(void);
1362: void reset_engine(void);
1363: void notdef(VL,Obj,Obj,Obj *);
1364: void error(char *);
1365: void ptoup2(P,UP2 *);
1366: void ptoup2_sparse(P,UP2 *);
1367: void up2top(UP2,P *);
1368: void up2tovect(UP2,VECT *);
1369: void up2ton(UP2,Q *);
1370: void ntoup2(Q,UP2 *);
1371: void gen_simpup2(UP2,GEN_UP2,UP2 *);
1372: void gen_simpup2_destructive(UP2,GEN_UP2);
1373: void gen_invup2(UP2,GEN_UP2,UP2 *);
1374: void gen_pwrmodup2(UP2,Q,GEN_UP2,UP2 *);
1375: void simpup2(UP2,UP2,UP2 *);
1376: int degup2(UP2);
1377: int degup2_sparse(UP2);
1378: int degup2_1(unsigned int);
1379: void addup2(UP2,UP2,UP2 *);
1380: void subup2(UP2,UP2,UP2 *);
1381: void mulup2_n1(unsigned int *,int,unsigned int,unsigned int *);
1382: void mulup2_nh(unsigned int *,int,unsigned int,unsigned int *);
1383: void _mulup2_1(UP2,unsigned int,UP2);
1384: void _mulup2_h(UP2,unsigned int,UP2);
1385: void mulup2(UP2,UP2,UP2 *);
1386: void _kmulup2_(unsigned int *,unsigned int *,int,unsigned int *);
1387: void _mulup2_nn(unsigned int *,unsigned int *,int,unsigned int *);
1388: void _mulup2(UP2,UP2,UP2);
1389: void _mulup2_(_UP2,_UP2,_UP2);
1390: void squareup2(UP2,UP2 *);
1391: void _adjup2(UP2);
1392: void _adjup2_(_UP2);
1393: void _addup2(UP2,UP2,UP2);
1394: void _addup2_destructive(UP2,UP2);
1395: void _addup2_(_UP2,_UP2,_UP2);
1396: void _addtoup2_(_UP2,_UP2);
1397: unsigned int mulup2_bb(unsigned int,unsigned int);
1398: void init_up2_tab(void);
1399: unsigned int quoup2_11(unsigned int,unsigned int);
1400: void divup2_1(unsigned int,unsigned int,int,int,unsigned int *,unsigned int *);
1401: void qrup2(UP2,UP2,UP2 *,UP2 *);
1402: void _qrup2(UP2,UP2,UP2,UP2);
1403: void remup2(UP2,UP2,UP2 *);
1404: void _remup2(UP2,UP2,UP2);
1405: void remup2_sparse(UP2,UP2,UP2 *);
1406: void remup2_sparse_destructive(UP2,UP2);
1407: void remup2_type1_destructive(UP2,int);
1408: void remup2_3_destructive(UP2,UP2);
1409: void remup2_5_destructive(UP2,UP2);
1410: void _invup2_1(unsigned int,unsigned int,unsigned int *,unsigned int *);
1411: void _gcdup2_1(unsigned int,unsigned int,unsigned int *);
1412: void up2_init_eg(void);
1413: void up2_show_eg(void);
1414: void invup2(UP2,UP2,UP2 *);
1415: void gcdup2(UP2,UP2,UP2 *);
1416: void chsgnup2(UP2,UP2 *);
1417: void pwrmodup2(UP2,Q,UP2,UP2 *);
1418: void pwrmodup2_sparse(UP2,Q,UP2,UP2 *);
1419: int compup2(UP2,UP2);
1420: void printup2(UP2);
1421: void _copyup2(UP2,UP2);
1422: void _bshiftup2(UP2,int,UP2);
1423: void _bshiftup2_destructive(UP2,int);
1424: void diffup2(UP2,UP2 *);
1425: int sqfrcheckup2(UP2);
1426: int irredcheckup2(UP2);
1427: int irredcheck_dddup2(UP2);
1428: void _copy_up2bits(UP2,unsigned int **,int);
1429: void _print_frobmat(unsigned int **,int,int);
1430: int compute_multiplication_matrix(P,GF2MAT *);
1431: void compute_change_of_basis_matrix(P,P,int,GF2MAT *,GF2MAT *);
1432: int compute_representation_conversion_matrix(P,GF2MAT *,GF2MAT *);
1433: void mul_nb(GF2MAT,unsigned int *,unsigned int *,unsigned int *);
1434: void leftshift(unsigned int *,int);
1435: void mat_to_gf2mat(MAT,unsigned int ***);
1436: void gf2mat_to_mat(unsigned int **,int,MAT *);
1437: void mulgf2mat(int,unsigned int **,unsigned int **,unsigned int **);
1438: void mulgf2vectmat(int,unsigned int *,unsigned int **,unsigned int *);
1439: int mulgf2vectvect(int,unsigned int *,unsigned int *);
1440: int invgf2mat(int,unsigned int **,unsigned int **);
1441: void _mulup2_11(unsigned int,unsigned int,unsigned int *);
1442: void _mulup2_22(unsigned int *,unsigned int *,unsigned int *);
1443: void _mulup2_33(unsigned int *,unsigned int *,unsigned int *);
1444: void _mulup2_44(unsigned int *,unsigned int *,unsigned int *);
1445: void _mulup2_55(unsigned int *,unsigned int *,unsigned int *);
1446: void _mulup2_66(unsigned int *,unsigned int *,unsigned int *);
1447: void printup2_(unsigned int *,int);
1448: void type1_bin_invup2(UP2,int,UP2 *);
1449: int int_bits(int);
1450:
1451:
1452: LUM LUMALLOC(int, int);
1.16 noro 1453: BM BMALLOC(int, int);
1.1 noro 1454: Obj ToAlg(Num);
1455: UM *berlemain(register int, UM, UM *);
1.75 ohara 1456: void Risa_GC_set_adj(int,int);
1457: void Risa_GC_get_adj(int *,int *);
1.1 noro 1458: void *Risa_GC_malloc(size_t);
1459: void *Risa_GC_malloc_atomic(size_t);
1460: void *Risa_GC_realloc(void *,size_t);
1.83 ohara 1461: void Risa_GC_free(void *);
1462: void *Risa_GC_malloc_atomic_ignore_off_page(size_t);
1.1 noro 1463: void *GC_malloc(size_t);
1464: void *GC_malloc_atomic(size_t);
1465: void *GC_realloc(void *,size_t);
1466: double NatToReal(N,int *);
1467: double RatnToReal(Q);
1468: double pwrreal0(double,int);
1.3 noro 1469: double rtodbl(); /* XXX */
1.1 noro 1470: int **almat(int,int);
1471: pointer **almat_pointer(int,int);
1472: int berlecnt(register int,UM);
1473: int berlecntmain(register int,int,int,register int **);
1474: int cmpalg(Num,Num);
1475: int cmpbf(Num,Num);
1476: int cmpcplx(Num,Num);
1477: int cmpn(N,N);
1478: int cmpq(Q,Q);
1479: int cmpreal(Real,Real);
1480: int cmpmi(MQ,MQ);
1481: int cmplm(LM,LM);
1482: int compmat(VL,MAT,MAT);
1483: int compnum(VL,Num,Num);
1484: int compp(VL,P,P);
1485: int compr(VL,Obj,Obj);
1486: int compstr(VL,STRING,STRING);
1487: int compvect(VL,VECT,VECT);
1488: int ctest(P,ML,int,int *);
1489: int cycchk(P);
1490: int dbound(V,P);
1491: int dcomp(P,P);
1492: int deg(V,P);
1493: int degtest(int,int *,ML,int);
1494: int divcheck(VL,P *,int,P,P);
1495: unsigned int divin(N,unsigned int,N *);
1496: int divtdcpz(VL,P,P,P *);
1497: int divtpz(VL,P,P,P *);
1498: int divum(register int,UM,UM,UM);
1499: int dm(int,int,int *);
1500: int dmb(int,int,int,int *);
1501: int dma(int,int,int,int *);
1502: int dmab(int,int,int,int,int *);
1503: int dmar(int,int,int,int);
1504: int dtestmain(P,Q,ML,int,int *,P *,P *);
1505: int geldb(VL,P);
1506: int getchomdeg(V,P);
1507: int getdeg(V,P);
1508: int getlchomdeg(V,P,int *);
1.29 noro 1509: int get_lprime(int);
1.1 noro 1510: int homdeg(P);
1511: unsigned int invm(unsigned int,int);
1512: int iscycm(P);
1513: int iscycp(P);
1514: int lengthp(P);
1515: int mig(int,int,P);
1516: int mignotte(int,P);
1517: int minimain(register int,int,int,register int **);
1518: int ncombi(int,int,int,int *);
1519: int nextbin(VN,int);
1520: int nmonop(P);
1521: int pcoef(VL,VL,P,P *);
1522: int pcoef0(VL,VL,P,P *);
1523: unsigned int pwrm(register int,register int,int);
1.29 noro 1524: unsigned int rem(N,int);
1.1 noro 1525: int sqfrchk(P);
1526: int subn(N,N,N *);
1527: int ucmpp(P,P);
1528: int valideval(VL,DCP,VN);
1529: int zerovpchk(VL,P,VN);
1530:
1531: void addgf2n(GF2N,GF2N,GF2N *);
1532: void subgf2n(GF2N,GF2N,GF2N *);
1533: void mulgf2n(GF2N,GF2N,GF2N *);
1534: void divgf2n(GF2N,GF2N,GF2N *);
1535: void chsgngf2n(GF2N,GF2N *);
1536: void pwrgf2n(GF2N,Q, GF2N *);
1537: int cmpgf2n(GF2N,GF2N);
1538:
1539: void addgfpn(GFPN,GFPN,GFPN *);
1540: void subgfpn(GFPN,GFPN,GFPN *);
1541: void mulgfpn(GFPN,GFPN,GFPN *);
1542: void divgfpn(GFPN,GFPN,GFPN *);
1543: void chsgngfpn(GFPN,GFPN *);
1544: void pwrgfpn(GFPN,Q, GFPN *);
1545: int cmpgfpn(GFPN,GFPN);
1.12 noro 1546:
1547: void addgfs(GFS,GFS,GFS *);
1548: void subgfs(GFS,GFS,GFS *);
1549: void mulgfs(GFS,GFS,GFS *);
1550: void divgfs(GFS,GFS,GFS *);
1551: void chsgngfs(GFS,GFS *);
1552: void pwrgfs(GFS,Q, GFS *);
1553: int cmpgfs(GFS,GFS);
1.20 noro 1554:
1.21 noro 1555: void addgfsn(GFSN,GFSN,GFSN *);
1556: void subgfsn(GFSN,GFSN,GFSN *);
1557: void mulgfsn(GFSN,GFSN,GFSN *);
1558: void divgfsn(GFSN,GFSN,GFSN *);
1559: void chsgngfsn(GFSN,GFSN *);
1560: void pwrgfsn(GFSN,Q, GFSN *);
1561: int cmpgfsn(GFSN,GFSN);
1.53 noro 1562:
1563: void adddalg(DAlg,DAlg,DAlg *);
1564: void subdalg(DAlg,DAlg,DAlg *);
1565: void muldalg(DAlg,DAlg,DAlg *);
1566: void divdalg(DAlg,DAlg,DAlg *);
1567: void chsgndalg(DAlg,DAlg *);
1568: void pwrdalg(DAlg,Q, DAlg *);
1569: int cmpdalg(DAlg,DAlg);
1.1 noro 1570:
1571: void addalg(Num,Num,Num *);
1572: void addbf(Num,Num,Num *);
1573: void addcplx(Num,Num,Num *);
1574: void addm2p(VL,Q,Q,P,P,P *);
1575: void addm2q(Q,Q,Q,Q,Q *);
1576: void addmat(VL,MAT,MAT,MAT *);
1577: void addmp(VL,int,P,P,P *);
1578: void addmpq(int,P,P,P *);
1579: void addmptoc(VL,int,P,P,P *);
1580: void addmq(int,MQ,MQ,MQ *);
1581: void addn(N,N,N *);
1582: void addnum(VL,Num,Num,Num *);
1583: void addp(VL,P,P,P *);
1584: void addpadic(int,int,unsigned int *,unsigned int *);
1585: void addpq(P,P,P *);
1586: void addptoc(VL,P,P,P *);
1587: void addq(Q,Q,Q *);
1588: void addr(VL,Obj,Obj,Obj *);
1589: void addreal(Num,Num,Real *);
1590: void addmi(MQ,MQ,MQ *);
1591: void addlm(LM,LM,LM *);
1592: void addstr(VL,STRING,STRING,STRING *);
1593: void addum(int,UM,UM,UM);
1594: void addvect(VL,VECT,VECT,VECT *);
1.19 noro 1595: void addquote(VL,QUOTE,QUOTE,QUOTE *);
1.1 noro 1596: void adjc(VL,P,P,P,Q,P *,P *);
1597: void afctr(VL,P,P,DCP *);
1598: void afctrmain(VL,P,P,int,DCP *);
1599: void affine(VL,P,VN,P *);
1600: void affinemain(VL,P,V,int,P *,P *);
1601: void berle(int,int,P,ML *);
1602: void bnton(register int,N,N *);
1603: void cbound(VL,P,Q *);
1604: void chnrem(int,V,P,Q,UM,P *,Q *);
1605: void chnremp(VL,int,P,Q,P,P *);
1606: void chsgnalg(Num,Num *);
1607: void chsgnbf(Num a,Num *);
1608: void chsgncplx(Num,Num *);
1609: void chsgnmat(MAT,MAT *);
1610: void chsgnmp(int,P,P *);
1611: void chsgnnum(Num,Num *);
1612: void chsgnp(P,P *);
1613: void chsgnq(Q,Q *);
1614: void chsgnr(Obj,Obj *);
1615: void chsgnreal(Num,Num *);
1616: void chsgnmi(MQ,MQ *);
1617: void chsgnlm(LM,LM *);
1618: void chsgnvect(VECT,VECT *);
1.19 noro 1619: void chsgnquote(QUOTE,QUOTE *);
1.1 noro 1620: void clctv(VL,P,VL *);
1621: void clctvr(VL,Obj,VL *);
1622: void cm2p(Q,Q,P,P *);
1623: void cmax(P,Q *);
1624: void cmp(Q,P,P *);
1625: void coefp(P,int,P *);
1626: void cpylum(int,LUM,LUM);
1627: void cpyum(UM,UM);
1628: void csump(VL,P,Q *);
1629: void cycm(V,register int,DCP *);
1630: void cycp(V,register int,DCP *);
1631: void degp(V,P,Q *);
1632: void degum(UM,int);
1633: void detmp(VL,int,P **,int,P *);
1634: void detp(VL,P **,int,P *);
1635: void diffp(VL,P,V,P *);
1636: void diffum(register int,UM,UM);
1637: void divalg(Num,Num,Num *);
1638: void divbf(Num,Num,Num *);
1639: void divcp(P,Q,P *);
1640: void divcplx(Num,Num,Num *);
1641: void divmat(VL,Obj,Obj,Obj *);
1642: void divmq(int,MQ,MQ,MQ *);
1643: void divn(N,N,N *,N *);
1644: void divnmain(int,int,unsigned int *,unsigned int *,unsigned int *);
1645: void divnum(VL,Num,Num,Num *);
1646: void divq(Q,Q,Q *);
1647: void divr(VL,Obj,Obj,Obj *);
1648: void divreal(Num,Num,Real *);
1649: void divmi(MQ,MQ,MQ *);
1650: void divlm(LM,LM,LM *);
1651: void divsdcmp(VL,int,P,P,P *);
1652: void divsdcp(VL,P,P,P *);
1653: void divsmp(VL,int,P,P,P *);
1654: void divsn(N,N,N *);
1655: void divsp(VL,P,P,P *);
1656: void divsrdcmp(VL,int,P,P,P *,P *);
1657: void divsrdcp(VL,P,P,P *,P *);
1658: void divsrmp(VL,int,P,P,P *,P *);
1659: void divsrp(VL,P,P,P *,P *);
1660: void divvect(VL,Obj,Obj,Obj *);
1.19 noro 1661: void divquote(VL,QUOTE,QUOTE,QUOTE *);
1.1 noro 1662: void dtest(P,ML,int,DCP *);
1663: void dtestroot(int,int,P,LUM,struct oDUM *,DCP *);
1664: void dtestroot1(int,int,P,LUM,P *);
1665: void dtestsq(int,int,P,LUM,P *);
1666: void dtestsql(P,ML,struct oDUM *,DCP *);
1.41 ohara 1667: void ediffp(VL,P,V,P *);
1.1 noro 1668: void estimatelc(VL,Q,DCP,VN,P *);
1669: void eucum(register int,UM,UM,UM,UM);
1670: void exthp(VL,P,int,P *);
1671: void exthpc(VL,V,P,int,P *);
1672: void ezgcd1p(VL,P,P,P *);
1673: void ezgcdhensel(P,int,UM,UM,ML *);
1674: void ezgcdnp(VL,P,P *,int,P *);
1675: void ezgcdnpp(VL,DCP,P *,int,P *);
1676: void ezgcdnpz(VL,P *,int,P *);
1677: void ezgcdp(VL,P,P,P *);
1678: void ezgcdpp(VL,DCP,P,P *);
1679: void ezgcdpz(VL,P,P,P *);
1680: void factorial(int,Q *);
1681: void fctrp(VL,P,DCP *);
1682: void fctrwithmvp(VL,P,V,DCP *);
1683: void gcda(VL,P,P,P,P *);
1684: void gcdcp(VL,P,P *);
1685: void gcdgen(P,ML,ML *);
1686: void gcdmonomial(VL,DCP *,int,P *);
1687: void gcdn(N,N,N *);
1688: void gcdprsp(VL,P,P,P *);
1689: void gcdum(register int,UM,UM,UM);
1690: void getmindeg(V,P,Q *);
1691: void henmain(LUM,ML,ML,ML *);
1692: void henmv(VL,VN,P,P,P,P,P,P,P,P,P,Q,int,P *,P *);
1693: void henmvmain(VL,VN,P,P,P,P,P,P,P,Q,Q,int,P *,P *);
1694: void henprep(P,ML,ML,ML *,ML *);
1695: void hensel(int,int,P,ML *);
1696: void henzq(P,P,UM,P,UM,int,int,P *,P *,P *,P *,Q *);
1697: void henzq1(P,P,Q,P *,P *,Q *);
1698: void hsq(int,int,P,int *,DCP *);
1699: void intersectv(VL,VL,VL *);
1700: void invl(Q,Q,Q *);
1701: void invmq(int,MQ,MQ *);
1702: void invq(Q,Q *);
1703: void lgp(P,N *,N *);
1704: void lumtop(V,int,int,LUM,P *);
1705: void markv(VN,int,P);
1706: void maxdegp(VL,P,VL *,P *);
1707: void mergev(VL,VL,VL,VL *);
1708: void mfctr(VL,P,DCP *);
1709: void mfctrhen2(VL,VN,P,P,P,P,P,P,P *);
1710: void mfctrmain(VL,P,DCP *);
1711: void mfctrwithmv(VL,P,V,DCP *);
1712: void min_common_vars_in_coefp(VL,P,VL *,P *);
1713: void minchdegp(VL,P,VL *,P *);
1714: void mindegp(VL,P,VL *,P *);
1715: void mini(register int,UM,UM);
1716: void minlcdegp(VL,P,VL *,P *);
1717: void mkbc(int,Q *);
1718: void mkbcm(int,int,MQ *);
1719: void mkssum(V,int,int,int,P *);
1720: void monomialfctr(VL,P,P *,DCP *);
1721: void mptop(P,P *);
1722: void mptoum(P,UM);
1723: void msqfr(VL,P,DCP *);
1724: void msqfrmain(VL,P,DCP *);
1725: void msqfrmainmain(VL,P,VN,P,DCP,DCP *,P *);
1726: void mulalg(Num,Num,Num *);
1727: void mulbf(Num,Num,Num *);
1728: void mulcplx(Num,Num,Num *);
1729: void mulin(N,unsigned int,unsigned int *);
1730: void mullum(int,int,LUM,LUM,LUM);
1731: void mullumarray(P,ML,int,int *,P *);
1732: void mulm2p(VL,Q,Q,P,P,P *);
1733: void mulm2q(Q,Q,Q,Q,Q *);
1734: void mulmat(VL,Obj,Obj,Obj *);
1735: void mulmatmat(VL,MAT,MAT,MAT *);
1736: void mulmatvect(VL,MAT,VECT,VECT *);
1737: void mulmp(VL,int,P,P,P *);
1738: void mulmpc(VL,int,P,P,P *);
1739: void mulmpq(int,P,P,P *);
1740: void mulmq(int,MQ,MQ,MQ *);
1741: void muln(N,N,N *);
1742: void mulnum(VL,Num,Num,Num *);
1743: void mulp(VL,P,P,P *);
1744: void mulpadic(int,int,unsigned int *,unsigned int *,unsigned int *);
1745: void mulpc(VL,P,P,P *);
1746: void mulpq(P,P,P *);
1747: void mulq(Q,Q,Q *);
1748: void mulr(VL,Obj,Obj,Obj *);
1749: void mulreal(Num,Num,Real *);
1750: void mulmi(MQ,MQ,MQ *);
1751: void mullm(LM,LM,LM *);
1752: void mulrmat(VL,Obj,MAT,MAT *);
1753: void mulrvect(VL,Obj,VECT,VECT *);
1754: void mulsgn(VN,VN,int,VN);
1755: void mulsum(register int,UM,register int,UM);
1756: void mulum(register int,UM,UM,UM);
1757: void mulvect(VL,Obj,Obj,Obj *);
1.19 noro 1758: void mulquote(VL,QUOTE,QUOTE,QUOTE *);
1.1 noro 1759: void mulvectmat(VL,VECT,MAT,VECT *);
1760: void next(VN);
1761: void nezgcdnp_sqfr_primitive(VL,P,P *,int,P *);
1762: void nezgcdnpp(VL,DCP,P *,int,P *);
1763: void nezgcdnpz(VL,P *,int,P *);
1764: void nezgcdnpzmain(VL,P *,int,P *);
1765: void nglob_init(void);
1766: void norm(P,Q *);
1767: void norm1(P,P *);
1768: void norm1c(P,Q *);
1769: void normalizemp(int,P);
1770: void nthrootchk(P,struct oDUM *,ML,DCP *);
1771: void nthrootn(N,int,N *);
1772: void ntobn(register int,N,N *);
1773: void nuezgcdnpzmain(VL,P *,int,P *);
1774: void padictoq(int,int,int *,Q *);
1775: void risa_pari_init(void);
1776: void pcp(VL,P,P *,P *);
1777: void pderivr(VL,Obj,V,Obj *);
1778: void pdiva(VL,P,P,P,P *);
1779: void pinva(P,P,P *);
1780: void plisttop(P *,V,int,P *);
1781: void pmonic(VL,P,P,P *);
1782: void pqra(VL,P,P,P,P *,P *);
1783: void premmp(VL,int,P,P,P *);
1784: void premp(VL,P,P,P *);
1785: void ptolum(int,int,P,LUM);
1786: void ptomp(int,P,P *);
1787: void ptoum(int,P,UM);
1788: void ptozp(P,int,Q *,P *);
1789: void ptozp0(P,P *);
1790: void pwralg(Num,Num,Num *);
1791: void pwrbf(Num,Num,Num *);
1792: void pwrcplx(Num,Num,Num *);
1793: void pwrcplx0(Num,int,Num *);
1794: void pwrlum(int,int,LUM,int,LUM);
1795: void pwrmat(VL,MAT,Obj,MAT *);
1796: void pwrmatmain(VL,MAT,int,MAT *);
1797: void pwrmp(VL,int,P,Q,P *);
1798: void pwrmq(int,MQ,Q,MQ *);
1799: void pwrn(N,int,N *);
1800: void pwrnum(VL,Num,Num,Num *);
1801: void pwrp(VL,P,Q,P *);
1802: void pwrq(Q,Q,Q *);
1803: void pwrr(VL,Obj,Obj,Obj *);
1.19 noro 1804: void pwrquote(VL,QUOTE,QUOTE,QUOTE *);
1.1 noro 1805: void pwrreal(Num,Num,Real *);
1806: void pwrmi(MQ,Q,MQ *);
1807: void pwrlm(LM,Q,LM *);
1808: void pwrum(int,UM,int,UM);
1809: void reallocarray(char **,int *,int *,int);
1810: void reductr(VL,Obj,Obj *);
1811: void reimtocplx(Num,Num,Num *);
1812: void rem2q(Q,Q,Q,Q *);
1813: void rema(VL,P,P,P,P *);
1814: void remq(Q,Q,Q *);
1815: void remsdcp(VL,P,P,P *);
1816: void reordermp(VL,int,VL,P,P *);
1817: void reorderp(VL,VL,P,P *);
1818: void reordvar(VL,V,VL *);
1819: void res_ch_det(VL,V,P,P,P *);
1820: void res_detmp(VL,int,V,P,P,P *);
1821: void restore(VL,P,VN,P *);
1822: void resultmp(VL,int,V,P,P,P *);
1823: void resultp(VL,V,P,P,P *);
1824: void setlum(int,int,LUM);
1825: void sort_by_deg(int,P *,P *);
1826: void sort_by_deg_rev(int,P *,P *);
1827: void sortfs(DCP *);
1828: void sortfsrev(DCP *);
1829: void sortplist(P *,int);
1830: void sortplistbyhomdeg(P *,int);
1831: void sprs(VL,V,P,P,P *);
1832: void sqa(VL,P,P,DCP *);
1833: void sqad(unsigned int,int);
1834: void sqfrp(VL,P,DCP *);
1835: void sqfrum(int,int,P,int *,struct oDUM **,ML *);
1836: void sqfrummain(int,UM,UM,struct oDUM **);
1837: void sqrtn(N,N *);
1838: void srch2(VL,V,P,P,P *);
1839: void srchmp(VL,int,V,P,P,P *);
1840: void srchump(int,P,P,P *);
1841: void srcr(VL,V,P,P,P *);
1842: void strtobf(char *,BF *);
1843: void subalg(Num,Num,Num *);
1844: void subbf(Num,Num,Num *);
1845: void subcplx(Num,Num,Num *);
1846: void subm2p(VL,Q,Q,P,P,P *);
1847: void subm2q(Q,Q,Q,Q,Q *);
1848: void submat(VL,MAT,MAT,MAT *);
1849: void submp(VL,int,P,P,P *);
1850: void submq(int,MQ,MQ,MQ *);
1851: void subnum(VL,Num,Num,Num *);
1852: void subp(VL,P,P,P *);
1853: void subq(Q,Q,Q *);
1854: void subr(VL,Obj,Obj,Obj *);
1855: void subreal(Num,Num,Real *);
1856: void submi(MQ,MQ,MQ *);
1857: void sublm(LM,LM,LM *);
1858: void substmp(VL,int,P,V,P,P *);
1859: void substp(VL,P,V,P,P *);
1860: void substvp(VL,P,VN,P *);
1861: void subum(int,UM,UM,UM);
1862: void subvect(VL,VECT,VECT,VECT *);
1.19 noro 1863: void subquote(VL,QUOTE,QUOTE,QUOTE *);
1.1 noro 1864: void toreim(Num,Num *,Num *);
1865: void ucsump(P,Q *);
1866: void udivpwm(Q,P,P,P *,P *);
1867: void udivpz(P,P,P *,P *);
1868: void udivpzwm(Q,P,P,P *,P *);
1869: void uexgcdnp(VL,P,P *,int,VN,Q,P *,P *,P *,P *,Q *);
1870: void uezgcd1p(P,P,P *);
1871: void uezgcdpp(DCP,P,P *);
1872: void uezgcdpz(VL,P,P,P *);
1873: void ufctr(P,int,DCP *);
1874: void ufctrmain(P,int,DCP *);
1875: void umtomp(V,UM,P *);
1876: void umtop(V,UM,P *);
1877: void usqp(P,DCP *);
1878: void vntovl(VN,int,VL *);
1.29 noro 1879:
1880: void saveerror(FILE *,ERR);
1881: void saveui(FILE *,USINT);
1882: void savedp(FILE *,DP);
1883: void savestring(FILE *,STRING);
1884: void savemat(FILE *,MAT);
1885: void savevect(FILE *,VECT);
1886: void savelist(FILE *,LIST);
1887: void saver(FILE *,R);
1888: void savep(FILE *,P);
1889: void savegf2n(FILE *,GF2N);
1890: void savegfpn(FILE *,GFPN);
1891: void savegfs(FILE *,GFS);
1.54 noro 1892: void savedalg(FILE *,DAlg);
1.29 noro 1893: void savelm(FILE *,LM);
1894: void savemi(FILE *,MQ);
1895: void savecplx(FILE *,C);
1896: void savebf(FILE *,BF);
1897: void savereal(FILE *,Real);
1898: void saveq(FILE *,Q);
1899: void savenum(FILE *,Num);
1900: void savepfins(FILE *,V);
1901: void savegfmmat(FILE *,GFMMAT);
1902: void savebytearray(FILE *,BYTEARRAY);
1903: void savegfsn(FILE *,GFSN);
1904:
1905: void loaderror(FILE *,ERR *);
1906: void loadui(FILE *,USINT *);
1907: void loaddp(FILE *,DP *);
1908: void loadstring(FILE *,STRING *);
1909: void loadmat(FILE *,MAT *);
1910: void loadvect(FILE *,VECT *);
1911: void loadlist(FILE *,LIST *);
1912: void loadr(FILE *,R *);
1913: void loadp(FILE *,P *);
1914: void loadgf2n(FILE *,GF2N *);
1915: void loadgfpn(FILE *,GFPN *);
1916: void loadgfs(FILE *,GFS *);
1917: void loadgfsn(FILE *,GFSN *);
1.54 noro 1918: void loaddalg(FILE *,DAlg *);
1.29 noro 1919: void loadlm(FILE *,LM *);
1920: void loadmi(FILE *,MQ *);
1921: void loadcplx(FILE *,C *);
1922: void loadbf(FILE *,BF *);
1923: void loadreal(FILE *,Real *);
1924: void loadq(FILE *,Q *);
1925: void loadnum(FILE *,Num *);
1926: void loadgfmmat(FILE *,GFMMAT *);
1927: void loadbytearray(FILE *,BYTEARRAY *);
1928: V loadpfins(FILE *);
1929: void eucum2(int mod,UM f1,UM f2,UM a,UM b);
1930: void clearum(UM p,int n);
1931: BM BMALLOC(int dx,int dy);
1932: int isequalum(UM f1,UM f2);
1933: void dec_um(int p,int a,UM u);
1934: void setmod_sf(int p,int n);
1935: int search_defpoly_and_primitive_root(int p,int n,UM dp);
1936: void generate_defpoly_um(int p,int n,UM dp);
1937: int generate_primitive_root_enc(int p,int n,UM dp);
1938: int mulremum_enc(int p,int n,UM dp,int a,int b);
1939: void gfs_galois_action(GFS a,Q e,GFS *c);
1940: void gfs_embed(GFS z,int k,int pm,GFS *c);
1941: void qtogfs(Q a,GFS *c);
1942: void mqtogfs(MQ a,GFS *c);
1943: void gfstomq(GFS a,MQ *c);
1944: void ntogfs(Obj a,GFS *b);
1945: void addgfs(GFS a,GFS b,GFS *c);
1946: void subgfs(GFS a,GFS b,GFS *c);
1947: void mulgfs(GFS a,GFS b,GFS *c);
1948: void divgfs(GFS a,GFS b,GFS *c);
1949: void chsgngfs(GFS a,GFS *c);
1950: void pwrgfs(GFS a,Q b,GFS *c);
1951: int cmpgfs(GFS a,GFS b);
1952: void randomgfs(GFS *r);
1953: int _addsf(int a,int b);
1954: int _chsgnsf(int a);
1955: int _subsf(int a,int b);
1956: int _mulsf(int a,int b);
1957: int _invsf(int a);
1958: int _divsf(int a,int b);
1959: int _pwrsf(int a,int b);
1960: int _onesf();
1961: int _itosf(int n);
1962: int _isonesf(int a);
1963: int _randomsf();
1964: int field_order_sf();
1965: int characteristic_sf();
1966: int extdeg_sf();
1967: void addsfum(UM p1,UM p2,UM pr);
1968: void subsfum(UM p1,UM p2,UM pr);
1969: void gcdsfum(UM p1,UM p2,UM pr);
1970: void mulsfum(UM p1,UM p2,UM pr);
1971: void mulssfum(UM p,int n,UM pr);
1972: void kmulsfum(UM n1,UM n2,UM nr);
1973: void kmulsfummain(UM n1,UM n2,UM nr);
1974: int divsfum(UM p1,UM p2,UM pq);
1975: void diffsfum(UM f,UM fd);
1976: void monicsfum(UM f);
1977: int compsfum(UM a,UM b);
1978: void mulsfbm(BM f1,BM f2,BM fr);
1979: int degbm(BM f);
1980: void addtosfbm(BM f,BM g);
1981: void eucsfum(UM f1,UM f2,UM a,UM b);
1982: void shiftsfum(UM f,int a,UM g);
1983: void shiftsflum(int n,LUM f,int ev);
1984: void shiftsfbm(BM f,int a);
1985: void clearbm(int n,BM f);
1986:
1987: void ksquareum(int mod,UM n1,UM nr);
1988: void extractum(UM n,int index,int len,UM nr);
1989: void copyum(UM n1,UM n2);
1990: void c_copyum(UM n,int len,int *p);
1991: void kmulummain(int mod,UM n1,UM n2,UM nr);
1992: void ksquareummain(int mod,UM n1,UM nr);
1993:
1994: void simp_ff(Obj p,Obj *rp);
1995: void field_order_ff(N *order);
1996:
1997: void random_lm(LM *r);
1998: void ntosparsen(N p,N *bits);
1999: void setmod_lm(N p);
2000: void getmod_lm(N *p);
2001: void simplm(LM n,LM *r);
2002: void qtolm(Q q,LM *l);
2003: void addlm(LM a,LM b,LM *c);
2004: void sublm(LM a,LM b,LM *c);
2005: void mullm(LM a,LM b,LM *c);
2006: void divlm(LM a,LM b,LM *c);
2007: void chsgnlm(LM a,LM *c);
2008: void pwrlm(LM a,Q b,LM *c);
2009: void pwrlm0(N a,N n,N *c);
2010: int cmplm(LM a,LM b);
2011: void remn_special(N,N,int,unsigned int ,N *);;
2012: void gen_simpn(N a,N *b);
2013: void gen_simpn_force(N a,N *b);
2014: void setmod_gfpn(P p);
2015: void getmod_gfpn(UP *up);
2016: void ptogfpn(Obj q,GFPN *l);
2017: void gfpntop(GFPN q,P *l);
2018: void simpgfpn(GFPN n,GFPN *r);
2019: void ntogfpn(Obj a,GFPN *b);
2020: void addgfpn(GFPN a,GFPN b,GFPN *c);
2021: void subgfpn(GFPN a,GFPN b,GFPN *c);
2022: void mulgfpn(GFPN a,GFPN b,GFPN *c);
2023: void squaregfpn(GFPN a,GFPN *c);
2024: void divgfpn(GFPN a,GFPN b,GFPN *c);
2025: void invgfpn(GFPN b,GFPN *c);
2026: void chsgngfpn(GFPN a,GFPN *c);
2027: void pwrgfpn(GFPN a,Q b,GFPN *c);
2028: int cmpgfpn(GFPN a,GFPN b);
2029: void randomgfpn(GFPN *r);
2030: void setmod_gfsn(UM p);
2031: void getmod_gfsn(UM *up);
2032: void simpgfsn(GFSN n,GFSN *r);
2033: void ntogfsn(Obj a,GFSN *b);
2034: void addgfsn(GFSN a,GFSN b,GFSN *c);
2035: void subgfsn(GFSN a,GFSN b,GFSN *c);
2036: void mulgfsn(GFSN a,GFSN b,GFSN *c);
2037: void divgfsn(GFSN a,GFSN b,GFSN *c);
2038: void invgfsn(GFSN b,GFSN *c);
2039: void chsgngfsn(GFSN a,GFSN *c);
2040: void pwrgfsn(GFSN a,Q b,GFSN *c);
2041: int cmpgfsn(GFSN a,GFSN b);
2042: void randomgfsn(GFSN *r);
2043: void setmod_gf2n(P p);
2044: void getmod_gf2n(UP2 *p);
2045: void simpgf2n(GF2N n,GF2N *r);
2046: void ptogf2n(Obj q,GF2N *l);
2047: void gf2ntop(GF2N q,P *l);
2048: void gf2ntovect(GF2N q,VECT *l);
2049: void addgf2n(GF2N a,GF2N b,GF2N *c);
2050: void subgf2n(GF2N a,GF2N b,GF2N *c);
2051: void mulgf2n(GF2N a,GF2N b,GF2N *c);
2052: void squaregf2n(GF2N a,GF2N *c);
2053: void divgf2n(GF2N a,GF2N b,GF2N *c);
2054: void invgf2n(GF2N b,GF2N *c);
2055: void chsgngf2n(GF2N a,GF2N *c);
2056: void pwrgf2n(GF2N a,Q b,GF2N *c);
2057: int cmpgf2n(GF2N a,GF2N b);
2058: void randomgf2n(GF2N *r);
2059: void binaryton(char *binary,N *np);
2060: void hexton(char *hex,N *np);
2061: void ntobn(int base,N n,N *nrp);
2062: void bnton(int base,N n,N *nrp);
2063: void ptomp(int m,P p,P *pr);
2064: void mptop(P f,P *gp);
2065: void ptosfp(P p,P *pr);
2066: void sfptop(P f,P *gp);
2067: void sf_galois_action(P p,Q e,P *pr);
2068: void sf_embed(P p,int k,int pm,P *pr);
2069: void ptolmp(P p,P *pr);
2070: void lmptop(P f,P *gp);
2071: void ptoum(int m,P f,UM wf);
2072: void umtop(V v,UM w,P *f);
2073: void ptosfum(P f,UM wf);
2074: void sfumtop(V v,UM w,P *f);
2075: void ptoup(P n,UP *nr);
2076: void uptop(UP n,P *nr);
2077: void ulmptoum(int m,UP f,UM wf);
2078: void objtobobj(int base,Obj p,Obj *rp);
2079: void bobjtoobj(int base,Obj p,Obj *rp);
2080: void numtobnum(int base,Num p,Num *rp);
2081: void bnumtonum(int base,Num p,Num *rp);
2082: void ptobp(int base,P p,P *rp);
2083: void bptop(int base,P p,P *rp);
2084: void listtoblist(int base,LIST p,LIST *rp);
2085: void blisttolist(int base,LIST p,LIST *rp);
2086: void vecttobvect(int base,VECT p,VECT *rp);
2087: void bvecttovect(int base,VECT p,VECT *rp);
2088: void mattobmat(int base,MAT p,MAT *rp);
2089: void bmattomat(int base,MAT p,MAT *rp);
2090: void n32ton27(N g,N *rp);
2091: void n27ton32(N a,N *rp);
2092: void mptoum(P p,UM pr);
2093: void umtomp(V v,UM p,P *pr);
2094: void enc_to_p(int p,int a,V v,P *pr);
2095: int comp_dum(DUM a,DUM b);
2096: void fctrsf(P p,DCP *dcp);
2097: void gensqfrsfum(UM p,struct oDUM *dc);
2098: void randsfum(int d,UM p);
2099: void pwrmodsfum(UM p,int e,UM f,UM pr);
2100: void spwrsfum(UM m,UM f,N e,UM r);
2101: void tracemodsfum(UM m,UM f,int e,UM r);
2102: void make_qmatsf(UM p,UM *tab,int ***mp);
2103: void nullsf(int **mat,int n,int *ind);
2104: void null_to_solsf(int **mat,int *ind,int n,UM *r);
2105: void czsfum(UM f,UM *r);
2106: int berlekampsf(UM p,int df,UM *tab,UM *r);
2107: void minipolysf(UM f,UM p,UM mp);
2108: int find_rootsf(UM p,int *root);
2109: void canzassf(UM f,int d,UM *r);
1.34 noro 2110: void sfhensel(int count,P f,V x,V y,int degbound,GFS *evp,P *sfp,ML *listp);
2111: int sfberle(V x,V y,P f,int count,GFS *ev,DCP *dcp);
1.29 noro 2112: void sfgcdgen(P f,ML blist,ML *clistp);
2113: void sfhenmain2(BM f,UM g0,UM h0,int dy,BM *gp);
2114: void ptosfbm(int dy,P f,BM fl);
2115: void sfbmtop(BM f,V x,V y,P *fp);
2116: void sfsqfr(P f,DCP *dcp);
2117: void sfusqfr(P f,DCP *dcp);
2118: void sfbsqfr(P f,V x,V y,DCP *dcp);
1.30 noro 2119: void sfbfctr(P f,V x,V y,int degbound,DCP *dcp);
1.29 noro 2120: void sfdtest(P f,ML list,V x,V y,DCP *dcp);
2121: int sfdtestmain(VL vl,P lcg,UM lcg0,BM lcy,P csum,ML list,
2122: int k,int *in,P *fp,P *cofp);
2123: void const_term(P f,UM c);
2124: void const_term_sfbm(BM f,UM c);
2125: int sfctest(UM lcg0,BM lcy,ML list,int k,int *in);
2126: void mulsfbmarray(int dx,BM lcy,ML list,int k,int *in,V x,V y,P *g);
2127: void sfcsump(VL vl,P f,P *s);
2128: void cont_pp_sfp(VL vl,P f,P *cp,P *fp);
2129: int divtp_by_sfbm(VL vl,P f,P g,P *qp);
2130: void generate_defpoly_sfum(int n,UM *dp);
2131: NODE symb_merge(NODE,NODE,int);
2132: void _free_private_storage();
2133: void _DL_alloc();
2134: void _MP_alloc();
2135: void _DP_alloc();
2136: void _addmd_destructive(int mod,DP p1,DP p2,DP *pr);
2137: void _mulmd_dup(int mod,DP p1,DP p2,DP *pr);
2138: void _comm_mulmd_dup(int mod,DP p1,DP p2,DP *pr);
2139: void _weyl_mulmd_dup(int mod,DP p1,DP p2,DP *pr);
2140: void _mulmdm_dup(int mod,DP p,MP m0,DP *pr);
2141: void _weyl_mulmdm_dup(int mod,MP m0,DP p,DP *pr);
2142: void _weyl_mulmmm_dup(int mod,MP m0,MP m1,int n,struct cdlm *rtab,int rtablen);
2143: void _comm_mulmd_tab(int mod,int nv,struct cdlm *t,int n,struct cdlm *t1,int n1,struct cdlm *rt);
2144: void _comm_mulmd_tab_destructive(int mod,int nv,struct cdlm *t,int n,struct cdlm *t1,int n1);
2145: void dlto_dl(DL d,DL *dr);
2146: void _dltodl(DL d,DL *dr);
2147: void _adddl_dup(int n,DL d1,DL d2,DL *dr);
2148: void _free_dlarray(DL *a,int n);
2149: void _free_dp(DP f);
2150: void dpto_dp(DP p,DP *r);
2151: void _dptodp(DP p,DP *r);
2152: NODE _symb_merge(NODE m1,NODE m2,int n);
2153: void _addd_destructive(VL vl,DP p1,DP p2,DP *pr);
2154: void _muld_dup(VL vl,DP p1,DP p2,DP *pr);
2155: void _comm_muld_dup(VL vl,DP p1,DP p2,DP *pr);
2156: void _weyl_muld_dup(VL vl,DP p1,DP p2,DP *pr);
2157: void _muldm_dup(VL vl,DP p,MP m0,DP *pr);
2158: void _weyl_muldm_dup(VL vl,MP m0,DP p,DP *pr);
2159: void _weyl_mulmm_dup(VL vl,MP m0,MP m1,int n,struct cdl *rtab,int rtablen);
2160: void _comm_muld_tab(VL vl,int nv,struct cdl *t,int n,struct cdl *t1,int n1,struct cdl *rt);
2161: void _comm_muld_tab_destructive(VL vl,int nv,struct cdl *t,int n,struct cdl *t1,int n1);
2162:
2163: int has_fcoef(DP f);
2164: int has_fcoef_p(P f);
2165: void initd(struct order_spec *spec);
2166: void ptod(VL vl,VL dvl,P p,DP *pr);
2167: void dtop(VL vl,VL dvl,DP p,P *pr);
2168: void nodetod(NODE node,DP *dp);
2169: int sugard(MP m);
2170: void addd(VL vl,DP p1,DP p2,DP *pr);
2171: void symb_addd(DP p1,DP p2,DP *pr);
2172: NODE symb_merge(NODE m1,NODE m2,int n);
2173: DLBUCKET symb_merge_bucket(DLBUCKET m1,DLBUCKET m2,int n);
2174: void subd(VL vl,DP p1,DP p2,DP *pr);
2175: void chsgnd(DP p,DP *pr);
2176: void muld(VL vl,DP p1,DP p2,DP *pr);
2177: void comm_muld(VL vl,DP p1,DP p2,DP *pr);
2178: void muldm(VL vl,DP p,MP m0,DP *pr);
2179: void weyl_muld(VL vl,DP p1,DP p2,DP *pr);
2180: void weyl_muldm(VL vl,MP m0,DP p,DP *pr);
2181: void weyl_mulmm(VL vl,MP m0,MP m1,int n,struct cdl *rtab,int rtablen);
2182: void comm_muld_tab(VL vl,int nv,struct cdl *t,int n,struct cdl *t1,int n1,struct cdl *rt);
2183: void muldc(VL vl,DP p,P c,DP *pr);
2184: void divsdc(VL vl,DP p,P c,DP *pr);
2185: void adddl(int n,DL d1,DL d2,DL *dr);
2186: void adddl_destructive(int n,DL d1,DL d2);
2187: int compd(VL vl,DP p1,DP p2);
2188: int cmpdl_lex(int n,DL d1,DL d2);
2189: int cmpdl_revlex(int n,DL d1,DL d2);
2190: int cmpdl_gradlex(int n,DL d1,DL d2);
2191: int cmpdl_revgradlex(int n,DL d1,DL d2);
2192: int cmpdl_blex(int n,DL d1,DL d2);
2193: int cmpdl_bgradlex(int n,DL d1,DL d2);
2194: int cmpdl_brevgradlex(int n,DL d1,DL d2);
2195: int cmpdl_brevrev(int n,DL d1,DL d2);
2196: int cmpdl_bgradrev(int n,DL d1,DL d2);
2197: int cmpdl_blexrev(int n,DL d1,DL d2);
2198: int cmpdl_elim(int n,DL d1,DL d2);
2199: int cmpdl_weyl_elim(int n,DL d1,DL d2);
2200: int cmpdl_homo_ww_drl(int n,DL d1,DL d2);
2201: int cmpdl_order_pair(int n,DL d1,DL d2);
2202: int cmpdl_matrix(int n,DL d1,DL d2);
2203: void ptomd(VL vl,int mod,VL dvl,P p,DP *pr);
2204: void mptomd(VL vl,int mod,VL dvl,P p,DP *pr);
2205: void mdtop(VL vl,int mod,VL dvl,DP p,P *pr);
2206: void addmd(VL vl,int mod,DP p1,DP p2,DP *pr);
2207: void submd(VL vl,int mod,DP p1,DP p2,DP *pr);
2208: void chsgnmd(int mod,DP p,DP *pr);
2209: void mulmd(VL vl,int mod,DP p1,DP p2,DP *pr);
2210: void comm_mulmd(VL vl,int mod,DP p1,DP p2,DP *pr);
2211: void weyl_mulmd(VL vl,int mod,DP p1,DP p2,DP *pr);
2212: void mulmdm(VL vl,int mod,DP p,MP m0,DP *pr);
2213: void weyl_mulmdm(VL vl,int mod,DP p,MP m0,DP *pr);
2214: void weyl_mulmmm(VL vl,int mod,MP m0,MP m1,int n,DP *pr);
2215: void mulmdc(VL vl,int mod,DP p,P c,DP *pr);
2216: void divsmdc(VL vl,int mod,DP p,P c,DP *pr);
2217: void _dtop_mod(VL vl,VL dvl,DP p,P *pr);
2218: void _dp_mod(DP p,int mod,NODE subst,DP *rp);
2219: void _dp_monic(DP p,int mod,DP *rp);
2220: void _printdp(DP d);
2221: void addmd_destructive(int mod,DP p1,DP p2,DP *pr);
2222: void mulmd_dup(int mod,DP p1,DP p2,DP *pr);
2223: void comm_mulmd_dup(int mod,DP p1,DP p2,DP *pr);
2224: void weyl_mulmd_dup(int mod,DP p1,DP p2,DP *pr);
2225: void mulmdm_dup(int mod,DP p,MP m0,DP *pr);
2226: void weyl_mulmdm_dup(int mod,MP m0,DP p,DP *pr);
2227: void weyl_mulmmm_dup(int mod,MP m0,MP m1,int n,struct cdlm *rtab,int rtablen);
2228: void comm_mulmd_tab_destructive(int mod,int nv,struct cdlm *t,int n,struct cdlm *t1,int n1);
2229: void adddl_dup(int n,DL d1,DL d2,DL *dr);
2230: void monicup(UP a,UP *b);
2231: void simpup(UP a,UP *b);
2232: void simpnum(Num a,Num *b);
2233: void uremp(P p1,P p2,P *rp);
2234: void ugcdp(P p1,P p2,P *rp);
2235: void reversep(P p1,Q d,P *rp);
2236: void invmodp(P p1,Q d,P *rp);
2237: void addup(UP n1,UP n2,UP *nr);
2238: void subup(UP n1,UP n2,UP *nr);
2239: void chsgnup(UP n1,UP *nr);
2240: void hybrid_mulup(int ff,UP n1,UP n2,UP *nr);
2241: void hybrid_squareup(int ff,UP n1,UP *nr);
2242: void hybrid_tmulup(int ff,UP n1,UP n2,int d,UP *nr);
2243: void mulup(UP n1,UP n2,UP *nr);
2244: void mulcup(Num c,UP n1,UP *nr);
2245: void tmulup(UP n1,UP n2,int d,UP *nr);
2246: void squareup(UP n1,UP *nr);
2247: void remup(UP n1,UP n2,UP *nr);
2248: void remup_destructive(UP n1,UP n2);
2249: void qrup(UP n1,UP n2,UP *nq,UP *nr);
2250: void qrup_destructive(UP n1,UP n2);
2251: void gcdup(UP n1,UP n2,UP *nr);
2252: void extended_gcdup(UP a,UP m,UP *r);
2253: void reverseup(UP n1,int d,UP *nr);
2254: void invmodup(UP n1,int d,UP *nr);
2255: void pwrup(UP n,Q e,UP *nr);
2256: int compup(UP n1,UP n2);
2257: void kmulp(VL vl,P n1,P n2,P *nr);
2258: void ksquarep(VL vl,P n1,P *nr);
2259: void kmulup(UP n1,UP n2,UP *nr);
2260: void ksquareup(UP n1,UP *nr);
2261: void copyup(UP n1,UP n2);
2262: void c_copyup(UP n,int len,pointer *p);
2263: void kmulupmain(UP n1,UP n2,UP *nr);
2264: void ksquareupmain(UP n1,UP *nr);
2265: void rembymulup(UP n1,UP n2,UP *nr);
2266: void hybrid_rembymulup_special(int ff,UP n1,UP n2,UP inv2,UP *nr);
2267: void rembymulup_special(UP n1,UP n2,UP inv2,UP *nr);
2268: void tkmulup(UP n1,UP n2,int d,UP *nr);
2269: void shiftup(UP n,int d,UP *nr);
2270: void fft_rembymulup_special(UP n1,UP n2,UP inv2,UP *nr);
2271: void set_degreeup(UP n,int d);
2272: void decompup(UP n,int d,UP *n0,UP *n1);
2273: void truncup(UP n1,int d,UP *nr);
2274: int int_bits(int t);
2275: int maxblenup(UP n);
2276: void uptofmarray(int mod,UP n,ModNum *f);
2277: void fmarraytoup(ModNum *f,int d,UP *nr);
2278: void uiarraytoup(unsigned int **f,int n,int d,UP *nr);
2279: void adj_coefup(UP n,N m,N m2,UP *nr);
2280: void remcup(UP n,N mod,UP *nr);
2281: void fft_mulup(UP n1,UP n2,UP *nr);
2282: void trunc_fft_mulup(UP n1,UP n2,int dbd,UP *nr);
2283: void fft_squareup(UP n1,UP *nr);
2284: void fft_mulup_main(UP n1,UP n2,int dbd,UP *nr);
2285: void crup(ModNum **f,int d,int *mod,int index,N m,UP *r);
2286: void fft_mulup_specialmod_main(UP n1,UP n2,int dbd,int *modind,int nmod,UP *nr);
2287: void divn(N n1,N n2,N *nq,N *nr);
2288: void divsn(N n1,N n2,N *nq);
2289: void remn(N n1,N n2,N *nr);
2290: void remn_special(N a,N d,int bits,unsigned int lower,N *b);
2291: void mulin(N n,unsigned int d,unsigned int *p);
2292: unsigned int divin(N n,unsigned int dvr,N *q);
2293: void bprintn(N n);
2294: void bxprintn(N n);
2295: void muln(N n1,N n2,N *nr);
2296: void _muln(N n1,N n2,N nr);
2297: void muln_1(unsigned int *p,int s,unsigned int d,unsigned int *r);
2298: void divnmain(int d1,int d2,unsigned int *m1,unsigned int *m2,unsigned int *q);
2299: void divnmain_special(int d1,int d2,unsigned int *m1,unsigned int *m2,unsigned int *q);
2300: unsigned int divn_1(unsigned int *p,int s,unsigned int d,unsigned int *r);
2301: void addn(N n1,N n2,N *nr);
2302: int subn(N n1,N n2,N *nr);
2303: void _addn(N n1,N n2,N nr);
2304: int _subn(N n1,N n2,N nr);
2305: void addarray_to(unsigned int *a1,int n1,unsigned int *a2,int n2);
2306: void pwrn(N n,int e,N *nr);
2307: void gcdn(N n1,N n2,N *nr);
2308: void gcdEuclidn(N n1,N n2,N *nr);
2309: int cmpn(N n1,N n2);
2310: void bshiftn(N n,int b,N *r);
2311: void shiftn(N n,int w,N *r);
2312: void randomn(int bits,N *r);
2313: void freen(N n);
2314: int n_bits(N n);
2315: void fft_mulup_lm(UP n1,UP n2,UP *nr);
2316: void fft_squareup_lm(UP n1,UP *nr);
2317: void trunc_fft_mulup_lm(UP n1,UP n2,int dbd,UP *nr);
2318: void crup_lm(ModNum **f,int d,int *mod,int index,N m,N lm_mod,UP *r);
2319: void fft_rembymulup_special_lm(UP n1,UP n2,UP inv2,UP *nr);
2320: void uptolmup(UP n,UP *nr);
2321: void save_up(UP obj,char *name);
2322: void hybrid_powermodup(UP f,UP *xp);
2323: void powermodup(UP f,UP *xp);
2324: void hybrid_generic_powermodup(UP g,UP f,Q d,UP *xp);
2325: void generic_powermodup(UP g,UP f,Q d,UP *xp);
2326: void hybrid_powertabup(UP f,UP xp,UP *tab);
2327: void powertabup(UP f,UP xp,UP *tab);
2328: void squarep_gf2n(VL vl,P n1,P *nr);
2329: void squareup_gf2n(UP n1,UP *nr);
2330: void powermodup_gf2n(UP f,UP *xp);
2331: void generic_powermodup_gf2n(UP g,UP f,Q d,UP *xp);
2332: void tracemodup_gf2n(UP g,UP f,Q d,UP *xp);
2333: void tracemodup_gf2n_slow(UP g,UP f,Q d,UP *xp);
2334: void tracemodup_gf2n_tab(UP g,UP f,Q d,UP *xp);
2335: void square_rem_tab_up_gf2n(UP f,UP *tab,UP *rp);
2336: void powertabup_gf2n(UP f,UP xp,UP *tab);
2337: void find_root_gf2n(UP f,GF2N *r);
2338: void ptoup2(P n,UP2 *nr);
2339: void ptoup2_sparse(P n,UP2 *nr);
2340: void up2top(UP2 n,P *nr);
2341: void up2tovect(UP2 n,VECT *nr);
2342: void up2ton(UP2 p,Q *n);
2343: void ntoup2(Q n,UP2 *p);
2344: void gen_simpup2(UP2 p,GEN_UP2 m,UP2 *r);
2345: void gen_simpup2_destructive(UP2 p,GEN_UP2 m);
2346: void gen_invup2(UP2 p,GEN_UP2 m,UP2 *r);
2347: void gen_pwrmodup2(UP2 a,Q b,GEN_UP2 m,UP2 *c);
2348: void simpup2(UP2 p,UP2 m,UP2 *r);
2349: int degup2(UP2 a);
2350: int degup2_sparse(UP2 a);
2351: int degup2_1(unsigned int a);
2352: void addup2(UP2 a,UP2 b,UP2 *c);
2353: void subup2(UP2 a,UP2 b,UP2 *c);
2354: void _mulup2_1(UP2 a,unsigned int b,UP2 c);
2355: void _mulup2_h(UP2 a,unsigned int b,UP2 c);
2356: void mulup2(UP2 a,UP2 b,UP2 *c);
2357: void _kmulup2_(unsigned int *a,unsigned int *b,int w,unsigned int *c);
2358: void _mulup2_nn(unsigned int *a,unsigned int *b,int w,unsigned int *c);
2359: void _mulup2(UP2 a,UP2 b,UP2 c);
2360: void _mulup2_(_UP2 a,_UP2 b,_UP2 c);
2361: void squareup2(UP2 n,UP2 *nr);
2362: void _squareup2(UP2 n,UP2 nr);
2363: void _adjup2(UP2 n);
2364: void _adjup2_(_UP2 n);
2365: void _addup2(UP2 a,UP2 b,UP2 c);
2366: void _addup2_destructive(UP2 a,UP2 b);
2367: void _addup2_(_UP2 a,_UP2 b,_UP2 c);
2368: void _addtoup2_(_UP2 a,_UP2 b);
2369: unsigned int mulup2_bb(unsigned int a,unsigned int b);
2370: void init_up2_tab();
2371: void divup2_1(unsigned int a1,unsigned int a2,int e1,int e2,unsigned int *qp,unsigned int *rp);
2372: void qrup2(UP2 a,UP2 b,UP2 *q,UP2 *r);
2373: void _qrup2(UP2 a,UP2 b,UP2 q,UP2 r);
2374: void remup2(UP2 a,UP2 b,UP2 *c);
2375: void _remup2(UP2 a,UP2 b,UP2 c);
2376: void remup2_sparse(UP2 a,UP2 b,UP2 *c);
2377: void remup2_sparse_destructive(UP2 a,UP2 b);
2378: void remup2_type1_destructive(UP2 a,int d);
2379: void remup2_3_destructive(UP2 a,UP2 b);
2380: void remup2_5_destructive(UP2 a,UP2 b);
2381: void _invup2_1(unsigned int f1,unsigned int f2,unsigned int *a1,unsigned int *b1);
2382: void _gcdup2_1(unsigned int f1,unsigned int f2,unsigned int *gcd);
2383: void up2_init_eg();
2384: void up2_show_eg();
2385: void invup2(UP2 a,UP2 m,UP2 *inv);
2386: void gcdup2(UP2 a,UP2 m,UP2 *gcd);
2387: void chsgnup2(UP2 a,UP2 *c);
2388: void pwrmodup2(UP2 a,Q b,UP2 m,UP2 *c);
2389: void pwrmodup2_sparse(UP2 a,Q b,UP2 m,UP2 *c);
2390: int compup2(UP2 n1,UP2 n2);
2391: void _copyup2(UP2 n,UP2 r);
2392: void _bshiftup2(UP2 n,int b,UP2 r);
2393: void _bshiftup2_destructive(UP2 n,int b);
2394: void diffup2(UP2 f,UP2 *r);
2395: int sqfrcheckup2(UP2 f);
2396: int irredcheckup2(UP2 f);
2397: int irredcheck_dddup2(UP2 f);
2398: void _copy_up2bits(UP2 p,unsigned int **mat,int pos);
2399: int compute_multiplication_matrix(P p0,GF2MAT *mp);
2400: void compute_change_of_basis_matrix(P p0,P p1,int to,GF2MAT *m01,GF2MAT *m10);
2401: void compute_change_of_basis_matrix_with_root(P p0,P p1,int to,GF2N root,GF2MAT *m01,GF2MAT *m10);
2402: int compute_representation_conversion_matrix(P p0,GF2MAT *np,GF2MAT *pn);
2403: void mul_nb(GF2MAT mat,unsigned int *a,unsigned int *b,unsigned int *c);
2404: void leftshift(unsigned int *a,int n);
2405: void mat_to_gf2mat(MAT a,unsigned int ***b);
2406: void gf2mat_to_mat(unsigned int **a,int n,MAT *b);
2407: void mulgf2mat(int n,unsigned int **a,unsigned int **b,unsigned int **c);
2408: void mulgf2vectmat(int n,unsigned int *a,unsigned int **b,unsigned int *c);
2409: int mulgf2vectvect(int n,unsigned int *a,unsigned int *b);
2410: int invgf2mat(int n,unsigned int **a,unsigned int **b);
2411: void _mulup2_22(unsigned int *a1,unsigned int *a2,unsigned int *ar);
2412: void _mulup2_33(unsigned int *a1,unsigned int *a2,unsigned int *ar);
2413: void _mulup2_44(unsigned int *a1,unsigned int *a2,unsigned int *ar);
2414: void _mulup2_55(unsigned int *a1,unsigned int *a2,unsigned int *ar);
2415: void _mulup2_66(unsigned int *a1,unsigned int *a2,unsigned int *ar);
2416: void type1_bin_invup2(UP2 a,int n,UP2 *inv);
2417: UP2 *compute_tab_gf2n(UP2 f);
2418: UP compute_trace_gf2n(UP2 *tab,GF2N c,int n);
2419: void up2toup(UP2 f,UP *r);
2420: void find_root_up2(UP2 f,GF2N *r);
2421: void addq(Q n1,Q n2,Q *nr);
2422: void subq(Q n1,Q n2,Q *nr);
2423: void mulq(Q n1,Q n2,Q *nr);
2424: void divq(Q n1,Q n2,Q *nq);
2425: void divsq(Q n1,Q n2,Q *nq);
2426: void invq(Q n,Q *nr);
2427: void chsgnq(Q n,Q *nr);
2428: void pwrq(Q n1,Q n,Q *nr);
2429: int cmpq(Q q1,Q q2);
2430: void remq(Q n,Q m,Q *nr);
2431: void mkbc(int n,Q *t);
2432: void mkwc(int k,int l,Q *t);
2433: void mkwcm(int k,int l,int m,int *t);
2434: void factorial(int n,Q *r);
2435: void invl(Q a,Q mod,Q *ar);
2436: void kmuln(N n1,N n2,N *nr);
2437: void extractn(N n,int index,int len,N *nr);
2438: void copyn(N n,int len,int *p);
2439: void dupn(N n,N p);
2440: void kmulnmain(N n1,N n2,N *nr);
2441: void plisttop(P *f,V v,int n,P *gp);
2442: int divtp(VL vl,P p1,P p2,P *q);
2443: int divtdcp(VL vl,P p1,P p2,P *q);
2444: int divtpz(VL vl,P p1,P p2,P *q);
2445: int divtdcpz(VL vl,P p1,P p2,P *q);
2446: void udivpz(P f1,P f2,P *fqp,P *frp);
2447: void udivpwm(Q mod,P p1,P p2,P *q,P *r);
2448: void udivpzwm(Q mod,P f1,P f2,P *fqp,P *frp);
2449: void henmv(VL vl,VN vn,P f,P g0,P h0,P a0,P b0,P lg,P lh,P lg0,P lh0,Q q,int k,P *gp,P *hp);
2450: void henmvmain(VL vl,VN vn,P f,P fi0,P fi1,P gi0,P gi1,P l0,P l1,Q mod,Q mod2,int k,P *fr0,P *fr1);
2451: void henzq(P f,P i0,UM fi0,P i1,UM fi1,int p,int k,P *fr0p,P *fr1p,P *gr0p,P *gr1p,Q *qrp);
2452: void henzq1(P g,P h,Q bound,P *gcp,P *hcp,Q *qp);
2453: void addm2p(VL vl,Q mod,Q mod2,P n1,P n2,P *nr);
2454: void subm2p(VL vl,Q mod,Q mod2,P n1,P n2,P *nr);
2455: void mulm2p(VL vl,Q mod,Q mod2,P n1,P n2,P *nr);
2456: void cmp(Q mod,P p,P *pr);
2457: void cm2p(Q mod,Q m,P p,P *pr);
2458: void addm2q(Q mod,Q mod2,Q n1,Q n2,Q *nr);
2459: void subm2q(Q mod,Q mod2,Q n1,Q n2,Q *nr);
2460: void mulm2q(Q mod,Q mod2,Q n1,Q n2,Q *nr);
2461: void rem2q(Q n,Q m,Q m2,Q *nr);
2462: void exthpc_generic(VL vl,P p,int d,V v,P *pr);
2463: void exthp(VL vl,P p,int d,P *pr);
2464: void exthpc(VL vl,V v,P p,int d,P *pr);
2465: void cbound(VL vl,P p,Q *b);
2466: int geldb(VL vl,P p);
2467: int getdeg(V v,P p);
2468: void cmax(P p,Q *b);
2469: int nextbin(VN vn,int n);
2470: void mulsgn(VN vn,VN vnt,int n,VN vn1);
2471: void next(VN vn);
2472: void clctv(VL vl,P p,VL *nvlp);
2473: void markv(VN vn,int n,P p);
2474: void vntovl(VN vn,int n,VL *vlp);
2475: int dbound(V v,P f);
2476: int homdeg(P f);
2477: int minhomdeg(P f);
2478: void adjc(VL vl,P f,P a,P lc0,Q q,P *fr,P *ar);
2479: void affinemain(VL vl,P p,V v0,int n,P *pl,P *pr);
2480: void restore(VL vl,P f,VN vn,P *fr);
2481: void mergev(VL vl,VL vl1,VL vl2,VL *nvlp);
2482: void substvp(VL vl,P f,VN vn,P *g);
2483: void affine(VL vl,P f,VN vn,P *fr);
2484: void addnum(VL vl,Num a,Num b,Num *c);
2485: void subnum(VL vl,Num a,Num b,Num *c);
2486: void mulnum(VL vl,Num a,Num b,Num *c);
2487: void divnum(VL vl,Num a,Num b,Num *c);
2488: void pwrnum(VL vl,Num a,Num b,Num *c);
2489: void chsgnnum(Num a,Num *c);
2490: int compnum(VL vl,Num a,Num b);
2491: void one_ff(Num *c);
2492: int negative_number(Num c);
2493: void simp_ff(Obj p,Obj *rp);
2494: void field_order_ff(N *order);
2495: int fft_available(int d1,int n1,int d2,int n2);
2496: void get_fft_prime(int index,int *p,int *d);
2497: void nglob_init();
2498: void get_eg(struct oEGT *p);
2499: void init_eg(struct oEGT *eg);
2500: void add_eg(struct oEGT *base,struct oEGT *start,struct oEGT *end);
2501: void print_eg(char *item,struct oEGT *eg);
2502: void print_split_eg(struct oEGT *start,struct oEGT *end);
2503: void print_split_e(struct oEGT *start,struct oEGT *end);
2504: void suspend_timer() ;
2505: void resume_timer() ;
2506: void reset_engine() ;
2507: unsigned int get_asir_version() ;
2508: char *get_asir_distribution();
1.63 noro 2509: void create_error(ERR *err,unsigned int serial,char *msg,LIST trace);
1.29 noro 2510: void init_lprime();
2511: int get_lprime(int index);
2512: void create_new_lprimes(int index);
2513: void reorderp(VL nvl,VL ovl,P p,P *pr);
2514: void substp(VL vl,P p,V v0,P p0,P *pr);
2515: void detp(VL vl,P **rmat,int n,P *dp);
2516: void invmatp(VL vl,P **rmat,int n,P ***imatp,P *dnp);
2517: void reordvar(VL vl,V v,VL *nvlp);
2518: void gcdprsp(VL vl,P p1,P p2,P *pr);
2519: void gcdcp(VL vl,P p,P *pr);
2520: void sprs(VL vl,V v,P p1,P p2,P *pr);
2521: void resultp(VL vl,V v,P p1,P p2,P *pr);
2522: void srch2(VL vl,V v,P p1,P p2,P *pr);
2523: void srcr(VL vl,V v,P p1,P p2,P *pr);
2524: void res_ch_det(VL vl,V v,P p1,P p2,P *pr);
2525: void res_detmp(VL vl,int mod,V v,P p1,P p2,P *dp);
2526: void premp(VL vl,P p1,P p2,P *pr);
2527: void ptozp0(P p,P *pr);
2528: void mindegp(VL vl,P p,VL *mvlp,P *pr);
2529: void maxdegp(VL vl,P p,VL *mvlp,P *pr);
2530: void min_common_vars_in_coefp(VL vl,P p,VL *mvlp,P *pr);
2531: void minlcdegp(VL vl,P p,VL *mvlp,P *pr);
2532: void sort_by_deg(int n,P *p,P *pr);
2533: void sort_by_deg_rev(int n,P *p,P *pr);
2534: void getmindeg(V v,P p,Q *dp);
2535: void minchdegp(VL vl,P p,VL *mvlp,P *pr);
2536: int getchomdeg(V v,P p);
2537: int getlchomdeg(V v,P p,int *d);
2538: int nmonop(P p);
2539: int qpcheck(Obj p);
2540: int uzpcheck(Obj p);
2541: int p_mag(P p);
2542: int maxblenp(P p);
2543: void berle(int index,int count,P f,ML *listp);
2544: int berlecnt(int mod,UM f);
2545: int berlecntmain(int mod,int n,int m,int **c);
2546: UM *berlemain(int mod,UM f,UM *fp);
2547: void hensel(int index,int count,P f,ML *listp);
2548: void hensel2(int index,int count,P f,ML *listp);
2549: void henmain2(LUM f,UM g0,UM h0,UM a0,UM b0,int m,int bound,LUM *gp);
2550: void clearlum(int n,int bound,LUM f);
2551: void addtolum(int m,int bound,LUM f,LUM g);
2552: void hsq(int index,int count,P f,int *nindex,DCP *dcp);
2553: void gcdgen(P f,ML blist,ML *clistp);
2554: void henprep2(int mod,int q,int k,UM f,UM g,UM h,UM qg,UM qh,UM qa,UM qb);
2555: void henprep(P f,ML blist,ML clist,ML *bqlistp,ML *cqlistp);
2556: void henmain(LUM f,ML bqlist,ML cqlist,ML *listp);
2557: int mignotte(int q,P f);
2558: int mig(int q,int d,P f);
2559: void sqad(unsigned int man,int exp);
2560: void ptolum(int q,int bound,P f,LUM fl);
2561: void modfctrp(P p,int mod,int flag,DCP *dcp);
2562: void gensqfrum(int mod,UM p,struct oDUM *dc);
2563: void ddd(int mod,UM f,UM *r);
2564: void canzas(int mod,UM f,int d,UM *base,UM *r);
2565: void randum(int mod,int d,UM p);
2566: void pwrmodum(int mod,UM p,int e,UM f,UM pr);
2567: void spwrum(int mod,UM m,UM *base,UM f,N e,UM r);
2568: void spwrum0(int mod,UM m,UM f,N e,UM r);
2569: void mult_mod_tab(UM p,int mod,UM *tab,UM r,int d);
2570: void make_qmat(UM p,int mod,UM *tab,int ***mp);
2571: void null_mod(int **mat,int mod,int n,int *ind);
2572: void null_to_sol(int **mat,int *ind,int mod,int n,UM *r);
2573: void newddd(int mod,UM f,UM *r);
2574: int nfctr_mod(UM f,int mod);
2575: int irred_check(UM f,int mod);
2576: int berlekamp(UM p,int mod,int df,UM *tab,UM *r);
2577: void minipoly_mod(int mod,UM f,UM p,UM mp);
2578: void lnf_mod(int mod,int n,UM p0,UM p1,struct p_pair *list,UM np0,UM np1);
2579: void showum(UM p);
2580: void showumat(int **mat,int n);
2581: int find_root(int mod,UM p,int *root);
2582: void fctrp(VL vl,P f,DCP *dcp);
2583: void fctr_wrt_v_p(VL vl,P f,V v,DCP *dcp);
2584: void homfctr(VL vl,P g,DCP *dcp);
2585: void mfctr(VL vl,P f,DCP *dcp);
2586: void mfctr_wrt_v(VL vl,P f,V v,DCP *dcp);
2587: void adjsgn(P p,DCP dc);
2588: int headsgn(P p);
2589: void fctrwithmvp(VL vl,P f,V v,DCP *dcp);
2590: void mfctrwithmv(VL vl,P f,V v,DCP *dcp);
2591: void ufctr(P f,int hint,DCP *dcp);
2592: void mfctrmain(VL vl,P p,DCP *dcp);
2593: void ufctrmain(P p,int hint,DCP *dcp);
2594: void cycm(V v,int n,DCP *dcp);
2595: void cycp(V v,int n,DCP *dcp);
2596: void calcphi(V v,int n,struct oMF *mfp);
2597: void mkssum(V v,int e,int s,int sgn,P *r);
2598: int iscycp(P f);
2599: int iscycm(P f);
2600: void sortfs(DCP *dcp);
2601: void sortfsrev(DCP *dcp);
2602: void nthrootchk(P f,struct oDUM *dc,ML fp,DCP *dcp);
2603: void sqfrp(VL vl,P f,DCP *dcp);
2604: void msqfr(VL vl,P f,DCP *dcp);
2605: void usqp(P f,DCP *dcp);
2606: void msqfrmain(VL vl,P p,DCP *dcp);
2607: void msqfrmainmain(VL vl,P p,VN vn,P p0,DCP dc0,DCP *dcp,P *pp);
2608: void mfctrhen2(VL vl,VN vn,P f,P f0,P g0,P h0,P lcg,P lch,P *gp);
2609: int sqfrchk(P p);
2610: int cycchk(P p);
2611: int zerovpchk(VL vl,P p,VN vn);
2612: int valideval(VL vl,DCP dc,VN vn);
2613: void estimatelc(VL vl,Q c,DCP dc,VN vn,P *lcp);
2614: void monomialfctr(VL vl,P p,P *pr,DCP *dcp);
2615: void afctr(VL vl,P p0,P p,DCP *dcp);
2616: void afctrmain(VL vl,P p0,P p,int init,DCP *dcp);
2617: int divtmp(VL vl,int mod,P p1,P p2,P *q);
2618: int divtdcmp(VL vl,int mod,P p1,P p2,P *q);
2619: void GC_gcollect();
1.55 saito 2620:
2621: /* IMAT */
2622: void Pnewimat(NODE, IMAT *);
2623: void PChsgnI(NODE, IMAT *);
2624: void Pm2Im(NODE, IMAT *);
2625: void PIm2m(NODE, MAT *);
2626:
2627: void AddMatI(VL, IMAT, IMAT, IMAT *);
2628: void MulMatI(VL, IMAT, IMAT, IMAT *);
2629: void MulMatG(VL, Obj, Obj, Obj *);
2630: void MulrMatI(VL, Obj, Obj, Obj *);
2631: void MulMatS(VL, IMAT, IMAT, IMAT *);
2632: void PutIent(IMAT, int, int, Obj);
2633: void GetIent(IMAT, int, int, Obj);
2634: void GetIbody(IMAT, int, int, Obj *);
2635: void ChsgnI(IMAT, IMAT *c);
2636: void AppendIent(IMAT, int, int, Obj);
2637: void MEnt(int, int, int, Obj, IENT *);
2638: void GetForeIent(IMATC *, IENT *, int *);
2639: void GetNextIent(IMATC *, IENT *, int *);
2640: void SubMatI(VL, IMAT, IMAT, IMAT *);
2641: /* IMAT */
1.52 noro 2642:
2643: Z stoz(int c);
2644: Z utoz(unsigned int c);
2645: Z qtoz(Q n);
2646: Q ztoq(Z n);
2647: Z chsgnz(Z n);
2648: Z simpz(Z n);
2649: Z dupz(Z n);
2650: Z absz(Z n);
2651: Z addz(Z n1,Z n2);
2652: Z subz(Z n1,Z n2);
2653: Z mulz(Z n1,Z n2);
2654: Z divsz(Z n1,Z n2);
2655: Z divz(Z n1,Z n2,Z *rem);
2656: Z gcdz(Z n1,Z n2);
2657: Z gcdz_cofactor(Z n1,Z n2,Z *c1,Z *c2);
2658: Z estimate_array_gcdz(Z *a,int n);
2659: Z array_gcdz(Z *a,int n);
2660: void mkwcz(int k,int l,Z *t);
2661: int remzi(Z n,int m);
2662:
1.1 noro 2663:
2664: #if 0 && !defined(VISUAL)
2665: void bzero(const void *,int);
2666: void bcopy(const void *,void *,int);
2667: char *index(char *,int);
2668: #endif
1.61 noro 2669:
2670: void chsgnnbp(NBP p,NBP *rp);
2671: void subnbp(VL vl,NBP p1,NBP p2, NBP *rp);
2672: void addnbp(VL vl,NBP p1,NBP p2, NBP *rp);
2673: void mulnbp(VL vl,NBP p1,NBP p2, NBP *rp);
2674: void pwrnbp(VL vl,NBP p1,Q n, NBP *rp);
1.62 noro 2675: int compnbp(VL vl,NBP p1,NBP p2);
1.85 noro 2676:
2677: #define WORDSIZE_IN_N(a) (ABS((a)->_mp_size)*GMP_LIMB_BITS/32)
2678:
2679: #define MPZTOGZ(g,q) \
2680: (!mpz_sgn(g)?((q)=0):(NEWGZ(q),BDY(q)[0]=(g)[0],(q)))
2681: #define MPQTOGQ(g,q) \
2682: (!mpq_sgn(g)?((q)=0):(NEWGQ(q),BDY(q)[0]=(g)[0],(q)))
2683:
2684: #define INTMPQ(a) (!mpz_cmp_ui(mpq_numref(a),1))
2685:
2686: #define UNIGZ(a) ((a)&&NID(a)==N_GZ&&!mpz_cmp_ui(BDY(a),1))
2687: #define MUNIGZ(a) ((a)&&NID(a)==N_GZ&&!mpz_cmp_si(BDY(a),-1))
2688:
2689: #define INTGQ(a) ((a)&&NID(a)==N_GQ&&!mpz_cmp_ui(mpq_denref(BDY(a)),1))
2690:
2691: #define UNIGQ(a) \
2692: ((a)&&NID(a)==N_GQ&&!mpz_cmp_ui(mpq_numref(BDY(a)),1)&&!mpz_cmp_ui(mpq_denref(BDY(a)),1))
2693: #define MUNIGQ(a) \
2694: ((a)&&NID(a)==N_GQ&&!mpz_cmp_si(mpq_numref(BDY(a)),-1)&&!mpz_cmp_ui(mpq_denref(BDY(a)),1))
2695:
2696: #define MPZTOMPQ(z,q) \
2697: (mpq_init(q),mpq_numref(q)[0] = (z)[0],mpz_set_ui(mpq_denref(q),1))
2698:
2699: extern mpz_t ONEMPZ;
2700: extern GZ ONEGZ;
2701:
2702: void *gc_realloc(void *p,size_t osize,size_t nsize);
2703: void gc_free(void *p,size_t size);
2704: void init_gmpq();
2705: GQ mpqtogzq(mpq_t a);
2706: GQ qtogq(Q a);
2707: Q gqtoq(GQ a);
2708: GZ ztogz(Q a);
2709: Q gztoz(GZ a);
2710: P ptogp(P a);
2711: P gptop(P a);
2712: void addgz(GZ n1,GZ n2,GZ *nr);
2713: void subgz(GZ n1,GZ n2,GZ *nr);
2714: void mulgz(GZ n1,GZ n2,GZ *nr);
2715: void divgz(GZ n1,GZ n2,GZ *nq);
2716: void chsgngz(GZ n,GZ *nr);
2717: void pwrgz(GZ n1,Q n,GZ *nr);
2718: int cmpgz(GZ q1,GZ q2);
2719: void gcdgz(GZ n1,GZ n2,GZ *nq);
2720: void gcdvgz(VECT v,GZ *q);
2721: void addgq(GQ n1,GQ n2,GQ *nr);
2722: void subgq(GQ n1,GQ n2,GQ *nr);
2723: void mulgq(GQ n1,GQ n2,GQ *nr);
2724: void divgq(GQ n1,GQ n2,GQ *nq);
2725: void chsgngq(GQ n,GQ *nr);
2726: void pwrgq(GQ n1,Q n,GQ *nr);
2727: int cmpgq(GQ n1,GQ n2);
2728: void mkgwc(int k,int l,GZ *t);
2729: void gz_ptozp(P p,int sgn,GQ *c,P *pr);
2730: void gz_lgp(P p,GZ *g,GZ *l);
2731: void gz_qltozl(GQ *w,int n,GZ *dvr);
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>