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

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

1.4       noro        1: /*
                      2:  * Copyright (c) 1994-2000 FUJITSU LABORATORIES LIMITED
                      3:  * All rights reserved.
                      4:  *
                      5:  * FUJITSU LABORATORIES LIMITED ("FLL") hereby grants you a limited,
                      6:  * non-exclusive and royalty-free license to use, copy, modify and
                      7:  * redistribute, solely for non-commercial and non-profit purposes, the
                      8:  * computer program, "Risa/Asir" ("SOFTWARE"), subject to the terms and
                      9:  * conditions of this Agreement. For the avoidance of doubt, you acquire
                     10:  * only a limited right to use the SOFTWARE hereunder, and FLL or any
                     11:  * third party developer retains all rights, including but not limited to
                     12:  * copyrights, in and to the SOFTWARE.
                     13:  *
                     14:  * (1) FLL does not grant you a license in any way for commercial
                     15:  * purposes. You may use the SOFTWARE only for non-commercial and
                     16:  * non-profit purposes only, such as academic, research and internal
                     17:  * business use.
                     18:  * (2) The SOFTWARE is protected by the Copyright Law of Japan and
                     19:  * international copyright treaties. If you make copies of the SOFTWARE,
                     20:  * with or without modification, as permitted hereunder, you shall affix
                     21:  * to all such copies of the SOFTWARE the above copyright notice.
                     22:  * (3) An explicit reference to this SOFTWARE and its copyright owner
                     23:  * shall be made on your publication or presentation in any form of the
                     24:  * results obtained by use of the SOFTWARE.
                     25:  * (4) In the event that you modify the SOFTWARE, you shall notify FLL by
1.5     ! noro       26:  * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification
1.4       noro       27:  * for such modification or the source code of the modified part of the
                     28:  * SOFTWARE.
                     29:  *
                     30:  * THE SOFTWARE IS PROVIDED AS IS WITHOUT ANY WARRANTY OF ANY KIND. FLL
                     31:  * MAKES ABSOLUTELY NO WARRANTIES, EXPRESSED, IMPLIED OR STATUTORY, AND
                     32:  * EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS
                     33:  * FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT OF THIRD PARTIES'
                     34:  * RIGHTS. NO FLL DEALER, AGENT, EMPLOYEES IS AUTHORIZED TO MAKE ANY
                     35:  * MODIFICATIONS, EXTENSIONS, OR ADDITIONS TO THIS WARRANTY.
                     36:  * UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT,
                     37:  * OR OTHERWISE, SHALL FLL BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY
                     38:  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
                     39:  * DAMAGES OF ANY CHARACTER, INCLUDING, WITHOUT LIMITATION, DAMAGES
                     40:  * ARISING OUT OF OR RELATING TO THE SOFTWARE OR THIS AGREEMENT, DAMAGES
                     41:  * FOR LOSS OF GOODWILL, WORK STOPPAGE, OR LOSS OF DATA, OR FOR ANY
                     42:  * DAMAGES, EVEN IF FLL SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF
                     43:  * SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. EVEN IF A PART
                     44:  * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY
                     45:  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
                     46:  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
                     47:  *
1.5     ! noro       48:  * $OpenXM: OpenXM_contrib2/asir2000/include/ca.h,v 1.4 2000/08/21 08:31:36 noro Exp $
1.4       noro       49: */
1.1       noro       50: #include <stdio.h>
                     51:
                     52: #if defined(hpux)
                     53: #include <netinet/in.h>
                     54: # define setbuffer(FP,buf,siz) setvbuf(FP,buf,_IOFBF,siz)
                     55: #endif
                     56:
                     57: #if defined(VISUAL)
                     58: #include <stdlib.h>
                     59: #endif
                     60:
                     61: #if defined(__MWERKS__)
                     62: #define THINK_C
                     63: #endif
                     64:
                     65: #if defined(linux) || (defined(sun) && !defined(SYSV)) || defined(news5000) || (defined(mips) && defined(ultrix))
                     66: #include <alloca.h>
                     67: #endif
                     68:
                     69: #if (defined(sun) && defined(SYSV))
                     70: #define alloca(x) __builtin_alloca(x)
                     71: #endif
                     72:
                     73: #if defined(VISUAL)
                     74: #include <malloc.h>
                     75: #endif
                     76:
                     77: #if 0
                     78: #include <sys/types.h>
                     79: typedef caddr_t pointer;
                     80: #endif
                     81:
                     82: typedef void * pointer;
                     83:
                     84: #if defined(VISUAL)
                     85: #include <string.h>
                     86: #define index(s,c) strchr(s,c)
                     87: #define bzero(s,len) memset(s,0,len)
                     88: #define bcopy(x,y,len) memcpy(y,x,len)
                     89: #endif
                     90:
                     91: #define COPY(a,b) ((b)=(a))
                     92: #define FREEN(p)
                     93: #define FREEQ(p)
                     94: #define FREE(p)
                     95: #define INITRC(p)
                     96:
                     97: /* data structures */
                     98:
                     99: #define O_N 1
                    100: #define O_P 2
                    101: #define O_R 3
                    102: #define O_LIST 4
                    103: #define O_VECT 5
                    104: #define O_MAT 6
                    105: #define O_STR 7
                    106: #define O_COMP 8
                    107: #define O_DP 9
                    108: #define O_USINT 10
                    109: #define O_ERR 11
                    110: #define O_GF2MAT 12
                    111: #define O_MATHCAP 13
                    112: #define O_F 14
                    113: #define O_GFMMAT 15
                    114: #define O_VOID -1
                    115:
                    116: #define N_Q 0
                    117: #define N_R 1
                    118: #define N_A 2
                    119: #define N_B 3
                    120: #define N_C 4
                    121: #define N_M 5
                    122: #define N_LM 6
                    123: #define N_GF2N 7
                    124: #define N_GFPN 8
                    125:
                    126: #define ORD_REVGRADLEX 0
                    127: #define ORD_GRADLEX 1
                    128: #define ORD_LEX 2
                    129:
                    130: #if LONG_IS_32BIT
                    131: #if defined(VISUAL)
                    132: typedef _int64 L;
                    133: typedef unsigned _int64 UL;
                    134: #else
                    135: typedef long long L;
                    136: typedef unsigned long long UL;
                    137: #endif
                    138: #else
                    139: typedef long L;
                    140: typedef unsigned long UL;
                    141: #endif
                    142:
                    143: typedef struct oN {
                    144:        int p;
                    145:        unsigned int b[1];
                    146: } *N;
                    147:
                    148: typedef struct oUP2 {
                    149:        int w;
                    150:        unsigned int b[1];
                    151: } *UP2;
                    152:
                    153: typedef struct _oUP2 {
                    154:        int w;
                    155:        unsigned int *b;
                    156: } *_UP2;
                    157:
                    158: #define UP2_DENSE 0
                    159: #define UP2_SPARSE 1
                    160:
                    161: typedef struct oGEN_UP2 {
                    162:        int id;
                    163:        UP2 dense;
                    164:        UP2 sparse;
                    165: } *GEN_UP2;
                    166:
                    167: typedef struct oV {
                    168:        char *name;
                    169:        pointer attr;
                    170:        pointer priv;
                    171: } *V;
                    172:
                    173: typedef struct oQ {
                    174:        short id;
                    175:        char nid;
                    176:        char sgn;
                    177:        N nm;
                    178:        N dn;
                    179: } *Q;
                    180:
                    181: typedef struct oReal {
                    182:        short id;
                    183:        char nid;
                    184:        char pad;
                    185:        double body;
                    186: } *Real;
                    187:
                    188: typedef struct oAlg {
                    189:        short id;
                    190:        char nid;
                    191:        char pad;
                    192:        struct oObj *body;
                    193: } *Alg;
                    194:
                    195: typedef struct oBF {
                    196:        short id;
                    197:        char nid;
                    198:        char pad;
                    199:        long body[1];
                    200: } *BF;
                    201:
                    202: typedef struct oC {
                    203:        short id;
                    204:        char nid;
                    205:        char pad;
                    206:        struct oNum *r,*i;
                    207: } *C;
                    208:
                    209: typedef struct oLM {
                    210:        short id;
                    211:        char nid;
                    212:        char pad;
                    213:        struct oN *body;
                    214: } *LM;
                    215:
                    216: typedef struct oGF2N {
                    217:        short id;
                    218:        char nid;
                    219:        char pad;
                    220:        struct oUP2 *body;
                    221: } *GF2N;
                    222:
                    223: typedef struct oGFPN {
                    224:        short id;
                    225:        char nid;
                    226:        char pad;
                    227:        struct oUP *body;
                    228: } *GFPN;
                    229:
                    230: typedef struct oNum {
                    231:        short id;
                    232:        char nid;
                    233:        char pad;
                    234: } *Num;
                    235:
                    236: typedef struct oMQ {
                    237:        short id;
                    238:        char nid;
                    239:        char pad;
                    240:        int cont;
                    241: } *MQ;
                    242:
                    243: typedef struct oP {
                    244:        short id;
                    245:        short pad;
                    246:        V v;
                    247:        struct oDCP *dc;
                    248: } *P;
                    249:
                    250: typedef struct oR {
                    251:        short id;
                    252:        short reduced;
                    253:        P nm;
                    254:        P dn;
                    255: } *R;
                    256:
                    257: typedef struct oVECT {
                    258:        short id;
                    259:        short pad;
                    260:        int len;
                    261:        pointer *body;
                    262: } *VECT;
                    263:
                    264: typedef struct oMAT {
                    265:        short id;
                    266:        short pad;
                    267:        int row,col;
                    268:        pointer **body;
                    269: } *MAT;
                    270:
                    271: typedef struct oGF2MAT {
                    272:        short id;
                    273:        short pad;
                    274:        int row,col;
                    275:        unsigned int **body;
                    276: } *GF2MAT, *GFMMAT;
                    277:
                    278: typedef struct oLIST {
                    279:        short id;
                    280:        short pad;
                    281:        struct oNODE *body;
                    282: } *LIST;
                    283:
                    284: typedef struct oSTRING {
                    285:        short id;
                    286:        short pad;
                    287:        char *body;
                    288: } *STRING;
                    289:
                    290: typedef struct oCOMP {
                    291:        short id;
                    292:        short type;
                    293:        struct oObj *member[1];
                    294: } *COMP;
                    295:
                    296: typedef struct oDP {
                    297:        short id;
                    298:        short nv;
                    299:        int sugar;
                    300:        struct oMP *body;
                    301: } *DP;
                    302:
                    303: typedef struct oUSINT {
                    304:        short id;
                    305:        short pad;
                    306:        unsigned body;
                    307: } *USINT;
                    308:
                    309: typedef struct oERR {
                    310:        short id;
                    311:        short pad;
                    312:        struct oObj *body;
                    313: } *ERR;
                    314:
                    315: typedef struct oMATHCAP {
                    316:        short id;
                    317:        short pad;
                    318:        struct oLIST *body;
                    319: } *MATHCAP;
                    320:
                    321: typedef struct oObj {
                    322:        short id;
                    323:        short pad;
                    324: } *Obj;
                    325:
                    326: typedef struct oDCP {
                    327:        Q d;
                    328:        P c;
                    329:        struct oDCP *next;
                    330: } *DCP;
                    331:
                    332: typedef struct oMP {
                    333:        struct oDL *dl;
                    334:        P c;
                    335:        struct oMP *next;
                    336: } *MP;
                    337:
                    338: typedef struct oDL {
                    339:        int td;
                    340:        int d[1];
                    341: } *DL;
                    342:
                    343: typedef struct oVL {
                    344:        V v;
                    345:        struct oVL *next;
                    346: } *VL;
                    347:
                    348: typedef struct oNODE {
                    349:        pointer body;
                    350:        struct oNODE *next;
                    351: } *NODE;
                    352:
                    353: typedef struct oUM {
                    354:        int d;
                    355:        int c[1];
                    356: } *UM;
                    357:
                    358: typedef struct oLUM {
                    359:        int d;
                    360:        int *c[1];
                    361: } *LUM;
                    362:
                    363: typedef struct oML {
                    364:        int n;
                    365:        int mod;
                    366:        int bound;
                    367:        pointer c[1];
                    368: } *ML;
                    369:
                    370: typedef struct oUB {
                    371:        int d;
                    372:        N c[1];
                    373: } *UB;
                    374:
                    375: typedef struct oVN {
                    376:        V v;
                    377:        int n;
                    378: } *VN;
                    379:
                    380: typedef struct oUP {
                    381:        int d;
                    382:        Num c[1];
                    383: } *UP;
                    384:
                    385: typedef struct oDUM {
                    386:        int n;
                    387:        UM f;
                    388: } *DUM;
                    389:
                    390: struct order_pair {
                    391:        int order, length;
                    392: };
                    393:
                    394: struct order_spec {
                    395:        int id;
                    396:        Obj obj;
                    397:        int nv;
                    398:        union {
                    399:                int simple;
                    400:                struct {
                    401:                        int length;
                    402:                        struct order_pair *order_pair;
                    403:                } block;
                    404:                struct {
                    405:                        int row;
                    406:                        int **matrix;
                    407:                } matrix;
                    408:        } ord;
                    409: };
                    410:
                    411: /* structure for cputime */
                    412:
                    413: struct oEGT {
                    414:        double exectime,gctime;
                    415: };
                    416:
                    417: /* constant */
                    418:
                    419: /* ground finite field specification */
                    420: #define FF_NOT_SET 0
                    421: #define FF_GFP 1
                    422: #define FF_GF2N 2
                    423: #define FF_GFPN 3
                    424:
                    425: #define INDEX 100
                    426:
                    427: #if USE_FLOAT
                    428: typedef float ModNum;
                    429: #define NPrimes 536
                    430: #else
                    431: typedef unsigned int ModNum;
                    432: #define NPrimes 13681
                    433: #endif
                    434:
                    435: /* general macros */
                    436: #define MAX(a,b) ((a) > (b) ? (a) : (b) )
                    437: #define MIN(a,b) ((a) > (b) ? (b) : (a) )
                    438: #ifdef ABS
                    439: #undef ABS
                    440: #endif
                    441: #define ABS(a) ((a)>0?(a):-(a))
                    442: #define ID(p) ((p)->id)
                    443: #define OID(p) (((Obj)(p))->id)
                    444: #define NID(p) (((Num)(p))->nid)
                    445: #define BDY(p) ((p)->body)
                    446: #define VR(p) ((p)->v)
                    447: #define NAME(p) ((p)->name)
                    448: #define NEXT(p) ((p)->next)
                    449: #define NM(q) ((q)->nm)
                    450: #define DN(q) ((q)->dn)
                    451: #define SGN(q) ((q)->sgn)
                    452: #define DC(p) ((p)->dc)
                    453: #define COEF(p) ((p)->c)
                    454: #define DEG(p) ((p)->d)
                    455: #define PL(n) ((n)->p)
                    456: #define BD(n) ((n)->b)
                    457: #define CONT(a) ((a)->cont)
                    458: #define UDEG(f) BD(NM(DEG(DC(f))))[0]
                    459: #define UCOEF(f) (COEF(DC(f)))
                    460: #define LC(f) (NUM(f)?(f):COEF(DC(f)))
                    461:
                    462: /* memory allocators (W_... : uses alloca) */
                    463:
                    464: #if 0
                    465: #define MALLOC(d) Risa_GC_malloc(d)
                    466: #define MALLOC_ATOMIC(d) Risa_GC_malloc_atomic(d)
                    467: #define REALLOC(p,d) Risa_GC_realloc(p,d)
                    468: #else
                    469: #define MALLOC(d) GC_malloc(d)
                    470: #define MALLOC_ATOMIC(d) GC_malloc_atomic(d)
                    471: #define REALLOC(p,d) GC_realloc(p,d)
                    472: #endif
                    473: #define CALLOC(d,e) MALLOC((d)*(e))
                    474:
                    475: #if (defined(__GNUC__) || defined(vax) || defined(apollo) || defined(alloca) || defined(VISUAL))
                    476: #define ALLOCA(d) alloca(d)
                    477: #else
                    478: #define ALLOCA(d) MALLOC(d)
                    479: #endif
                    480:
                    481: #define TRUESIZE(type,n,atype) (sizeof(struct type)+MAX((n),0)*sizeof(atype))
                    482: #define NALLOC(d) ((N)MALLOC_ATOMIC(TRUESIZE(oN,(d)-1,int)))
                    483: #define UMALLOC(d) ((UM)MALLOC(TRUESIZE(oUM,d,int)))
                    484: #define UPALLOC(d) ((UP)MALLOC(TRUESIZE(oUP,(d),Num)))
                    485: #define C_UMALLOC(d) ((UM)MALLOC(TRUESIZE(oUM,d,int)))
                    486: #define MLALLOC(d) ((ML)MALLOC(TRUESIZE(oML,d,pointer)))
                    487:
                    488: #define W_ALLOC(d) ((int *)ALLOCA(((d)+1)*sizeof(int)))
                    489: #define W_CALLOC(n,type,p) \
                    490: ((p)=(type *)ALLOCA(((n)+1)*sizeof(type)),\
                    491: bzero((char *)(p),(int)(((n)+1)*sizeof(type))))
                    492: #define W_UMALLOC(d) ((UM)ALLOCA(TRUESIZE(oUM,d,int)))
                    493: #define W_UPALLOC(d) ((UP)ALLOCA(TRUESIZE(oUP,(d),Num)))
                    494: #define W_MLALLOC(d) ((ML)ALLOCA(TRUESIZE(oML,d,pointer)))
                    495: #define W_LUMALLOC(n,bound,p)\
                    496: {\
                    497:        LUM ___q___;\
                    498:        int ___i___,**___c___;\
                    499:        (___q___) = (LUM)ALLOCA(TRUESIZE(oLUM,(n),int *));\
                    500:        DEG(___q___) = n;\
                    501:        for ( ___i___ = 0, ___c___ = (int **)COEF(___q___); ___i___ <= n; ___i___++ ) {\
                    502:                ___c___[___i___] = (int *)ALLOCA(((bound)+1)*sizeof(int));\
                    503:                bzero((char *)___c___[___i___],((bound)+1)*sizeof(int));\
                    504:        }\
                    505:        (p) = ___q___;\
                    506: }
                    507:
                    508: #define NEWUP2(q,w)\
                    509: ((q)=(UP2)MALLOC_ATOMIC(TRUESIZE(oUP2,(w)-1,unsigned int)),\
                    510: bzero((char *)(q)->b,(w)*sizeof(unsigned int)))
                    511: #define W_NEWUP2(q,w)\
                    512: ((q)=(UP2)ALLOCA(TRUESIZE(oUP2,(w)-1,unsigned int)),\
                    513: bzero((char *)(q)->b,(w)*sizeof(unsigned int)))
                    514: #define W_NEW_UP2(q,w)\
                    515: ((q).b=(unsigned int *)ALLOCA((w)*sizeof(unsigned int)))
                    516:
                    517: /* cell allocators */
                    518: #define NEWQ(q) ((q)=(Q)MALLOC(sizeof(struct oQ)),OID(q)=O_N,NID(q)=N_Q)
                    519: #define NEWMQ(q) ((q)=(MQ)MALLOC_ATOMIC(sizeof(struct oMQ)),OID(q)=O_N,NID(q)=N_M)
                    520: #define NEWP(p) ((p)=(P)MALLOC(sizeof(struct oP)),OID(p)=O_P)
                    521: #define NEWR(r) ((r)=(R)MALLOC(sizeof(struct oR)),OID(r)=O_R,(r)->reduced=0)
                    522: #define NEWLIST(l) ((l)=(LIST)MALLOC(sizeof(struct oLIST)),OID(l)=O_LIST)
                    523: #define NEWVECT(l) ((l)=(VECT)MALLOC(sizeof(struct oVECT)),OID(l)=O_VECT)
                    524: #define NEWSTR(l) ((l)=(STRING)MALLOC(sizeof(struct oSTRING)),OID(l)=O_STR)
                    525: #define NEWCOMP(c,n) ((c)=(COMP)MALLOC(sizeof(struct oCOMP)+((n)-1)*sizeof(Obj)),OID(c)=O_COMP)
                    526: #define NEWDP(d) ((d)=(DP)MALLOC(sizeof(struct oDP)),OID(d)=O_DP)
                    527: #define NEWUSINT(u) ((u)=(USINT)MALLOC_ATOMIC(sizeof(struct oUSINT)),OID(u)=O_USINT)
                    528: #define NEWERR(e) ((e)=(ERR)MALLOC(sizeof(struct oERR)),OID(e)=O_ERR)
                    529: #define NEWMATHCAP(e) ((e)=(MATHCAP)MALLOC(sizeof(struct oMATHCAP)),OID(e)=O_MATHCAP)
                    530:
                    531: #define NEWNODE(a) ((a)=(NODE)MALLOC(sizeof(struct oNODE)))
                    532: #define NEWDC(dc) ((dc)=(DCP)MALLOC(sizeof(struct oDCP)))
                    533: #define NEWV(v) ((v)=(V)MALLOC(sizeof(struct oV)))
                    534: #define NEWVL(vl) ((vl)=(VL)MALLOC(sizeof(struct oVL)))
                    535: #define NEWMP(m) ((m)=(MP)MALLOC(sizeof(struct oMP)))
                    536:
                    537: #define NEWMAT(l) ((l)=(MAT)MALLOC(sizeof(struct oMAT)),OID(l)=O_MAT)
                    538: #define NEWGF2MAT(l) ((l)=(GF2MAT)MALLOC(sizeof(struct oGF2MAT)),OID(l)=O_GF2MAT)
                    539: #define NEWGFMMAT(l) ((l)=(GFMMAT)MALLOC(sizeof(struct oGF2MAT)),OID(l)=O_GFMMAT)
                    540: #define NEWReal(q) ((q)=(Real)MALLOC_ATOMIC(sizeof(struct oReal)),OID(q)=O_N,NID(q)=N_R)
                    541: #define NEWAlg(r) ((r)=(Alg)MALLOC(sizeof(struct oAlg)),OID(r)=O_N,NID(r)=N_A)
                    542: #define NEWBF(q,l) ((q)=(BF)MALLOC_ATOMIC(TRUESIZE(oBF,(l)-1,long)),OID(q)=O_N,NID(q)=N_B)
                    543: #define NEWC(r) ((r)=(C)MALLOC(sizeof(struct oC)),OID(r)=O_N,NID(r)=N_C)
                    544: #define NEWLM(r) ((r)=(LM)MALLOC(sizeof(struct oLM)),OID(r)=O_N,NID(r)=N_LM)
                    545: #define NEWGF2N(r) ((r)=(GF2N)MALLOC(sizeof(struct oGF2N)),OID(r)=O_N,NID(r)=N_GF2N)
                    546: #define NEWGFPN(r) ((r)=(GFPN)MALLOC(sizeof(struct oGFPN)),OID(r)=O_N,NID(r)=N_GFPN)
                    547: #define NEWDL(d,n) \
                    548: ((d)=(DL)MALLOC_ATOMIC(TRUESIZE(oDL,(n)-1,int)),bzero((char *)(d),TRUESIZE(oDL,(n)-1,int)))
                    549:
                    550: #define MKP(v,dc,p) \
                    551: (!DEG(dc)?((p)=COEF(dc)):(NEWP(p),VR(p)=(v),DC(p)=(dc),(p)))
                    552: #define MKV(v,p) \
                    553: (NEWP(p),VR(p)=(v),NEWDC(DC(p)),\
                    554: DEG(DC(p))=ONE,COEF(DC(p))=(P)ONE,NEXT(DC(p))=0)
                    555: #define MKRAT(n,d,r,p) \
                    556: (NEWR(p),NM(p)=(n),DN(p)=(d),(p)->reduced=(r))
                    557: #define MKMV(v,p) \
                    558: (NEWP(p),VR(p)=(v),NEWDC(DC(p)),\
                    559: DEG(DC(p))=ONE,COEF(DC(p))=(P)ONEM,NEXT(DC(p))=0)
                    560: #define MKNODE(a,b,c) \
                    561: (NEWNODE(a),(a)->body=(pointer)b,NEXT(a)=(NODE)(c))
                    562: #define MKLIST(a,b) (NEWLIST(a),(a)->body=(NODE)(b))
                    563: #define MKVECT(m,l) \
                    564: (NEWVECT(m),(m)->len=(l),(m)->body=(pointer *)CALLOC((l),sizeof(pointer)))
                    565: #define MKMAT(m,r,c) \
                    566: (NEWMAT(m),(m)->row=(r),(m)->col=(c),(m)->body=(pointer **)almat_pointer((r),(c)))
                    567: #define TOGF2MAT(r,c,b,m) (NEWGF2MAT(m),(m)->row=(r),(m)->col=(c),(m)->body=(b))
                    568: #define TOGFMMAT(r,c,b,m) (NEWGFMMAT(m),(m)->row=(r),(m)->col=(c),(m)->body=(b))
                    569: #define MKSTR(a,b) (NEWSTR(a),(a)->body=(char *)(b))
                    570: #define MKDP(n,m,d) (NEWDP(d),(d)->nv=(n),BDY(d)=(m))
                    571: #define MKLM(b,l) (!(b)?(l)=0:(NEWLM(l),(l)->body=(b),(l)))
                    572: #define MKGF2N(b,l) (!(b)?(l)=0:(NEWGF2N(l),(l)->body=(b),(l)))
                    573: #define MKGFPN(b,l) (!(b)?(l)=0:(NEWGFPN(l),(l)->body=(b),(l)))
                    574: #define MKUSINT(u,b) (NEWUSINT(u),(u)->body=(unsigned)(b))
                    575: #define MKERR(e,b) (NEWERR(e),(e)->body=(Obj)(b))
                    576: #define MKMATHCAP(e,b) (NEWMATHCAP(e),(e)->body=(LIST)(b))
                    577:
                    578: #define NEXTDC(r,c) \
                    579: if(!(r)){NEWDC(r);(c)=(r);}else{NEWDC(NEXT(c));(c)=NEXT(c);}
                    580: #define NEXTNODE(r,c) \
                    581: if(!(r)){NEWNODE(r);(c)=(r);}else{NEWNODE(NEXT(c));(c)=NEXT(c);}
                    582: #define NEXTMP(r,c) \
                    583: if(!(r)){NEWMP(r);(c)=(r);}else{NEWMP(NEXT(c));(c)=NEXT(c);}
                    584:
                    585: /* convertors */
                    586: #define NTOQ(n,s,q) \
                    587: (!(n)?((q)=0):(NEWQ(q),SGN(q)=(s),NM(q)=(n),DN(q)=0,(q)))
                    588: #define NDTOQ(n,d,s,q) \
                    589: ((!(d)||UNIN(d))?NTOQ(n,s,q):(NEWQ(q),SGN(q)=(s),NM(q)=(n),DN(q)=(d),(q)))
                    590: #define DUPQ(p,q) \
                    591: (NEWQ(q),SGN(q)=SGN(p),NM(q)=NM(p),DN(q)=DN(p))
                    592: #define STOQ(n,q) \
                    593: ((!(n))?((q)=(Q)NULL):(NEWQ(q),\
                    594: SGN(q)=((n)>0?1:-1),NM(q)=NALLOC(1),\
                    595: PL(NM(q))=1,BD(NM(q))[0]=ABS(n),DN(q)=0,(q)))
                    596: #define UTOMQ(a,b) \
                    597: ((a)?(NEWMQ(b),CONT(b)=(unsigned int)(a),(b)):((b)=0))
                    598: #define STOMQ(a,b) \
                    599: ((a)?(NEWMQ(b),CONT(b)=(a),(b)):((b)=0))
                    600: #define UTON(u,n) \
                    601: ((!(u))?((n)=(N)NULL):((n)=NALLOC(1),PL(n)=1,BD(n)[0]=(unsigned int)(u),(n)))
                    602: #define UTOQ(n,q) \
                    603: ((!(n))?((q)=(Q)NULL):(NEWQ(q),\
                    604: SGN(q)=1,NM(q)=NALLOC(1),\
                    605: PL(NM(q))=1,BD(NM(q))[0]=(unsigned int)(n),DN(q)=0,(q)))
                    606: #define QTOS(q) (!(q)?0:SGN(q)*((int)BD(NM(q))[0]))
                    607: #define STON(i,n)\
                    608: (i?((n)=NALLOC(1),PL(n)=1,BD(n)[0]=(i),(n)):((n)=(N)0))
                    609: #define PTOR(a,b) \
                    610: (!(a)?((b)=0):(NEWR(b),NM(b)=(a),DN(b)=(P)ONE,(b)->reduced=1,(b)))
                    611: #define RTOS(a) (!(a)?0:QTOS((Q)NM((R)a)))
                    612: #define MKReal(a,b) (!(a)?((b)=0):(NEWReal(b),BDY(b)=(a),(b)))
                    613: #define MKAlg(b,r) \
                    614: (!(b)?((r)=0):NUM(b)?((r)=(Alg)(b)):(NEWAlg(r),BDY(r)=(Obj)(b),(r)))
                    615:
1.3       noro      616: #if PARI
                    617: #define ToReal(a) (!(a)?(double)0.0:REAL(a)?BDY((Real)a):RATN(a)?RatnToReal((Q)a):BIGFLOAT(a)?rtodbl(BDY((BF)a)):0)
                    618: #else
                    619: #define ToReal(a) (!(a)?(double)0.0:REAL(a)?BDY((Real)a):RATN(a)?RatnToReal((Q)a):0.0)
                    620: #endif
1.1       noro      621:
                    622: /* predicates */
                    623: #define NUM(p) (OID(p)==O_N)
                    624: #define RAT(p) (OID(p)==O_R)
                    625: #define INT(q) (!DN((Q)q))
                    626: #define RATN(a) (NID(a)==N_Q)
                    627: #define REAL(a) (NID(a)==N_R)
1.3       noro      628: #define BIGFLOAT(a) (NID(a)==N_B)
1.1       noro      629: #define SFF(a) (NID(a)==N_M)
                    630: #define UNIQ(q) ((q)&&NUM(q)&&RATN(q)&&(SGN((Q)q)==1)&&UNIN(NM((Q)q))&&(!DN((Q)q)))
                    631: #define UNIMQ(q) ((q)&&NUM(q)&&SFF(q)&&(CONT((MQ)q)==1))
                    632: #define MUNIQ(q) ((q)&&NUM(q)&&RATN(q)&&(SGN((Q)q)==-1)&&UNIN(NM((Q)q))&&(!DN((Q)q)))
                    633: #define MUNIMQ(q) ((q)&&NUM(q)&&SFF(q)&&(CONT((MQ)q)==-1))
                    634: #define UNIN(n) ((n)&&(PL(n)==1)&&(BD(n)[0]==1))
                    635: #define EVENN(n) ((!(n))||(!(BD(n)[0]%2)))
                    636:
                    637:
                    638: /* externals */
                    639: #if 0
                    640: double NatToReal();
                    641: double RatnToReal();
                    642: #endif
                    643:
                    644: extern struct oR oUNIR;
                    645: extern struct oQ oUNIQ;
                    646: extern struct oMQ oUNIMQ;
                    647: extern struct oN oUNIN;
                    648: extern struct oUP2 oONEUP2;
                    649: extern struct oV oVAR[];
                    650: extern struct oV oPVAR[];
                    651: extern struct oVL oVLIST[];
                    652: extern struct oVL oPVLIST[];
                    653: extern VL CO,ALG;
                    654: extern VL PVL;
                    655: extern R ONER;
                    656: extern Q ONE;
                    657: extern MQ ONEM;
                    658: extern LM ONELM;
                    659: extern N ONEN;
                    660: extern UP2 ONEUP2;
                    661:
                    662: extern FILE *asir_out;
                    663: #if defined(__GNUC__) || defined(THINK_C)
                    664: extern const int sprime[];
                    665: extern const int lprime[];
                    666: #else
                    667: extern int sprime[];
                    668: extern int lprime[];
                    669: #endif
                    670:
                    671: extern void (*addnumt[])();
                    672: extern void (*subnumt[])();
                    673: extern void (*mulnumt[])();
                    674: extern void (*divnumt[])();
                    675: extern void (*pwrnumt[])();
                    676: extern int (*cmpnumt[])();
                    677: extern void (*chsgnnumt[])();
                    678:
                    679: /* prototypes */
                    680: int compui(VL,USINT,USINT);
                    681:
                    682: void powermodup(UP,UP *);
                    683: void hybrid_powermodup(UP,UP *);
                    684:
                    685: void powertabup(UP,UP,UP *);
                    686: void hybrid_powertabup(UP,UP,UP *);
                    687:
                    688: void generic_powermodup(UP,UP,Q,UP *);
                    689: void hybrid_generic_powermodup(UP,UP,Q,UP *);
                    690:
                    691: void powermod1up(UP,UP *);
                    692: void hybrid_rembymulup_special(int,UP,UP,UP,UP *);
                    693: void hybrid_tmulup(int,UP,UP,int,UP *);
                    694: void hybrid_squareup(int,UP,UP *);
                    695: void hybrid_mulup(int,UP,UP,UP *);
                    696:
                    697: void getmod_lm(N *);
                    698:
                    699: int maxblenup(UP);
                    700: void monicup(UP,UP *);
                    701: void simpup(UP,UP *);
                    702: void simpnum(Num,Num *);
                    703: void decompp(P,Q,P *,P *);
                    704: void truncp(P,Q,P *);
                    705: void uremp(P,P,P *);
                    706: void ugcdp(P,P,P *);
                    707: void reversep(P,Q,P *);
                    708: void invmodp(P,Q,P *);
                    709: void addup(UP,UP,UP *);
                    710: void subup(UP,UP,UP *);
                    711: void chsgnup(UP,UP *);
                    712: void mulup(UP,UP,UP *);
                    713: void tmulup(UP,UP,int,UP *);
                    714: void squareup(UP,UP *);
                    715: void remup(UP,UP,UP *);
                    716: void remup_destructive(UP,UP);
                    717: void qrup(UP,UP,UP *,UP *);
                    718: void qrup_destructive(UP,UP);
                    719: void gcdup(UP,UP,UP *);
                    720: void reverseup(UP,int,UP *);
                    721: void invmodup(UP,int,UP *);
                    722: void pwrup(UP,Q,UP *);
                    723: void squarep_gf2n(VL,P,P *);
                    724: void kmulp(VL,P,P,P *);
                    725: void ksquarep(VL,P,P *);
                    726: void kmulup(UP,UP,UP *);
                    727: void ksquareup(UP,UP *);
                    728: void extractup(UP,int,int,UP *);
                    729: void copyup(UP,UP);
                    730: void c_copyup(UP,int,pointer *);
                    731: void kmulupmain(UP,UP,UP *);
                    732: void ksquareupmain(UP,UP *);
                    733: void rembymulup(UP,UP,UP *);
                    734: void rembymulup_special(UP,UP,UP,UP *);
                    735: void tkmulup(UP,UP,int,UP *);
                    736: void shiftup(UP,int,UP *);
                    737: void set_degreeup(UP,int);
                    738: void decompup(UP,int,UP *,UP *);
                    739: void truncup(UP,int,UP *);
                    740: void uptofmarray(int,UP,ModNum *);
                    741: void fmarraytoup(ModNum *,int,UP *);
                    742: void uiarraytoup(unsigned int **,int,int,UP *);
                    743: void adj_coefup(UP,N,N,UP *);
                    744: void uptolmup(UP,UP *);
                    745: void remcup(UP,N,UP *);
                    746: void fft_mulup(UP,UP,UP *);
                    747: void fft_squareup(UP,UP *);
                    748: void trunc_fft_mulup(UP,UP,int,UP *);
                    749: void shoup_fft_mulup(UP,UP,UP *);
                    750: void shoup_fft_squareup(UP,UP *);
                    751: void shoup_trunc_fft_mulup(UP,UP,int,UP *);
                    752: void crup(ModNum **,int,int *,int,N,UP *);
                    753: void shoup_crup(ModNum **,int,int *,int,N,N,UP *);
                    754: void squareup_gf2n(UP,UP *);
                    755: void powermodup_gf2n(UP,UP *);
                    756: void generic_powermodup_gf2n(UP,UP,Q,UP *);
                    757: void tracemodup_gf2n(UP,UP,Q,UP *);
                    758: void tracemodup_gf2n_slow(UP,UP,Q,UP *);
                    759: void tracemodup_gf2n_tab(UP,UP,Q,UP *);
                    760: void square_rem_tab_up_gf2n(UP,UP *,UP *);
                    761: void powertabup_gf2n(UP,UP,UP *);
                    762: void find_root_gf2n(UP,GF2N *);
                    763:
                    764: int cmpdl_matrix(int,DL,DL);
                    765: int cmpdl_order_pair(int,DL,DL);
                    766: int cmpdl_elim(int,DL,DL);
                    767: int cmpdl_blexrev(int,DL,DL);
                    768: int cmpdl_bgradrev(int,DL,DL);
                    769: int cmpdl_brevrev(int,DL,DL);
                    770: int cmpdl_brevgradlex(int,DL,DL);
                    771: int cmpdl_bgradlex(int,DL,DL);
                    772: int cmpdl_blex(int,DL,DL);
                    773: int cmpdl_revgradlex(int,DL,DL);
                    774: int cmpdl_gradlex(int,DL,DL);
                    775: int cmpdl_revlex(int,DL,DL);
                    776: int cmpdl_lex(int,DL,DL);
                    777: int compd(VL,DP,DP);
                    778: void adddl(int,DL,DL,DL *);
                    779: void divsdc(VL,DP,P,DP *);
                    780: void muldc(VL,DP,P,DP *);
                    781: void muldm(VL,DP,MP,DP *);
                    782: void muld(VL,DP,DP,DP *);
                    783: void chsgnd(DP,DP *);
                    784: void subd(VL,DP,DP,DP *);
                    785: void addd(VL,DP,DP,DP *);
                    786: int sugard(MP);
                    787: void nodetod(NODE,DP *);
                    788: void dtop(VL,VL,DP,P *);
                    789: void ptod(VL,VL,P,DP *);
                    790: void initd(struct order_spec *);
                    791:
                    792: void _printdp(DP);
                    793: void _dp_sp_mod(DP,DP,int,DP *);
                    794: void _dp_mod(DP,int,NODE,DP *);
                    795: void _dp_red_mod(DP,DP,int,DP *);
                    796: void _dtop_mod(VL,VL,DP,P *);
                    797: void _mulmdm(VL,int,DP,MP,DP *);
                    798: void _mulmd(VL,int,DP,DP,DP *);
                    799: void _chsgnmd(int,DP,DP *);
                    800: void _submd(VL,int,DP,DP,DP *);
                    801: void _addmd(VL,int,DP,DP,DP *);
                    802: void _mdtop(VL,int,VL,DP,P *);
                    803: void divsmdc(VL,int,DP,P,DP *);
                    804: void mulmdc(VL,int,DP,P,DP *);
                    805: void mulmdm(VL,int,DP,MP,DP *);
                    806: void mulmd(VL,int,DP,DP,DP *);
                    807: void chsgnmd(int,DP,DP *);
                    808: void submd(VL,int,DP,DP,DP *);
                    809: void addmd(VL,int,DP,DP,DP *);
                    810: void mdtop(VL,int,VL,DP,P *);
                    811: void mptomd(VL,int,VL,P,DP *);
                    812: void ptomd(VL,int,VL,P,DP *);
                    813: int p_mag(P);
                    814: int n_bits(N);
                    815: void gcdBinary_27n(N,N,N *);
                    816: void rtime_init(void);
                    817: void setmod_gf2n(P);
                    818: void mt_sgenrand(unsigned long);
                    819: unsigned long mt_genrand(void);
                    820: #if defined(VISUAL)
                    821: void srandom(unsigned int);
                    822: unsigned int random(void);
                    823: #endif
                    824: void gcdbmodn(N,N,N *);
                    825: void gcdbinn(N,N,N *);
                    826: void gcdmodn(N,N,N *);
                    827: void gcdaccn(N,N,N *);
                    828: void gcdEuclidn(N,N,N *);
                    829: void GC_free(void *);
                    830: void FFT_primes(int,int *,int *,int *);
                    831: int FFT_pol_product(unsigned int,unsigned int *, unsigned int,unsigned int *,
                    832:        unsigned int *,int,unsigned int *);
                    833: int FFT_pol_square(unsigned int,unsigned int *,
                    834:        unsigned int *,int,unsigned int *);
                    835: void dcptolist(DCP,LIST *);
                    836: void gcdprsmp(VL,int,P,P,P *);
                    837: void mult_mod_tab(UM,int,UM *,UM,int);
                    838: int nfctr_mod(UM,int);
                    839: int irred_check(UM,int);
                    840: void modfctrp(P,int,int,DCP *);
                    841: void pf_init(void);
                    842: void binaryton(char *,N *);
                    843: void hexton(char *,N *);
                    844: void ptolmp(P,P *);
                    845: void lmptop(P,P *);
                    846: void ulmptoum(int,UP,UM);
                    847: void objtobobj(int,Obj,Obj *);
                    848: void bobjtoobj(int,Obj,Obj *);
                    849: void numtobnum(int,Num,Num *);
                    850: void bnumtonum(int,Num,Num *);
                    851: void ptobp(int,P,P *);
                    852: void bptop(int,P,P *);
                    853: void listtoblist(int,LIST,LIST *);
                    854: void blisttolist(int,LIST,LIST *);
                    855: void vecttobvect(int,VECT,VECT *);
                    856: void bvecttovect(int,VECT,VECT *);
                    857: void mattobmat(int,MAT,MAT *);
                    858: void bmattomat(int,MAT,MAT *);
                    859: void n32ton27(N,N *);
                    860: void n27ton32(N,N *);
                    861: void kmulum(int,UM,UM,UM);
                    862: void saveobj(FILE *,Obj);
                    863: void endian_init(void);
                    864: void write_char(FILE *,unsigned char *);
                    865: void write_short(FILE *,unsigned short *);
                    866: void write_int(FILE *,unsigned int *);
                    867: void write_double(FILE *,double *);
                    868: void write_intarray(FILE *,unsigned int *,int);
                    869: void write_string(FILE *,unsigned char *,int);
                    870: void savestr(FILE *,char *);
                    871: void loadstr(FILE *,char **);
                    872: void savevl(FILE *,VL);
                    873: void loadvl(FILE *);
                    874: void skipvl(FILE *);
                    875: void savev(FILE *,V);
                    876: void loadv(FILE *,V *);
                    877: int save_convv(V);
                    878: V load_convv(int);
                    879: void swap_bytes(char *,int,int);
                    880: void read_char(FILE *,unsigned char *);
                    881: void read_short(FILE *,unsigned short *);
                    882: void read_int(FILE *,unsigned int *);
                    883: void read_double(FILE *,double *);
                    884: void read_intarray(FILE *,unsigned int *,int);
                    885: void read_string(FILE *,unsigned char *,int);
                    886: void loadobj(FILE *,Obj *);
                    887: void invum(int,UM,UM,UM);
                    888: void addarray_to(unsigned int *,int,unsigned int *,int);
                    889: void muln_1(unsigned int *,int,unsigned int,unsigned int *);
                    890: unsigned int divn_1(unsigned int *,int,unsigned int,unsigned int *);
                    891: void ptoup(P,UP *);
                    892: void uptop(UP,P *);
                    893: void printnum(Num);
                    894: void printv(VL,V);
                    895: void kmulq(Q,Q,Q *);
                    896: void bshiftn(N,int,N *);
                    897: void remn(N,N,N*);
                    898: void simplm(LM,LM *);
                    899: void qtolm(Q,LM *);
                    900: int qpcheck(Obj);
                    901: int headsgn(P);
                    902: void adjsgn(P,DCP);
                    903: void setmod_g2n(P);
                    904: void simpgf2n(GF2N,GF2N *);
                    905: void ptogf2n(Obj,GF2N *);
                    906: void gf2ntop(GF2N,P *);
                    907: void gf2ntovect(GF2N,VECT *);
                    908: void squaregf2n(GF2N,GF2N *);
                    909: void randomgf2n(GF2N *);
                    910: void invgf2n(GF2N,GF2N *);
                    911: void kmuln(N,N,N *);
                    912: void extractn(N,int,int,N *);
                    913: void copyn(N,int,int *);
                    914: void kmulnmain(N,N,N *);
                    915: int qcoefp(Obj);
                    916: int qcoefr(Obj);
                    917: int get_allocwords(void);
                    918: double get_clock(void);
                    919: void get_eg(struct oEGT *);
                    920: void printtime(struct oEGT *,struct oEGT *,double);
                    921: void init_eg(struct oEGT *);
                    922: void add_eg(struct oEGT *,struct oEGT *,struct oEGT *);
                    923: void print_eg(char *,struct oEGT *);
                    924: void print_split_eg(struct oEGT *,struct oEGT *);
                    925: void print_split_e(struct oEGT *,struct oEGT *);
                    926: void suspend_timer(void);
                    927: void resume_timer(void);
                    928: void reset_engine(void);
                    929: void notdef(VL,Obj,Obj,Obj *);
                    930: void error(char *);
                    931: void ptoup2(P,UP2 *);
                    932: void ptoup2_sparse(P,UP2 *);
                    933: void up2top(UP2,P *);
                    934: void up2tovect(UP2,VECT *);
                    935: void up2ton(UP2,Q *);
                    936: void ntoup2(Q,UP2 *);
                    937: void gen_simpup2(UP2,GEN_UP2,UP2 *);
                    938: void gen_simpup2_destructive(UP2,GEN_UP2);
                    939: void gen_invup2(UP2,GEN_UP2,UP2 *);
                    940: void gen_pwrmodup2(UP2,Q,GEN_UP2,UP2 *);
                    941: void simpup2(UP2,UP2,UP2 *);
                    942: int degup2(UP2);
                    943: int degup2_sparse(UP2);
                    944: int degup2_1(unsigned int);
                    945: void addup2(UP2,UP2,UP2 *);
                    946: void subup2(UP2,UP2,UP2 *);
                    947: void mulup2_n1(unsigned int *,int,unsigned int,unsigned int *);
                    948: void mulup2_nh(unsigned int *,int,unsigned int,unsigned int *);
                    949: void _mulup2_1(UP2,unsigned int,UP2);
                    950: void _mulup2_h(UP2,unsigned int,UP2);
                    951: void mulup2(UP2,UP2,UP2 *);
                    952: void _kmulup2_(unsigned int *,unsigned int *,int,unsigned int *);
                    953: void _mulup2_nn(unsigned int *,unsigned int *,int,unsigned int *);
                    954: void _mulup2(UP2,UP2,UP2);
                    955: void _mulup2_(_UP2,_UP2,_UP2);
                    956: void squareup2(UP2,UP2 *);
                    957: void _adjup2(UP2);
                    958: void _adjup2_(_UP2);
                    959: void _addup2(UP2,UP2,UP2);
                    960: void _addup2_destructive(UP2,UP2);
                    961: void _addup2_(_UP2,_UP2,_UP2);
                    962: void _addtoup2_(_UP2,_UP2);
                    963: unsigned int mulup2_bb(unsigned int,unsigned int);
                    964: void init_up2_tab(void);
                    965: unsigned int quoup2_11(unsigned int,unsigned int);
                    966: void divup2_1(unsigned int,unsigned int,int,int,unsigned int *,unsigned int *);
                    967: void qrup2(UP2,UP2,UP2 *,UP2 *);
                    968: void _qrup2(UP2,UP2,UP2,UP2);
                    969: void remup2(UP2,UP2,UP2 *);
                    970: void _remup2(UP2,UP2,UP2);
                    971: void remup2_sparse(UP2,UP2,UP2 *);
                    972: void remup2_sparse_destructive(UP2,UP2);
                    973: void remup2_type1_destructive(UP2,int);
                    974: void remup2_3_destructive(UP2,UP2);
                    975: void remup2_5_destructive(UP2,UP2);
                    976: void _invup2_1(unsigned int,unsigned int,unsigned int *,unsigned int *);
                    977: void _gcdup2_1(unsigned int,unsigned int,unsigned int *);
                    978: void up2_init_eg(void);
                    979: void up2_show_eg(void);
                    980: void invup2(UP2,UP2,UP2 *);
                    981: void gcdup2(UP2,UP2,UP2 *);
                    982: void chsgnup2(UP2,UP2 *);
                    983: void pwrmodup2(UP2,Q,UP2,UP2 *);
                    984: void pwrmodup2_sparse(UP2,Q,UP2,UP2 *);
                    985: int compup2(UP2,UP2);
                    986: void printup2(UP2);
                    987: void _copyup2(UP2,UP2);
                    988: void _bshiftup2(UP2,int,UP2);
                    989: void _bshiftup2_destructive(UP2,int);
                    990: void diffup2(UP2,UP2 *);
                    991: int sqfrcheckup2(UP2);
                    992: int irredcheckup2(UP2);
                    993: int irredcheck_dddup2(UP2);
                    994: void _copy_up2bits(UP2,unsigned int **,int);
                    995: void _print_frobmat(unsigned int **,int,int);
                    996: int compute_multiplication_matrix(P,GF2MAT *);
                    997: void compute_change_of_basis_matrix(P,P,int,GF2MAT *,GF2MAT *);
                    998: int compute_representation_conversion_matrix(P,GF2MAT *,GF2MAT *);
                    999: void mul_nb(GF2MAT,unsigned int *,unsigned int *,unsigned int *);
                   1000: void leftshift(unsigned int *,int);
                   1001: void mat_to_gf2mat(MAT,unsigned int ***);
                   1002: void gf2mat_to_mat(unsigned int **,int,MAT *);
                   1003: void mulgf2mat(int,unsigned int **,unsigned int **,unsigned int **);
                   1004: void mulgf2vectmat(int,unsigned int *,unsigned int **,unsigned int *);
                   1005: int mulgf2vectvect(int,unsigned int *,unsigned int *);
                   1006: int invgf2mat(int,unsigned int **,unsigned int **);
                   1007: void _mulup2_11(unsigned int,unsigned int,unsigned int *);
                   1008: void _mulup2_22(unsigned int *,unsigned int *,unsigned int *);
                   1009: void _mulup2_33(unsigned int *,unsigned int *,unsigned int *);
                   1010: void _mulup2_44(unsigned int *,unsigned int *,unsigned int *);
                   1011: void _mulup2_55(unsigned int *,unsigned int *,unsigned int *);
                   1012: void _mulup2_66(unsigned int *,unsigned int *,unsigned int *);
                   1013: void printup2_(unsigned int *,int);
                   1014: void type1_bin_invup2(UP2,int,UP2 *);
                   1015: int int_bits(int);
                   1016:
                   1017:
                   1018: LUM LUMALLOC(int, int);
                   1019: Obj ToAlg(Num);
                   1020: UM *berlemain(register int, UM, UM *);
                   1021: void *Risa_GC_malloc(size_t);
                   1022: void *Risa_GC_malloc_atomic(size_t);
                   1023: void *Risa_GC_realloc(void *,size_t);
                   1024: void *GC_malloc(size_t);
                   1025: void *GC_malloc_atomic(size_t);
                   1026: void *GC_realloc(void *,size_t);
                   1027: double NatToReal(N,int *);
                   1028: double RatnToReal(Q);
                   1029: double pwrreal0(double,int);
1.3       noro     1030: double rtodbl(); /* XXX */
1.1       noro     1031: int **almat(int,int);
                   1032: pointer **almat_pointer(int,int);
                   1033: int berlecnt(register int,UM);
                   1034: int berlecntmain(register int,int,int,register int **);
                   1035: int cmpalg(Num,Num);
                   1036: int cmpbf(Num,Num);
                   1037: int cmpcplx(Num,Num);
                   1038: int cmpn(N,N);
                   1039: int cmpq(Q,Q);
                   1040: int cmpreal(Real,Real);
                   1041: int cmpmi(MQ,MQ);
                   1042: int cmplm(LM,LM);
                   1043: int compmat(VL,MAT,MAT);
                   1044: int compnum(VL,Num,Num);
                   1045: int compp(VL,P,P);
                   1046: int compr(VL,Obj,Obj);
                   1047: int compstr(VL,STRING,STRING);
                   1048: int compvect(VL,VECT,VECT);
                   1049: int ctest(P,ML,int,int *);
                   1050: int cycchk(P);
                   1051: int dbound(V,P);
                   1052: int dcomp(P,P);
                   1053: int deg(V,P);
                   1054: int degtest(int,int *,ML,int);
                   1055: int divcheck(VL,P *,int,P,P);
                   1056: unsigned int divin(N,unsigned int,N *);
                   1057: int divtdcpz(VL,P,P,P *);
                   1058: int divtpz(VL,P,P,P *);
                   1059: int divum(register int,UM,UM,UM);
                   1060: int dm(int,int,int *);
                   1061: int dmb(int,int,int,int *);
                   1062: int dma(int,int,int,int *);
                   1063: int dmab(int,int,int,int,int *);
                   1064: int dmar(int,int,int,int);
                   1065: int dtestmain(P,Q,ML,int,int *,P *,P *);
                   1066: int geldb(VL,P);
                   1067: int getchomdeg(V,P);
                   1068: int getdeg(V,P);
                   1069: int getlchomdeg(V,P,int *);
                   1070: int homdeg(P);
                   1071: unsigned int invm(unsigned int,int);
                   1072: int iscycm(P);
                   1073: int iscycp(P);
                   1074: int lengthp(P);
                   1075: int mig(int,int,P);
                   1076: int mignotte(int,P);
                   1077: int minimain(register int,int,int,register int **);
                   1078: int ncombi(int,int,int,int *);
                   1079: int nextbin(VN,int);
                   1080: int nmonop(P);
                   1081: int pcoef(VL,VL,P,P *);
                   1082: int pcoef0(VL,VL,P,P *);
                   1083: unsigned int pwrm(register int,register int,int);
                   1084: unsigned int rem(N,unsigned int);
                   1085: int sqfrchk(P);
                   1086: int subn(N,N,N *);
                   1087: int ucmpp(P,P);
                   1088: int valideval(VL,DCP,VN);
                   1089: int zerovpchk(VL,P,VN);
                   1090:
                   1091: void addgf2n(GF2N,GF2N,GF2N *);
                   1092: void subgf2n(GF2N,GF2N,GF2N *);
                   1093: void mulgf2n(GF2N,GF2N,GF2N *);
                   1094: void divgf2n(GF2N,GF2N,GF2N *);
                   1095: void chsgngf2n(GF2N,GF2N *);
                   1096: void pwrgf2n(GF2N,Q, GF2N *);
                   1097: int cmpgf2n(GF2N,GF2N);
                   1098:
                   1099: void addgfpn(GFPN,GFPN,GFPN *);
                   1100: void subgfpn(GFPN,GFPN,GFPN *);
                   1101: void mulgfpn(GFPN,GFPN,GFPN *);
                   1102: void divgfpn(GFPN,GFPN,GFPN *);
                   1103: void chsgngfpn(GFPN,GFPN *);
                   1104: void pwrgfpn(GFPN,Q, GFPN *);
                   1105: int cmpgfpn(GFPN,GFPN);
                   1106:
                   1107: void addalg(Num,Num,Num *);
                   1108: void addbf(Num,Num,Num *);
                   1109: void addcplx(Num,Num,Num *);
                   1110: void addm2p(VL,Q,Q,P,P,P *);
                   1111: void addm2q(Q,Q,Q,Q,Q *);
                   1112: void addmat(VL,MAT,MAT,MAT *);
                   1113: void addmp(VL,int,P,P,P *);
                   1114: void addmpq(int,P,P,P *);
                   1115: void addmptoc(VL,int,P,P,P *);
                   1116: void addmq(int,MQ,MQ,MQ *);
                   1117: void addn(N,N,N *);
                   1118: void addnum(VL,Num,Num,Num *);
                   1119: void addp(VL,P,P,P *);
                   1120: void addpadic(int,int,unsigned int *,unsigned int *);
                   1121: void addpq(P,P,P *);
                   1122: void addptoc(VL,P,P,P *);
                   1123: void addq(Q,Q,Q *);
                   1124: void addr(VL,Obj,Obj,Obj *);
                   1125: void addreal(Num,Num,Real *);
                   1126: void addmi(MQ,MQ,MQ *);
                   1127: void addlm(LM,LM,LM *);
                   1128: void addstr(VL,STRING,STRING,STRING *);
                   1129: void addum(int,UM,UM,UM);
                   1130: void addvect(VL,VECT,VECT,VECT *);
                   1131: void adjc(VL,P,P,P,Q,P *,P *);
                   1132: void afctr(VL,P,P,DCP *);
                   1133: void afctrmain(VL,P,P,int,DCP *);
                   1134: void affine(VL,P,VN,P *);
                   1135: void affinemain(VL,P,V,int,P *,P *);
                   1136: void berle(int,int,P,ML *);
                   1137: void bnton(register int,N,N *);
                   1138: void cbound(VL,P,Q *);
                   1139: void chnrem(int,V,P,Q,UM,P *,Q *);
                   1140: void chnremp(VL,int,P,Q,P,P *);
                   1141: void chsgnalg(Num,Num *);
                   1142: void chsgnbf(Num a,Num *);
                   1143: void chsgncplx(Num,Num *);
                   1144: void chsgnmat(MAT,MAT *);
                   1145: void chsgnmp(int,P,P *);
                   1146: void chsgnnum(Num,Num *);
                   1147: void chsgnp(P,P *);
                   1148: void chsgnq(Q,Q *);
                   1149: void chsgnr(Obj,Obj *);
                   1150: void chsgnreal(Num,Num *);
                   1151: void chsgnmi(MQ,MQ *);
                   1152: void chsgnlm(LM,LM *);
                   1153: void chsgnvect(VECT,VECT *);
                   1154: void clctv(VL,P,VL *);
                   1155: void clctvr(VL,Obj,VL *);
                   1156: void cm2p(Q,Q,P,P *);
                   1157: void cmax(P,Q *);
                   1158: void cmp(Q,P,P *);
                   1159: void coefp(P,int,P *);
                   1160: void cpylum(int,LUM,LUM);
                   1161: void cpyum(UM,UM);
                   1162: void csump(VL,P,Q *);
                   1163: void cycm(V,register int,DCP *);
                   1164: void cycp(V,register int,DCP *);
                   1165: void degp(V,P,Q *);
                   1166: void degum(UM,int);
                   1167: void detmp(VL,int,P **,int,P *);
                   1168: void detp(VL,P **,int,P *);
                   1169: void diffp(VL,P,V,P *);
                   1170: void diffum(register int,UM,UM);
                   1171: void divalg(Num,Num,Num *);
                   1172: void divbf(Num,Num,Num *);
                   1173: void divcp(P,Q,P *);
                   1174: void divcplx(Num,Num,Num *);
                   1175: void divmat(VL,Obj,Obj,Obj *);
                   1176: void divmq(int,MQ,MQ,MQ *);
                   1177: void divn(N,N,N *,N *);
                   1178: void divnmain(int,int,unsigned int *,unsigned int *,unsigned int *);
                   1179: void divnum(VL,Num,Num,Num *);
                   1180: void divq(Q,Q,Q *);
                   1181: void divr(VL,Obj,Obj,Obj *);
                   1182: void divreal(Num,Num,Real *);
                   1183: void divmi(MQ,MQ,MQ *);
                   1184: void divlm(LM,LM,LM *);
                   1185: void divsdcmp(VL,int,P,P,P *);
                   1186: void divsdcp(VL,P,P,P *);
                   1187: void divsmp(VL,int,P,P,P *);
                   1188: void divsn(N,N,N *);
                   1189: void divsp(VL,P,P,P *);
                   1190: void divsrdcmp(VL,int,P,P,P *,P *);
                   1191: void divsrdcp(VL,P,P,P *,P *);
                   1192: void divsrmp(VL,int,P,P,P *,P *);
                   1193: void divsrp(VL,P,P,P *,P *);
                   1194: void divvect(VL,Obj,Obj,Obj *);
                   1195: void dtest(P,ML,int,DCP *);
                   1196: void dtestroot(int,int,P,LUM,struct oDUM *,DCP *);
                   1197: void dtestroot1(int,int,P,LUM,P *);
                   1198: void dtestsq(int,int,P,LUM,P *);
                   1199: void dtestsql(P,ML,struct oDUM *,DCP *);
                   1200: void estimatelc(VL,Q,DCP,VN,P *);
                   1201: void eucum(register int,UM,UM,UM,UM);
                   1202: void exthp(VL,P,int,P *);
                   1203: void exthpc(VL,V,P,int,P *);
                   1204: void ezgcd1p(VL,P,P,P *);
                   1205: void ezgcdhensel(P,int,UM,UM,ML *);
                   1206: void ezgcdnp(VL,P,P *,int,P *);
                   1207: void ezgcdnpp(VL,DCP,P *,int,P *);
                   1208: void ezgcdnpz(VL,P *,int,P *);
                   1209: void ezgcdp(VL,P,P,P *);
                   1210: void ezgcdpp(VL,DCP,P,P *);
                   1211: void ezgcdpz(VL,P,P,P *);
                   1212: void factorial(int,Q *);
                   1213: void fctrp(VL,P,DCP *);
                   1214: void fctrwithmvp(VL,P,V,DCP *);
                   1215: void gcda(VL,P,P,P,P *);
                   1216: void gcdcp(VL,P,P *);
                   1217: void gcdgen(P,ML,ML *);
                   1218: void gcdmonomial(VL,DCP *,int,P *);
                   1219: void gcdn(N,N,N *);
                   1220: void gcdprsp(VL,P,P,P *);
                   1221: void gcdum(register int,UM,UM,UM);
                   1222: void getmindeg(V,P,Q *);
                   1223: void henmain(LUM,ML,ML,ML *);
                   1224: void henmv(VL,VN,P,P,P,P,P,P,P,P,P,Q,int,P *,P *);
                   1225: void henmvmain(VL,VN,P,P,P,P,P,P,P,Q,Q,int,P *,P *);
                   1226: void henprep(P,ML,ML,ML *,ML *);
                   1227: void hensel(int,int,P,ML *);
                   1228: void henzq(P,P,UM,P,UM,int,int,P *,P *,P *,P *,Q *);
                   1229: void henzq1(P,P,Q,P *,P *,Q *);
                   1230: void hsq(int,int,P,int *,DCP *);
                   1231: void intersectv(VL,VL,VL *);
                   1232: void invl(Q,Q,Q *);
                   1233: void invmq(int,MQ,MQ *);
                   1234: void invq(Q,Q *);
                   1235: void lgp(P,N *,N *);
                   1236: void lumtop(V,int,int,LUM,P *);
                   1237: void markv(VN,int,P);
                   1238: void maxdegp(VL,P,VL *,P *);
                   1239: void mergev(VL,VL,VL,VL *);
                   1240: void mfctr(VL,P,DCP *);
                   1241: void mfctrhen2(VL,VN,P,P,P,P,P,P,P *);
                   1242: void mfctrmain(VL,P,DCP *);
                   1243: void mfctrwithmv(VL,P,V,DCP *);
                   1244: void min_common_vars_in_coefp(VL,P,VL *,P *);
                   1245: void minchdegp(VL,P,VL *,P *);
                   1246: void mindegp(VL,P,VL *,P *);
                   1247: void mini(register int,UM,UM);
                   1248: void minlcdegp(VL,P,VL *,P *);
                   1249: void mkbc(int,Q *);
                   1250: void mkbcm(int,int,MQ *);
                   1251: void mkssum(V,int,int,int,P *);
                   1252: void monomialfctr(VL,P,P *,DCP *);
                   1253: void mptop(P,P *);
                   1254: void mptoum(P,UM);
                   1255: void msqfr(VL,P,DCP *);
                   1256: void msqfrmain(VL,P,DCP *);
                   1257: void msqfrmainmain(VL,P,VN,P,DCP,DCP *,P *);
                   1258: void mulalg(Num,Num,Num *);
                   1259: void mulbf(Num,Num,Num *);
                   1260: void mulcplx(Num,Num,Num *);
                   1261: void mulin(N,unsigned int,unsigned int *);
                   1262: void mullum(int,int,LUM,LUM,LUM);
                   1263: void mullumarray(P,ML,int,int *,P *);
                   1264: void mulm2p(VL,Q,Q,P,P,P *);
                   1265: void mulm2q(Q,Q,Q,Q,Q *);
                   1266: void mulmat(VL,Obj,Obj,Obj *);
                   1267: void mulmatmat(VL,MAT,MAT,MAT *);
                   1268: void mulmatvect(VL,MAT,VECT,VECT *);
                   1269: void mulmp(VL,int,P,P,P *);
                   1270: void mulmpc(VL,int,P,P,P *);
                   1271: void mulmpq(int,P,P,P *);
                   1272: void mulmq(int,MQ,MQ,MQ *);
                   1273: void muln(N,N,N *);
                   1274: void mulnum(VL,Num,Num,Num *);
                   1275: void mulp(VL,P,P,P *);
                   1276: void mulpadic(int,int,unsigned int *,unsigned int *,unsigned int *);
                   1277: void mulpc(VL,P,P,P *);
                   1278: void mulpq(P,P,P *);
                   1279: void mulq(Q,Q,Q *);
                   1280: void mulr(VL,Obj,Obj,Obj *);
                   1281: void mulreal(Num,Num,Real *);
                   1282: void mulmi(MQ,MQ,MQ *);
                   1283: void mullm(LM,LM,LM *);
                   1284: void mulrmat(VL,Obj,MAT,MAT *);
                   1285: void mulrvect(VL,Obj,VECT,VECT *);
                   1286: void mulsgn(VN,VN,int,VN);
                   1287: void mulsum(register int,UM,register int,UM);
                   1288: void mulum(register int,UM,UM,UM);
                   1289: void mulvect(VL,Obj,Obj,Obj *);
                   1290: void mulvectmat(VL,VECT,MAT,VECT *);
                   1291: void next(VN);
                   1292: void nezgcdnp_sqfr_primitive(VL,P,P *,int,P *);
                   1293: void nezgcdnpp(VL,DCP,P *,int,P *);
                   1294: void nezgcdnpz(VL,P *,int,P *);
                   1295: void nezgcdnpzmain(VL,P *,int,P *);
                   1296: void nglob_init(void);
                   1297: void norm(P,Q *);
                   1298: void norm1(P,P *);
                   1299: void norm1c(P,Q *);
                   1300: void normalizemp(int,P);
                   1301: void nthrootchk(P,struct oDUM *,ML,DCP *);
                   1302: void nthrootn(N,int,N *);
                   1303: void ntobn(register int,N,N *);
                   1304: void nuezgcdnpzmain(VL,P *,int,P *);
                   1305: void padictoq(int,int,int *,Q *);
                   1306: void risa_pari_init(void);
                   1307: void pcp(VL,P,P *,P *);
                   1308: void pderivr(VL,Obj,V,Obj *);
                   1309: void pdiva(VL,P,P,P,P *);
                   1310: void pinva(P,P,P *);
                   1311: void plisttop(P *,V,int,P *);
                   1312: void pmonic(VL,P,P,P *);
                   1313: void pqra(VL,P,P,P,P *,P *);
                   1314: void premmp(VL,int,P,P,P *);
                   1315: void premp(VL,P,P,P *);
                   1316: void ptolum(int,int,P,LUM);
                   1317: void ptomp(int,P,P *);
                   1318: void ptoum(int,P,UM);
                   1319: void ptozp(P,int,Q *,P *);
                   1320: void ptozp0(P,P *);
                   1321: void pwralg(Num,Num,Num *);
                   1322: void pwrbf(Num,Num,Num *);
                   1323: void pwrcplx(Num,Num,Num *);
                   1324: void pwrcplx0(Num,int,Num *);
                   1325: void pwrlum(int,int,LUM,int,LUM);
                   1326: void pwrmat(VL,MAT,Obj,MAT *);
                   1327: void pwrmatmain(VL,MAT,int,MAT *);
                   1328: void pwrmp(VL,int,P,Q,P *);
                   1329: void pwrmq(int,MQ,Q,MQ *);
                   1330: void pwrn(N,int,N *);
                   1331: void pwrnum(VL,Num,Num,Num *);
                   1332: void pwrp(VL,P,Q,P *);
                   1333: void pwrq(Q,Q,Q *);
                   1334: void pwrr(VL,Obj,Obj,Obj *);
                   1335: void pwrreal(Num,Num,Real *);
                   1336: void pwrmi(MQ,Q,MQ *);
                   1337: void pwrlm(LM,Q,LM *);
                   1338: void pwrum(int,UM,int,UM);
                   1339: void reallocarray(char **,int *,int *,int);
                   1340: void reductr(VL,Obj,Obj *);
                   1341: void reimtocplx(Num,Num,Num *);
                   1342: void rem2q(Q,Q,Q,Q *);
                   1343: void rema(VL,P,P,P,P *);
                   1344: void remq(Q,Q,Q *);
                   1345: void remsdcp(VL,P,P,P *);
                   1346: void reordermp(VL,int,VL,P,P *);
                   1347: void reorderp(VL,VL,P,P *);
                   1348: void reordvar(VL,V,VL *);
                   1349: void res_ch_det(VL,V,P,P,P *);
                   1350: void res_detmp(VL,int,V,P,P,P *);
                   1351: void restore(VL,P,VN,P *);
                   1352: void resultmp(VL,int,V,P,P,P *);
                   1353: void resultp(VL,V,P,P,P *);
                   1354: void setlum(int,int,LUM);
                   1355: void sort_by_deg(int,P *,P *);
                   1356: void sort_by_deg_rev(int,P *,P *);
                   1357: void sortfs(DCP *);
                   1358: void sortfsrev(DCP *);
                   1359: void sortplist(P *,int);
                   1360: void sortplistbyhomdeg(P *,int);
                   1361: void sprs(VL,V,P,P,P *);
                   1362: void sqa(VL,P,P,DCP *);
                   1363: void sqad(unsigned int,int);
                   1364: void sqfrp(VL,P,DCP *);
                   1365: void sqfrum(int,int,P,int *,struct oDUM **,ML *);
                   1366: void sqfrummain(int,UM,UM,struct oDUM **);
                   1367: void sqrtn(N,N *);
                   1368: void srch2(VL,V,P,P,P *);
                   1369: void srchmp(VL,int,V,P,P,P *);
                   1370: void srchump(int,P,P,P *);
                   1371: void srcr(VL,V,P,P,P *);
                   1372: void strtobf(char *,BF *);
                   1373: void subalg(Num,Num,Num *);
                   1374: void subbf(Num,Num,Num *);
                   1375: void subcplx(Num,Num,Num *);
                   1376: void subm2p(VL,Q,Q,P,P,P *);
                   1377: void subm2q(Q,Q,Q,Q,Q *);
                   1378: void submat(VL,MAT,MAT,MAT *);
                   1379: void submp(VL,int,P,P,P *);
                   1380: void submq(int,MQ,MQ,MQ *);
                   1381: void subnum(VL,Num,Num,Num *);
                   1382: void subp(VL,P,P,P *);
                   1383: void subq(Q,Q,Q *);
                   1384: void subr(VL,Obj,Obj,Obj *);
                   1385: void subreal(Num,Num,Real *);
                   1386: void submi(MQ,MQ,MQ *);
                   1387: void sublm(LM,LM,LM *);
                   1388: void substmp(VL,int,P,V,P,P *);
                   1389: void substp(VL,P,V,P,P *);
                   1390: void substvp(VL,P,VN,P *);
                   1391: void subum(int,UM,UM,UM);
                   1392: void subvect(VL,VECT,VECT,VECT *);
                   1393: void toreim(Num,Num *,Num *);
                   1394: void ucsump(P,Q *);
                   1395: void udivpwm(Q,P,P,P *,P *);
                   1396: void udivpz(P,P,P *,P *);
                   1397: void udivpzwm(Q,P,P,P *,P *);
                   1398: void uexgcdnp(VL,P,P *,int,VN,Q,P *,P *,P *,P *,Q *);
                   1399: void uezgcd1p(P,P,P *);
                   1400: void uezgcdpp(DCP,P,P *);
                   1401: void uezgcdpz(VL,P,P,P *);
                   1402: void ufctr(P,int,DCP *);
                   1403: void ufctrmain(P,int,DCP *);
                   1404: void umtomp(V,UM,P *);
                   1405: void umtop(V,UM,P *);
                   1406: void usqp(P,DCP *);
                   1407: void vntovl(VN,int,VL *);
                   1408:
                   1409: #if 0 && !defined(VISUAL)
                   1410: void bzero(const void *,int);
                   1411: void bcopy(const void *,void *,int);
                   1412: char *index(char *,int);
                   1413: #endif

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