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

Annotation of OpenXM_contrib2/asir2018/include/ca.h, Revision 1.14

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

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