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