[BACK]Return to test.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Kan

File: [local] / OpenXM / src / kan96xx / Kan / test.c (download)

Revision 1.3, Thu Jun 16 05:07:23 2005 UTC (18 years, 11 months ago) by takayama
Branch: MAIN
CVS Tags: R_1_3_1-2, RELEASE_1_3_1_13b, RELEASE_1_2_3_12, KNOPPIX_2006, HEAD, DEB_REL_1_2_3-9
Changes since 1.2: +3 -3 lines

The initialization of the variables of the type struct object
are added.  It is necessary to initialize the field "attr"
(object attribute) of stuct object.  cf. misc-2005/06/gfan/opt.sm1 test2.

/* $OpenXM: OpenXM/src/kan96xx/Kan/test.c,v 1.3 2005/06/16 05:07:23 takayama Exp $ */
struct object test2(ob)  /* test2 */
struct object ob;
{
  struct object rob = OINIT;
  int k;
  static POLY f0;
  static POLY f1;
  
  POLY addNode;
  POLY f;
  int i;
  static int s=0;
  extern struct ring *SmallRingp;
  extern struct ring *CurrentRingp;
  addNode = pMalloc(SmallRingp);
  k = ob.lc.ival;
  switch(s) {
  case 0:
    f0 = addNode;
    for (i=0; i<=k; i++) {
      f0->next = cxx(iiComb(k,i,CurrentRingp->p),0,i,CurrentRingp);
      f0 = f0->next;
    }
    f0 = addNode->next;
    s++;
    rob.lc.poly = f0;
    break;
  case 1:
    f1 = addNode;
    for (i=0; i<=k; i++) {
      f1->next = bxx(BiiComb(k,i),0,i,SmallRingp);
      f1 = f1->next;
    }
    f1 = addNode->next;
    s = 0;
    rob.lc.poly = f1;
    break;
  default:
    rob.lc.poly = POLYNULL;
    s = 0;
    break;
  }

    
  rob.tag = Spoly;
  return(rob);
}

struct object test1(ob)
struct object ob;
{
  struct object rob = OINIT;
  int k;
  static POLY f0;
  static POLY f1;
  /* It will dump the core 
  POLY f0; or = 1;
  POLY f1;
  */
  
  POLY addNode;
  POLY f;
  int i;
  static int s=0;
  extern struct ring *SmallRingp;
  extern struct ring *CurrentRingp;
  addNode = pMalloc(SmallRingp);
  k = ob.lc.ival;
  switch(s) {
  case 0:
    f0 = addNode;
    for (i=0; i<k; i++) {
      f0->next = cxx(i+1,0,i,CurrentRingp);
      f0 = f0->next;
    }
    f0 = addNode->next;
    s++;
    rob.lc.poly = f0;
    break;
  case 1:
    f1 = addNode;
    for (i=k-1; i>=0; i--) {
      f1->next = cxx(-i-1,0,-i,CurrentRingp);
      f1 = f1->next;
    }
    f1 = addNode->next;
    s++;
    rob.lc.poly = f1;
    break;
  default:
    f = addNode;
    f->next = cxx(1,0,1,SmallRingp);
    f = f->next;
    f->coeffp->tag = POLY_COEFF;
    f->coeffp->val.f = f0;
    f->next = cxx(1,0,2,SmallRingp);
    f = f->next;
    f->coeffp->tag = POLY_COEFF;
    f->coeffp->val.f = f1;
    rob.lc.poly = addNode->next;
    s = 0;
    break;
  }

    
  rob.tag = Spoly;
  return(rob);
}