| version 1.2, 2000/01/16 07:55:40 | 
version 1.4, 2004/09/13 11:24:11 | 
 | 
 | 
|  /* $OpenXM$ */ | 
 /* $OpenXM: OpenXM/src/kan96xx/Kan/poly.c,v 1.3 2001/05/04 01:06:24 takayama Exp $ */ | 
|  #include <stdio.h> | 
 #include <stdio.h> | 
|  #include "datatype.h" | 
 #include "datatype.h" | 
|  #include "stackm.h" | 
 #include "stackm.h" | 
| Line 26  void KinitKan(void) { | 
 
  | 
| Line 26  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 54  void KinitKan(void) { | 
 
  | 
| Line 54  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 64  void KinitKan(void) { | 
 
  | 
| Line 65  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 97  void sGC_free2(void *p,size_t size) | 
 
  | 
| Line 98  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 116  struct ring *ringp; | 
 
  | 
| Line 117  struct ring *ringp; | 
 
 
 | 
|   | 
  | 
|   | 
  | 
|  MONOMIAL monomialCopy(m) | 
 MONOMIAL monomialCopy(m) | 
|  MONOMIAL m; | 
      MONOMIAL m; | 
|  { | 
 { | 
|    extern int Msize; | 
   extern int Msize; | 
|    MONOMIAL f; | 
   MONOMIAL f; | 
| Line 153  MP_INT *newMP_INT() { | 
 
  | 
| Line 154  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 199  struct ring *ringp; | 
 
  | 
| Line 200  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 229  struct ring *ringp; | 
 
  | 
| Line 230  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 263  struct ring *ringp; | 
 
  | 
| Line 264  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); | 
|  } | 
 } |