[BACK]Return to ca.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / include

Annotation of OpenXM_contrib2/asir2000/include/ca.h, Revision 1.97

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>