| version 1.1, 1999/10/08 02:12:01 | version 1.5, 2005/07/03 11:08:54 | 
|  |  | 
|  | /* $OpenXM: OpenXM/src/kan96xx/Kan/poly.c,v 1.4 2004/09/13 11:24:11 takayama Exp $ */ | 
| #include <stdio.h> | #include <stdio.h> | 
|  | #include <stdlib.h> | 
| #include "datatype.h" | #include "datatype.h" | 
| #include "stackm.h" | #include "stackm.h" | 
| #include "extern.h" | #include "extern.h" | 
| 
| Line 25  void KinitKan(void) { |  | 
| Line 27  void KinitKan(void) { |  | 
| int i; | int i; | 
| static char *smallx[] = {"x","t"}; | static char *smallx[] = {"x","t"}; | 
| static char *smalld[] = {"h","T"}; | static char *smalld[] = {"h","T"}; | 
| /* t  x  T  h */ | /* t  x  T  h */ | 
| static int smallOrder[] = { 1, 0, 0, 0, | static int smallOrder[] = { 1, 0, 0, 0, | 
| 0, 1, 0, 0, | 0, 1, 0, 0, | 
| 0, 0, 1, 0, | 0, 0, 1, 0, | 
| 
| Line 53  void KinitKan(void) { |  | 
| Line 55  void KinitKan(void) { |  | 
| SmallRing.gbListTower = NULL; | SmallRing.gbListTower = NULL; | 
| SmallRing.outputOrder = outputOrderForSmallRing; | SmallRing.outputOrder = outputOrderForSmallRing; | 
| SmallRing.name = "SmallRingp"; | SmallRing.name = "SmallRingp"; | 
|  | SmallRing.partialEcart = 0; | 
|  |  | 
| CurrentRingp = &SmallRing; | CurrentRingp = &SmallRing; | 
| initSyzRingp(); | initSyzRingp(); | 
| 
| Line 63  void KinitKan(void) { |  | 
| Line 66  void KinitKan(void) { |  | 
|  |  | 
| #ifndef NOGC | #ifndef NOGC | 
| /* initialize MPZ */ | /* initialize MPZ */ | 
| mp_set_memory_functions(sGC_malloc,sGC_realloc2,sGC_free2); | mp_set_memory_functions(sGC_malloc,sGC_realloc2,sGC_free2); | 
| #endif | #endif | 
|  |  | 
| /* Msize is 8 on SUN gcc */ | /* Msize is 8 on SUN gcc */ | 
| 
| Line 96  void sGC_free2(void *p,size_t size) |  | 
| Line 99  void sGC_free2(void *p,size_t size) |  | 
|  |  | 
|  |  | 
| MONOMIAL newMonomial(ringp) | MONOMIAL newMonomial(ringp) | 
| struct ring *ringp; | struct ring *ringp; | 
| { | { | 
| MONOMIAL f; | MONOMIAL f; | 
| extern int Msize; | extern int Msize; | 
| 
| Line 115  struct ring *ringp; |  | 
| Line 118  struct ring *ringp; |  | 
|  |  | 
|  |  | 
| MONOMIAL monomialCopy(m) | MONOMIAL monomialCopy(m) | 
| MONOMIAL m; | MONOMIAL m; | 
| { | { | 
| extern int Msize; | extern int Msize; | 
| MONOMIAL f; | MONOMIAL f; | 
| 
| Line 152  MP_INT *newMP_INT() { |  | 
| Line 155  MP_INT *newMP_INT() { |  | 
| } | } | 
|  |  | 
| POLY newCell(c,mon) | POLY newCell(c,mon) | 
| struct coeff *c; | struct coeff *c; | 
| MONOMIAL mon; | MONOMIAL mon; | 
| { | { | 
| POLY ff; | POLY ff; | 
| ff = (POLY) sGC_malloc(sizeof(struct listPoly)); | ff = (POLY) sGC_malloc(sizeof(struct listPoly)); | 
|  |  | 
|  |  | 
| /* constructors */ | /* constructors */ | 
| POLY cxx(c,i,k,ringp) | POLY cxx(c,i,k,ringp) | 
| int c,i,k; | int c,i,k; | 
| struct ring *ringp; | struct ring *ringp; | 
| /*  c x_i^k where p is the characteristic. */ | /*  c x_i^k where p is the characteristic. */ | 
| /* New cell, monomial and coeff. */ | /* New cell, monomial and coeff. */ | 
| { | { | 
| POLY f; | POLY f; | 
| int p; | int p; | 
| 
| Line 198  struct ring *ringp; |  | 
| Line 201  struct ring *ringp; |  | 
| } | } | 
|  |  | 
| POLY bxx(c,i,k,ringp) | POLY bxx(c,i,k,ringp) | 
| MP_INT *c; | MP_INT *c; | 
| int i,k; | int i,k; | 
| struct ring *ringp; | struct ring *ringp; | 
| /*  c x_i^k.  c is not copied. */ | /*  c x_i^k.  c is not copied. */ | 
| { | { | 
| /* new cell, monomial, coeff. MP_INT c is not copied. */ | /* new cell, monomial, coeff. MP_INT c is not copied. */ | 
| POLY f; | POLY f; | 
| int p; | int p; | 
| p = ringp->p; | p = ringp->p; | 
| 
| Line 228  struct ring *ringp; |  | 
| Line 231  struct ring *ringp; |  | 
| } | } | 
|  |  | 
| POLY cdd(c,i,k,ringp) | POLY cdd(c,i,k,ringp) | 
| int c,i,k; | int c,i,k; | 
| struct ring *ringp; | struct ring *ringp; | 
| /*  c D_i^k where p is the characteristic. */ | /*  c D_i^k where p is the characteristic. */ | 
| /* New cell, monomial and coeff. */ | /* New cell, monomial and coeff. */ | 
| { | { | 
| POLY f; | POLY f; | 
| int p; | int p; | 
| 
| Line 262  struct ring *ringp; |  | 
| Line 265  struct ring *ringp; |  | 
|  |  | 
|  |  | 
| POLY pCopy(f) | POLY pCopy(f) | 
| POLY f; | POLY f; | 
| { | { | 
| POLY node; | POLY node; | 
| struct listPoly nod; | struct listPoly nod; | 
|  |  | 
| } | } | 
|  |  | 
| POLY pcCopy(f) | POLY pcCopy(f) | 
| POLY f; | POLY f; | 
| { | { | 
|  |  | 
| POLY node; | POLY node; | 
|  |  | 
| } | } | 
|  |  | 
| POLY pmCopy(f) | POLY pmCopy(f) | 
| POLY f; | POLY f; | 
| { | { | 
| POLY node; | POLY node; | 
| struct listPoly nod; | struct listPoly nod; | 
|  |  | 
| } | } | 
|  |  | 
| POLY pcmCopy(f) | POLY pcmCopy(f) | 
| POLY f; | POLY f; | 
| { | { | 
| POLY node; | POLY node; | 
| struct listPoly nod; | struct listPoly nod; | 
|  |  | 
| } | } | 
|  |  | 
| POLY head(f) | POLY head(f) | 
| POLY f; | POLY f; | 
| { | { | 
| if (f == ZERO) return(f); | if (f == ZERO) return(f); | 
| else { | else { | 
|  |  | 
| } | } | 
|  |  | 
| void errorPoly(str) | void errorPoly(str) | 
| char *str; | char *str; | 
| { | { | 
| fprintf(stderr,"Error(poly.c): %s\n",str); | fprintf(stderr,"Error(poly.c): %s\n",str); | 
| exit(20); | exit(20); | 
| } | } | 
|  |  | 
| void warningPoly(str) | void warningPoly(str) | 
| char *str; | char *str; | 
| { | { | 
| fprintf(stderr,"Warning(poly.c): %s\n",str); | fprintf(stderr,"Warning(poly.c): %s\n",str); | 
| } | } |