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