[BACK]Return to minimal.k CVS log [TXT][DIR] Up to [local] / OpenXM / src / k097 / lib / minimal

Diff for /OpenXM/src/k097/lib/minimal/minimal.k between version 1.2 and 1.4

version 1.2, 2000/05/03 07:50:38 version 1.4, 2000/05/04 11:05:20
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/k097/lib/minimal/minimal.k,v 1.1 2000/05/03 06:42:07 takayama Exp $ */  /* $OpenXM: OpenXM/src/k097/lib/minimal/minimal.k,v 1.3 2000/05/04 06:55:28 takayama Exp $ */
 #define DEBUG 1  #define DEBUG 1
 /* #define ORDINARY 1 */  /* #define ORDINARY 1 */
   /* If you run this program on openxm version 1.1.2 (FreeBSD),
      make a symbolic link by the command
      ln -s /usr/bin/cpp /lib/cpp
   */
 /* Test sequences.  /* Test sequences.
    Use load["minimal.k"];;     Use load["minimal.k"];;
   
Line 367  def SnewArrayOfFormat(p) {
Line 371  def SnewArrayOfFormat(p) {
      return(null);       return(null);
   }    }
 }  }
   def ScopyArray(a) {
     local n, i,ans;
     n = Length(a);
     ans = NewArray(n);
     for (i=0; i<n; i++) {
       ans[i] = a[i];
     }
     return(ans);
   }
 def SminOfStrategy(a) {  def SminOfStrategy(a) {
   local n,i,ans,tt;    local n,i,ans,tt;
   ans = 100000; /* very big number */    ans = 100000; /* very big number */
Line 409  def SlaScala(g) {
Line 422  def SlaScala(g) {
   local rf, tower, reductionTable, skel, redundantTable, bases,    local rf, tower, reductionTable, skel, redundantTable, bases,
         strategy, maxOfStrategy, height, level, n, i,          strategy, maxOfStrategy, height, level, n, i,
         freeRes,place, f, reducer,pos, redundant_seq,bettiTable,freeResV,ww,          freeRes,place, f, reducer,pos, redundant_seq,bettiTable,freeResV,ww,
         redundantTable_ordinary, redundant_seq_ordinary;          redundantTable_ordinary, redundant_seq_ordinary,
           reductionTable_tmp;
   /* extern WeightOfSweyl; */    /* extern WeightOfSweyl; */
   ww = WeightOfSweyl;    ww = WeightOfSweyl;
   Print("WeghtOfSweyl="); Println(WeightOfSweyl);    Print("WeghtOfSweyl="); Println(WeightOfSweyl);
Line 430  def SlaScala(g) {
Line 444  def SlaScala(g) {
   while (strategy <= maxOfStrategy) {    while (strategy <= maxOfStrategy) {
     for (level = 0; level < height; level++) {      for (level = 0; level < height; level++) {
       n = Length(reductionTable[level]);        n = Length(reductionTable[level]);
       for (i=0; i<n; i++) {        reductionTable_tmp = ScopyArray(reductionTable[level]);
         while (SthereIs(reductionTable_tmp,strategy)) {
           i = SnextI(reductionTable_tmp,strategy,redundantTable,
                      skel,level,freeRes);
           Println([level,i]);
           reductionTable_tmp[i] = -200000;
         if (reductionTable[level,i] == strategy) {          if (reductionTable[level,i] == strategy) {
            Print("Processing "); Print([level,i]);             Print("Processing "); Print([level,i]);
            Print("   Strategy = "); Println(strategy);             Print("   Strategy = "); Println(strategy);
Line 503  def SlaScala(g) {
Line 522  def SlaScala(g) {
   return([freeResV, redundantTable,reducer,bettiTable,redundantTable_ordinary]);    return([freeResV, redundantTable,reducer,bettiTable,redundantTable_ordinary]);
 }  }
   
   def SthereIs(reductionTable_tmp,strategy) {
     local n,i;
     n = Length(reductionTable_tmp);
     for (i=0; i<n; i++) {
       if (reductionTable_tmp[i] == strategy) {
         return(true);
       }
     }
     return(false);
   }
   
   def SnextI(reductionTable_tmp,strategy,redundantTable,
                                     skel,level,freeRes)
   {
      local ii,n,p,myindex,i,j,bases;
      n = Length(reductionTable_tmp);
      if (level == 0) {
        for (ii=0; ii<n; ii++) {
          if (reductionTable_tmp[ii] == strategy) {
             return(ii);
           }
         }
      }else{
        for (ii=0; ii<n; ii++) {
          if (reductionTable_tmp[ii] == strategy) {
            p = skel[level,ii];
            myindex = p[0];
            i = myindex[0]; j = myindex[1];
            bases = freeRes[level-1];
            if (IsNull(bases[i]) || IsNull(bases[j])) {
   
            }else{
              return(ii);
            }
          }
        }
      }
      Println(reductionTable_tmp);
      Error("SnextI: bases[i] or bases[j] is null for all combinations.");
   }
   
   
   
 def SsetBettiTable(freeRes,g) {  def SsetBettiTable(freeRes,g) {
   local level,i, n,bases,ans;    local level,i, n,bases,ans;
   ans = NewArray(Length(freeRes)+1);    ans = NewArray(Length(freeRes)+1);
Line 638  def SpairAndReduction(skel,level,ii,freeRes,tower,ww) 
Line 700  def SpairAndReduction(skel,level,ii,freeRes,tower,ww) 
   
   Print("result is "); Println(tmp);    Print("result is "); Println(tmp);
   
   vdeg = SvDegree(si*gi+sj*gj,tower,level-1,ww);    /* This is essential part for V-minimal resolution. */
     /* vdeg = SvDegree(si*gi+sj*gj,tower,level-1,ww); */
     vdeg = SvDegree(si*gi,tower,level-1,ww);
   vdeg_reduced = SvDegree(tmp[0],tower,level-1,ww);    vdeg_reduced = SvDegree(tmp[0],tower,level-1,ww);
   Print("vdegree of the original = "); Println(vdeg);    Print("vdegree of the original = "); Println(vdeg);
   Print("vdegree of the remainder = "); Println(vdeg_reduced);    Print("vdegree of the remainder = "); Println(vdeg_reduced);
Line 823  def Sminimal(g) {
Line 887  def Sminimal(g) {
     }      }
    }     }
    return([Stetris(minRes,redundantTable),     return([Stetris(minRes,redundantTable),
           [ minRes, redundantTable, reducer,r[3],r[4]]]);            [ minRes, redundantTable, reducer,r[3],r[4]],r[0]]);
   /* r[4] is the redundantTable_ordinary */    /* r[4] is the redundantTable_ordinary */
     /* r[0] is the freeResolution */
 }  }
   
   
Line 933  In(20)=SvDegree(x,tt,2,ww):
Line 998  In(20)=SvDegree(x,tt,2,ww):
 def SvDegree(f,tower,level,w) {  def SvDegree(f,tower,level,w) {
   local i,ans;    local i,ans;
   if (IsZero(f)) return(null);    if (IsZero(f)) return(null);
     f = Init(f);
   if (level <= 0) {    if (level <= 0) {
     return(Sord_w(f,w));      return(Sord_w(f,w));
   }    }
Line 960  def Sannfs2(f) {
Line 1026  def Sannfs2(f) {
   return(Sminimal(pp));    return(Sminimal(pp));
 }  }
   
   def Sannfs3(f) {
     local p,pp;
     p = Sannfs(f,"x,y,z");
     Sweyl("x,y,z",[["x",-1,"y",-1,"z",-1,"Dx",1,"Dy",1,"Dz",1]]);
     pp = Map(p[0],"Spoly");
     return(Sminimal(pp));
   }
   
 /*  /*
   The betti numbers of most examples are 2,1. (0-th and 1-th).    The betti numbers of most examples are 2,1. (0-th and 1-th).
   a=Sannfs2("x*y*(x+y-1)"); ==> The betti numbers are 3, 2.    a=Sannfs2("x*y*(x+y-1)"); ==> The betti numbers are 3, 2.
   a=Sannfs2("x^3-y^2-x");    : it causes an error. It should be fixed.    a=Sannfs2("x^3-y^2-x");    : it causes an error. It should be fixed.
     a=Sannfs2("x*y*(x-y)");    : it causes an error. It should be fixed.
   
 */  */
   

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.4

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