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

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

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