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