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