[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.85

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

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