Changeset 11d9d00 in git


Ignore:
Timestamp:
Dec 15, 2014, 1:19:16 AM (9 years ago)
Author:
Stephan Oberfranz <oberfran@…>
Branches:
(u'spielwiese', 'd0474371d8c5d8068ab70bfb42719c97936b18a6')
Children:
4083faab6546fc5c3396c90683e190ab3b4d1327
Parents:
8af63a71de0015f0413204e1a7a8620a8d37cc7a350269c461fd0afbb2c4d79cc7d38d2793207b12
Message:
---

Merge branch 'spielwiese' of github.com:Singular/Sources into spielwiese
Files:
3 added
36 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/grwalk.lib

    r350269 r11d9d00  
    255255}
    256256
    257 proc gwalk(ideal Go, list #)
    258 "SYNTAX: gwalk(ideal i);
    259          gwalk(ideal i, intvec v, intvec w);
     257proc gwalk(ideal Go, int reduction,int printout, list #)
     258"SYNTAX: gwalk(ideal i, int reduction, int printout);
     259         gwalk(ideal i, int reduction, int printout, intvec v, intvec w);
    260260TYPE:    ideal
    261261PURPOSE: compute the standard basis of the ideal, calculated via
     
    284284   //print("//** help ring = " + string(basering));
    285285   ideal G = fetch(xR, Go);
    286    G = system("Mwalk", G, curr_weight, target_weight,basering);
     286   G = system("Mwalk", G, curr_weight, target_weight,basering,reduction,printout);
    287287
    288288   setring xR;
     
    300300  ring r = 32003,(z,y,x), lp;
    301301  ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z;
    302   gwalk(I);
     302  gwalk(I,0,1);
    303303}
    304304
     
    346346}
    347347
    348 proc fwalk(ideal Go, list #)
    349 "SYNTAX: fwalk(ideal i);
    350          fwalk(ideal i, intvec v, intvec w);
     348proc fwalk(ideal Go, int reduction, int printout, list #)
     349"SYNTAX: fwalk(ideal i,int reductioin);
     350         fwalk(ideal i, int reduction intvec v, intvec w);
    351351TYPE:    ideal
    352352PURPOSE: compute the standard basis of the ideal w.r.t. the
     
    372372
    373373   ideal G = fetch(xR, Go);
    374    G = system("Mfwalk", G, curr_weight, target_weight);
     374   G = system("Mfwalk", G, curr_weight, target_weight, reduction, printout);
    375375
    376376   setring xR;
     
    387387    ring r = 32003,(z,y,x), lp;
    388388    ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z;
    389     fwalk(I);
     389    int reduction = 1;
     390    int printout = 1;
     391    fwalk(I,reduction,printout);
    390392}
    391393
     
    437439}
    438440
    439 proc pwalk(ideal Go, int n1, int n2, list #)
    440 "SYNTAX: pwalk(int d, ideal i, int n1, int n2);
    441          pwalk(int d, ideal i, int n1, int n2, intvec v, intvec w);
     441proc pwalk(ideal Go, int n1, int n2, int reduction, int printout, list #)
     442"SYNTAX: pwalk(int d, ideal i, int n1, int n2, int reduction, int printout);
     443         pwalk(int d, ideal i, int n1, int n2, int reduction, int printout, intvec v, intvec w);
    442444TYPE:    ideal
    443445PURPOSE: compute the standard basis of the ideal, calculated via
     
    477479  ideal G = fetch(xR, Go);
    478480
    479   G = system("Mpwalk", G, n1, n2, curr_weight, target_weight,nP);
     481  G = system("Mpwalk",G,n1,n2,curr_weight,target_weight,nP,reduction,printout);
    480482 
    481483  setring xR;
     
    492494    ring r = 32003,(z,y,x), lp;
    493495    ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z;
    494     //I = std(I);
    495     //ring rr = 32003,(z,y,x),lp;
    496     //ideal I = fetch(r,I);
    497     pwalk(I,2,2);
     496    int reduction = 1;
     497    int printout = 2;
     498    pwalk(I,2,2,reduction,printout);
    498499}
    499500
  • Singular/LIB/hess.lib

    r8af63a r11d9d00  
    17991799
    18001800        ring r_ext=(char(basering),@a),(x,y,z),lp;
     1801        poly aux=imap(base_r,aux);
     1802        minpoly=number(subst(aux,x,@a));
    18011803        poly F=imap(r_auxz,F);
    18021804        poly f_xz=subst(F,y,1);
    1803         poly aux=imap(base_r,aux);
    1804         minpoly=number(subst(aux,x,@a));
    18051805        map phi=r_ext,x+@a,0,z;
    18061806        poly f_origin=phi(f_xz);
  • Singular/LIB/modwalk.lib

    • Property mode changed from 100644 to 100755
    r350269 r11d9d00  
    1616
    1717PROCEDURES:
     18modpWalk(ideal,int,int,int[,int,int,int,int])    standard basis conversion of I in prime characteristic
    1819modWalk(ideal,int,int[,int,int,int,int]);        standard basis conversion of I using modular methods (chinese remainder)
    1920";
     
    2930////////////////////////////////////////////////////////////////////////////////
    3031
    31 static proc modpWalk(def II, int p, int variant, list #)
     32proc modpWalk(def II, int p, int variant, int reduction, list #)
    3233"USAGE:  modpWalk(I,p,#); I ideal, p integer, variant integer
    3334ASSUME:  If size(#) > 0, then
     
    8081    }
    8182  }
    82 
    83 //-------------------------  make i homogeneous  -----------------------------
    84   if(!mixedTest() && !h)
    85   {
    86     if(!((find(ordstr_R0, "M") > 0) || (find(ordstr_R0, "a") > 0) || neg))
    87     {
    88       if(!((order == "simple") || (sizerl > 4)))
    89       {
    90         list rl@r = ringlist(@r);
    91         nvar@r = nvars(@r);     
    92         intvec w;
    93         for(k = 1; k <= nvar@r; k++)
    94         {
    95           w[k] = deg(var(k));
    96         }
    97         w[nvar@r + 1] = 1;
    98         rl@r[2][nvar@r + 1] = "homvar";
    99         rl@r[3][2][2] = w;
    100         def HomR = ring(rl@r);
    101         setring HomR;
    102         ideal i = imap(@r, i);
    103         i = homog(i, homvar);
    104       }
    105     }
    106   }
    107 
    10883//-------------------------  compute a standard basis mod p  -----------------------------
    109 
    11084  if(variant == 1)
    11185  {
    11286    if(size(#)>0)
    11387    {
    114       i = rwalk(i,radius,pert_deg,#);
    115      // rwalk(i,radius,pert_deg,#); std(i);
    116     }
    117     else
    118     {
    119       i = rwalk(i,radius,pert_deg);
     88      i = rwalk(i,radius,pert_deg,reduction,#);
     89    }
     90    else
     91    {
     92      i = rwalk(i,radius,pert_deg,reduction);
    12093    }
    12194  }
     
    12497    if(size(#) == 2)
    12598    {
    126       i = gwalk(i,#);
    127     }
    128     else
    129     {
    130       i = gwalk(i);
     99      i = gwalk(i,reduction,#);
     100    }
     101    else
     102    {
     103      i = gwalk(i,reduction);
    131104    }
    132105  }
     
    135108    if(size(#) == 2)
    136109    {
    137       i = frandwalk(i,radius,#);
    138     }
    139     else
    140     {
    141       i = frandwalk(i,radius);
     110      i = frandwalk(i,radius,reduction,#);
     111    }
     112    else
     113    {
     114      i = frandwalk(i,radius,reduction);
    142115    }
    143116  }
     
    157130    if(size(#) == 2)
    158131    {
    159      i=prwalk(i,radius,pert_deg,pert_deg,#);
    160     }
    161     else
    162     {
    163       i=prwalk(i,radius,pert_deg,pert_deg);
     132     i=prwalk(i,radius,pert_deg,pert_deg,reduction,#);
     133    }
     134    else
     135    {
     136      i=prwalk(i,radius,pert_deg,pert_deg,reduction);
    164137    }
    165138  }
     
    168141    if(size(#) == 2)
    169142    {
    170       i=pwalk(i,pert_deg,pert_deg,#);
    171     }
    172     else
    173     {
    174       i=pwalk(i,pert_deg,pert_deg);
    175     }
    176   }
    177  
    178   if(!mixedTest() && !h)
    179   {
    180     if(!((find(ordstr_R0, "M") > 0) || (find(ordstr_R0, "a") > 0) || neg))
    181     {
    182       if(!((order == "simple") || (sizerl > 4)))
    183       {
    184         i = subst(i, homvar, 1);
    185         i = simplify(i, 34);
    186         setring @r;
    187         i = imap(HomR, i);
    188         i = interred(i);
    189         kill HomR;
    190       }
    191     }
    192   }
     143      i=pwalk(i,pert_deg,pert_deg,reduction,#);
     144    }
     145    else
     146    {
     147      i=pwalk(i,pert_deg,pert_deg,reduction);
     148    }
     149  }
     150
    193151  setring R0;
    194152  return(list(fetch(@r,i),p));
     
    204162  ring ra = 0,x(1..4),(a(a),lp);
    205163  ideal I = std(cyclic(4));
     164  int reduction = 1;
    206165  ring rb = 0,x(1..4),(a(b),lp);
    207166  ideal I = imap(ra,I);
    208   modpWalk(I,p,1,a,b);
     167  modpWalk(I,p,1,reduction,a,b);
    209168  std(I);
    210169}
     
    212171////////////////////////////////////////////////////////////////////////////////
    213172
    214 proc modWalk(def II, int variant, list #)
     173proc modWalk(def II, int variant, int reduction, list #)
    215174"USAGE:  modWalk(II); II ideal or list(ideal,int)
    216175ASSUME:  If variant =
     
    487446  if(n2 > 4)
    488447  {
    489   //  L[5] = prime(random(an,en));
     448    L[5] = prime(random(an,en));
    490449  }
    491450  if(printlevel >= 10)
     
    504463    for(i=1; i<=size(L); i++)
    505464    {
    506       Arguments[i] = list(II,L[i],variant,list(curr_weight,target_weight));
     465      Arguments[i] = list(II,L[i],variant,reduction,list(curr_weight,target_weight));
    507466    }
    508467  }
     
    511470    for(i=1; i<=size(L); i++)
    512471    {
    513       Arguments[i] = list(II,L[i],variant);
     472      Arguments[i] = list(II,L[i],variant,reduction);
    514473    }
    515474  }
     
    528487//-------------------  Now all leading ideals are the same  --------------------
    529488//-------------------  Lift results to basering via farey  ---------------------
    530 
    531489    tt = timer; rt = rtimer;
    532490    N = T2[1];
     
    545503
    546504//----------------  Test if we already have a standard basis of I --------------
    547 
    548505    tt = timer; rt = rtimer;
    549     pTest = pTestSB(I,J,L,variant);
    550     //pTest = primeTestSB(I,J,L,variant);
     506    pTest = primeTest(J, prime(random(1000000000,2134567879)));
    551507    if(printlevel >= 10)
    552508    {
     
    596552    }
    597553//--------------  We do not already have a standard basis of I, therefore do the main computation for more primes  --------------
    598 
    599554    T1 = H;
    600555    T2 = N;
     
    613568      for(i=j; i<=size(L); i++)
    614569      {
    615         //Arguments[i-j+1] = list(II,L[i],variant,list(curr_weight,target_weight));
    616         Arguments[size(Arguments)+1] = list(II,L[i],variant,list(curr_weight,target_weight));
     570        Arguments[size(Arguments)+1] = list(II,L[i],variant,reduction,list(curr_weight,target_weight));
    617571      }
    618572    }
     
    621575      for(i=j; i<=size(L); i++)
    622576      {
    623         //Arguments[i-j+1] = list(II,L[i],variant);
    624         Arguments[size(Arguments)+1] = list(II,L[i],variant);
     577        Arguments[size(Arguments)+1] = list(II,L[i],variant,reduction);
    625578      }
    626579    }
     
    632585    for(i=1; i<=size(PP); i++)
    633586    {
    634       //P[size(P) + 1] = PP[i];
    635587      T1[size(T1) + 1] = PP[i][1];
    636588      T2[size(T2) + 1] = bigint(PP[i][2]);
     
    649601  echo = 2;
    650602  ring R=0,(x,y,z),lp;
    651   ideal I=-x+y2z-z,xz+1,x2+y2-1;
    652   // I is a standard basis in dp
    653   ideal J = modWalk(I,1);
     603  ideal I= y3+xyz+y2z+xz3, 3+xy+x2y+y2z;
     604  int reduction = 0;
     605  ideal J = modWalk(I,1,1);
    654606  J;
    655607}
     
    772724  return(J);
    773725}
    774 //////////////////////////////////////////////////////////////////////////////////
    775 static proc primeTestSB(def II, ideal J, list L, int variant, list #)
    776 "USAGE:  primeTestSB(I,J,L,variant,#); I,J ideals, L intvec of primes, variant int
    777 RETURN:  1 (resp. 0) if for a randomly chosen prime p that is not in L
    778          J mod p is (resp. is not) a standard basis of I mod p
    779 EXAMPLE: example primeTestSB; shows an example
    780 "
    781 {
    782 if(typeof(II) == "ideal")
    783   {
    784   ideal I = II;
    785   int radius = 2;
    786   }
    787 if(typeof(II) == "list")
    788   {
    789   ideal I = II[1];
    790   int radius = II[2];
    791   }
    792 
    793 int i,j,k,p;
    794 def R = basering;
    795 list r = ringlist(R);
    796 
    797 while(!j)
    798   {
    799   j = 1;
    800   p = prime(random(1000000000,2134567879));
    801   for(i = 1; i <= size(L); i++)
    802     {
    803     if(p == L[i])
    804       {
    805       j = 0;
    806       break;
    807       }
    808     }
    809   if(j)
    810     {
    811     for(i = 1; i <= ncols(I); i++)
    812       {
    813       for(k = 2; k <= size(I[i]); k++)
    814         {
    815         if((denominator(leadcoef(I[i][k])) mod p) == 0)
    816           {
    817           j = 0;
    818           break;
    819           }
    820         }
    821       if(!j)
    822         {
    823         break;
    824         }
    825       }
    826     }
    827   if(j)
    828     {
    829     if(!primeTest(I,p))
    830       {
    831       j = 0;
    832       }
    833     }
    834   }
    835 r[1] = p;
    836 def @R = ring(r);
    837 setring @R;
    838 ideal I = imap(R,I);
    839 ideal J = imap(R,J);
    840 attrib(J,"isSB",1);
    841 
    842 int t = timer;
    843 j = 1;
    844 if(isIncluded(I,J) == 0)
    845   {
    846   j = 0;
    847   }
    848 if(printlevel >= 11)
    849   {
    850   "isIncluded(I,J) takes "+string(timer - t)+" seconds";
    851   "j = "+string(j);
    852   }
    853 t = timer;
    854 if(j)
    855   {
    856   if(size(#) > 0)
    857     {
    858     ideal K = modpWalk(I,p,variant,#)[1];
    859     }
    860   else
    861     {
    862     ideal K = modpWalk(I,p,variant)[1];
    863     }
    864   t = timer;
    865   if(isIncluded(J,K) == 0)
    866     {
    867     j = 0;
    868     }
    869   if(printlevel >= 11)
    870     {
    871     "isIncluded(K,J) takes "+string(timer - t)+" seconds";
    872     "j = "+string(j);
    873     }
    874   }
    875 setring R;
    876 
    877 return(j);
    878 }
    879 example
    880 { "EXAMPLE:"; echo = 2;
    881    intvec L = 2,3,5;
    882    ring r = 0,(x,y,z),lp;
    883    ideal I = x+1,x+y+1;
    884    ideal J = x+1,y;
    885    primeTestSB(I,I,L,1);
    886    primeTestSB(I,J,L,1);
    887 }
    888 
    889 ////////////////////////////////////////////////////////////////////////////////
    890 static proc pTestSB(ideal I, ideal J, list L, int variant, list #)
    891 "USAGE:  pTestSB(I,J,L,variant,#); I,J ideals, L intvec of primes, variant int
    892 RETURN:  1 (resp. 0) if for a randomly chosen prime p that is not in L
    893          J mod p is (resp. is not) a standard basis of I mod p
    894 EXAMPLE: example pTestSB; shows an example
    895 "
    896 {
    897    int i,j,k,p;
    898    def R = basering;
    899    list r = ringlist(R);
    900 
    901    while(!j)
    902    {
    903       j = 1;
    904       p = prime(random(1000000000,2134567879));
    905       for(i = 1; i <= size(L); i++)
    906       {
    907          if(p == L[i]) { j = 0; break; }
    908       }
    909       if(j)
    910       {
    911          for(i = 1; i <= ncols(I); i++)
    912          {
    913             for(k = 2; k <= size(I[i]); k++)
    914             {
    915                if((denominator(leadcoef(I[i][k])) mod p) == 0) { j = 0; break; }
    916             }
    917             if(!j){ break; }
    918          }
    919       }
    920       if(j)
    921       {
    922          if(!primeTest(I,p)) { j = 0; }
    923       }
    924    }
    925    r[1] = p;
    926    def @R = ring(r);
    927    setring @R;
    928    ideal I = imap(R,I);
    929    ideal J = imap(R,J);
    930    attrib(J,"isSB",1);
    931 
    932    int t = timer;
    933    j = 1;
    934    if(isIncluded(I,J) == 0) { j = 0; }
    935 
    936    if(printlevel >= 11)
    937    {
    938       "isIncluded(I,J) takes "+string(timer - t)+" seconds";
    939       "j = "+string(j);
    940    }
    941 
    942    t = timer;
    943    if(j)
    944    {
    945       if(size(#) > 0)
    946       {
    947          ideal K = modpStd(I,p,variant,#[1])[1];
    948       }
    949       else
    950       {
    951          ideal K = groebner(I);
    952       }
    953       t = timer;
    954       if(isIncluded(J,K) == 0) { j = 0; }
    955 
    956       if(printlevel >= 11)
    957       {
    958          "isIncluded(J,K) takes "+string(timer - t)+" seconds";
    959          "j = "+string(j);
    960       }
    961    }
    962    setring R;
    963    return(j);
    964 }
    965 example
    966 { "EXAMPLE:"; echo = 2;
    967    intvec L = 2,3,5;
    968    ring r = 0,(x,y,z),dp;
    969    ideal I = x+1,x+y+1;
    970    ideal J = x+1,y;
    971    pTestSB(I,I,L,2);
    972    pTestSB(I,J,L,2);
    973 }
     726
    974727////////////////////////////////////////////////////////////////////////////////
    975728static proc mixedTest()
  • Singular/LIB/normal.lib

    r8af63a r11d9d00  
    11//////////////////////////////////////////////////////////////////////////////
    2 version="version normal.lib 4.0.0.0 Jun_2013 "; // $Id$
     2version="version normal.lib 4.0.1.1 Dec_2014 "; // $Id$
    33category="Commutative Algebra";
    44info="
     
    23292329         execute("ring Rhelp=("+charstr(R0)+"),(@s),dp;");
    23302330      }
    2331       execute("minpoly = "+smp+";");
     2331      if (smp!="0")
     2332      { execute("minpoly = "+smp+";");}
    23322333      def newR=R+Rhelp;
    23332334      setring newR;
  • Singular/LIB/primdec.lib

    r8af63a r11d9d00  
    26852685   }
    26862686//---Ende Provisorium
    2687    string mp="poly p="+string(minpoly)+";";
     2687   string mp="poly @p="+string(minpoly)+";";
    26882688   string gnir="ring RH="+string(char(R))+",("+varstr(R)+","+string(par(1))
    26892689                +"),dp;";
     
    26972697     if(i[j]!=I[j]){break;}
    26982698   }
    2699    if((j>ncols(i))&&(deg(p)==1))
     2699   if((j>ncols(i))&&(deg(@p)==1))
    27002700   {
    27012701     setring R;
     
    27092709   else
    27102710   {
    2711       i=i,p;
     2711      i=i,@p;
    27122712   }
    27132713   list pr;
     
    27262726      pr=minAssPrimes(i);
    27272727   }
     2728
    27282729   if(n<nvars(basering))
    27292730   {
     
    27472748      list pr=imap(RH,pr);
    27482749   }
     2750
    27492751   list re;
    27502752   if(w==2)
     
    28282830  }
    28292831  homo=homog(i);
    2830   if(homo==1)
     2832  if(homo)
    28312833  {
    28322834    if(attrib(i,"isSB")!=1)
     
    41744176//
    41754177///////////////////////////////////////////////////////////////////////////////
    4176 
    41774178static proc simplifyIdeal(ideal i)
    41784179{
    41794180  ASSUME(1, hasFieldCoefficient(basering) );
    4180   ASSUME(1, not isQuotientRing(basering) ) ;
    41814181  ASSUME(1, hasGlobalOrdering(basering) ) ;
    41824182
    41834183  def r=basering;
     4184
     4185  ideal iwork=i;
     4186  ideal imap2=maxideal(1);
    41844187
    41854188  int j,k;
    41864189  map phi;
    41874190  poly p;
    4188 
    4189   ideal iwork=i;
    41904191  ideal imap1=maxideal(1);
    4191   ideal imap2=maxideal(1);
    4192 
    4193 
    4194   for(j=1;j<=nvars(basering);j++)
    4195   {
    4196     for(k=1;k<=size(i);k++)
     4192  // first try: very simple substitutions
     4193  intvec tested=0:nvars(r);
     4194  for(j=1;j<=nvars(r);j++)
     4195  {
     4196    for(k=1;k<=ncols(i);k++)
    41974197    {
    41984198      if(deg(iwork[k]/var(j))==0)
    41994199      {
    42004200        p=-1/leadcoef(iwork[k]/var(j))*iwork[k];
    4201         imap1[j]=p+2*var(j);
    4202         phi=r,imap1;
    4203         iwork=phi(iwork);
    4204         iwork=subst(iwork,var(j),0);
    4205         iwork[k]=var(j);
    4206         imap1=maxideal(1);
    4207         imap2[j]=-p;
    4208         break;
     4201        if(size(p)<=2)
     4202        {
     4203          tested[j]=1;
     4204          imap1[j]=p+2*var(j);
     4205          phi=r,imap1;
     4206          iwork=phi(iwork);
     4207          iwork=subst(iwork,var(j),0);
     4208          iwork[k]=var(j);
     4209          imap1=maxideal(1);
     4210          imap2[j]=-p;
     4211          break;
     4212        }
     4213      }
     4214    }
     4215  }
     4216  // second try: substitutions not so simple
     4217  for(j=1;j<=nvars(r);j++)
     4218  {
     4219    if (tested[j]==0)
     4220    {
     4221      for(k=1;k<=ncols(i);k++)
     4222      {
     4223        if(deg(iwork[k]/var(j))==0)
     4224        {
     4225          p=-1/leadcoef(iwork[k]/var(j))*iwork[k];
     4226          imap1[j]=p+2*var(j);
     4227          phi=r,imap1;
     4228          iwork=phi(iwork);
     4229          iwork=subst(iwork,var(j),0);
     4230          iwork[k]=var(j);
     4231          imap1=maxideal(1);
     4232          imap2[j]=-p;
     4233          break;
     4234        }
    42094235      }
    42104236    }
     
    58635889  ASSUME(0, not isQuotientRing(basering) ) ;
    58645890  dbprint(printlevel - voice, "Radical, version 2006.05.08");
     5891  if(size(i) == 0){return(ideal(0));}
    58655892  if(attrib(basering,"global")!=1)
    58665893  {
     
    58775904      return(j);
    58785905  }
    5879   if(size(i) == 0){return(ideal(0));}
    58805906  int j;
    58815907  def P0 = basering;
  • Singular/LIB/rwalk.lib

    • Property mode changed from 100644 to 100755
    r350269 r11d9d00  
    1010rwalk(ideal,int,int[,intvec,intvec]);   standard basis of ideal via Random Walk algorithm
    1111rwalk(ideal,int[,intvec,intvec]);       standard basis of ideal via Random Perturbation Walk algorithm
    12 frwalk(ideal,int[,intvec,intvec]);      standard basis of ideal via Random Fractal Walk algorithm
     12frandwalk(ideal,int[,intvec,intvec]);      standard basis of ideal via Random Fractal Walk algorithm
    1313";
    1414
     
    141141 * Random Walk  *
    142142 ****************/
    143 proc rwalk(ideal Go, int radius, int pert_deg, list #)
     143proc rwalk(ideal Go, int radius, int pert_deg, int reduction, int printout, list #)
    144144"SYNTAX: rwalk(ideal i, int radius);
    145145         if size(#)>0 then rwalk(ideal i, int radius, intvec v, intvec w);
     146         intermediate Groebner bases are not reduced if reduction = 0
    146147TYPE:    ideal
    147148PURPOSE: compute the standard basis of the ideal, calculated via
     
    178179
    179180ideal G = fetch(xR, Go);
    180 G = system("Mrwalk", G, curr_weight, target_weight, radius, pert_deg, basering);
     181G = system("Mrwalk", G, curr_weight, target_weight, radius, pert_deg, reduction, printout);
    181182
    182183setring xR;
     
    196197  int radius = 1;
    197198  int perturb_deg = 2;
    198   rwalk(I,radius,perturb_deg);
     199  int reduction = 0;
     200  int printout = 1;
     201  rwalk(I,radius,perturb_deg,reduction,printout);
    199202}
    200203
     
    202205 * Perturbation Walk with random element *
    203206 *****************************************/
    204 proc prwalk(ideal Go, int radius, int o_pert_deg, int t_pert_deg, list #)
     207proc prwalk(ideal Go, int radius, int o_pert_deg, int t_pert_deg, int reduction, int printout, list #)
    205208"SYNTAX: rwalk(ideal i, int radius);
    206209         if size(#)>0 then rwalk(ideal i, int radius, intvec v, intvec w);
     
    227230  OSCTW= OrderStringalp_NP("al", #);
    228231  }
     232int nP = OSCTW[1];
    229233string ord_str = OSCTW[2];
    230234intvec curr_weight = OSCTW[3]; // original weight vector
     
    238242
    239243ideal G = fetch(xR, Go);
    240 G = system("Mprwalk", G, curr_weight, target_weight, radius, o_pert_deg, t_pert_deg, basering);
     244G = system("Mprwalk", G, curr_weight, target_weight, radius, o_pert_deg, t_pert_deg,
     245           nP, reduction, printout);
    241246
    242247setring xR;
     
    257262  int o_perturb_deg = 2;
    258263  int t_perturb_deg = 2;
    259   prwalk(I,radius,o_perturb_deg,t_perturb_deg);
     264  int reduction = 0;
     265  int printout = 2;
     266  prwalk(I,radius,o_perturb_deg,t_perturb_deg,reduction,printout);
    260267}
    261268
     
    263270 * Fractal Walk with random element *
    264271 ************************************/
    265 proc frandwalk(ideal Go, int radius, list #)
    266 "SYNTAX: frwalk(ideal i, int radius);
    267          frwalk(ideal i, int radius, intvec v, intvec w);
     272proc frandwalk(ideal Go, int radius, int reduction, int printout, list #)
     273"SYNTAX: frwalk(ideal i, int radius, int reduction, int printout);
     274         frwalk(ideal i, int radius, int reduction, int printout, intvec v, intvec w);
    268275TYPE:    ideal
    269276PURPOSE: compute the standard basis of the ideal, calculated via
     
    299306   ideal G = fetch(xR, Go);
    300307   int pert_deg = 2;
    301    G = system("Mfrwalk", G, curr_weight, target_weight, radius);
     308
     309   G = system("Mfrwalk", G, curr_weight, target_weight, radius, reduction, printout);
    302310
    303311   setring xR;
     
    314322    ring r = 0,(z,y,x), lp;
    315323    ideal I = y3+xyz+y2z+xz3, 3+xy+x2y+y2z;
    316     frandwalk(I,2);
    317 }
     324    int reduction = 0;
     325    frandwalk(I,2,0,1);
     326}
  • Singular/LIB/schreyer.lib

    r8af63a r11d9d00  
    4949";
    5050
    51 
    5251static proc prepareSyz( module I, list # )
    5352{
     
    7978  }
    8079
    81 //  DetailedPrint(I);
     80//   Syzextra::DetailedPrint(I);
    8281
    8382  return(I);
     
    9392  {
    9493    v = J[i];
    95     if( leadcomp(v) > c )
     94    if(   Syzextra::leadcomp(v) > c )
    9695    {
    9796      II[i] = v;
     
    118117    vv = 0;
    119118   
    120     while( leadcomp(v) <= c )
     119    while(   Syzextra::leadcomp(v) <= c )
    121120    {
    122121      vv = vv + lead(v);
     
    144143    "Sinit::Input";
    145144    type(M);
    146 //    DetailedPrint(M);
     145//      Syzextra::DetailedPrint(M);
    147146    attrib(M);
    148147  }
     
    157156  }
    158157
    159   def S = MakeInducedSchreyerOrdering(1); // 1 puts history terms to the back
     158  def S =   Syzextra::MakeInducedSchreyerOrdering(1); // 1 puts history terms to the back
    160159  // TODO: NOTE: +1 causes trouble to Singular interpreter!!!???
    161160  setring S; // a new ring with a Schreyer ordering
     
    165164    "Sinit::StartingISRing";
    166165    basering;
    167 //    DetailedPrint(basering);
     166//      Syzextra::DetailedPrint(basering);
    168167  }
    169168
     
    190189    attrib(M);
    191190    attrib(M, "isHomog");
    192 //    DetailedPrint(M);
     191//      Syzextra::DetailedPrint(M);
    193192  }
    194193
     
    200199      transpose( transpose(M) * transpose(MRES) );
    201200      "ERROR: transpose( transpose(M) * transpose(MRES) ) != 0!!!";
    202       m2_end(666);
     201        Syzextra::m2_end(666);
    203202    }
    204203  }
     
    215214  {
    216215    "Sinit::MRES";
    217     DetailedPrint(MRES);
     216      Syzextra::DetailedPrint(MRES);
    218217    attrib(MRES, "isHomog");
    219218    attrib(S);
     
    232231  {
    233232    "Sstep::NextInducedRing";
    234     DetailedPrint(basering);
     233      Syzextra::DetailedPrint(basering);
    235234
    236235    attrib(basering, "InducionLeads");
    237236    attrib(basering, "InducionStart");
    238237
    239     GetInducedData();
     238      Syzextra::GetInducedData();
    240239  }
    241240
     
    246245  def L =  lead(M);
    247246  intvec @V = deg(M[1..ncols(M)]);  @W;  @V;  @W = @V;  attrib(L, "isHomog", @W); 
    248   SetInducedReferrence(L, @RANK, 0);
     247    Syzextra::SetInducedReferrence(L, @RANK, 0);
    249248*/
    250249
     
    255254
    256255  // General setting:
    257 //  SetInducedReferrence(MRES, 0, 0); // limit: 0!
     256//    Syzextra::SetInducedReferrence(MRES, 0, 0); // limit: 0!
    258257  int @l = size(RES);
    259258
     
    287286    deg(M[1..ncols(M)]); // no use of @W :(?
    288287    @RANK;   
    289     DetailedPrint(MRES);
     288      Syzextra::DetailedPrint(MRES);
    290289    attrib(MRES, "isHomog"); @W;
    291290    deg(MRES[1..ncols(MRES)]);
     
    294293 
    295294     
    296   SetInducedReferrence(L, limit, 0);
     295    Syzextra::SetInducedReferrence(L, limit, 0);
    297296 
    298297  def K = prepareSyz(M, @RANK);
    299298//  K;
    300299 
    301 //   attrib(K, "isHomog", @V);   DetailedPrint(K, 1000);
     300//   attrib(K, "isHomog", @V);     Syzextra::DetailedPrint(K, 1000);
    302301
    303302//  pause();
    304303 
    305   K = idPrepare(K, @RANK); // std(K); // ?
     304  K =   Syzextra::idPrepare(K, @RANK); // std(K); // ?
    306305  K = simplify(K, 2);
    307306
     
    310309  module N = separateSyzGB(K, @RANK)[2]; // 1^st syz. module: vectors which start in lower part (comp >= @RANK)
    311310
    312 // "N_0: "; N; DetailedPrint(N, 10);
     311// "N_0: "; N;   Syzextra::DetailedPrint(N, 10);
    313312
    314313//  basering; print(@V); type(N);
     
    328327        MRES;
    329328
    330         "N: "; N; DetailedPrint(N, 10);
    331 
    332         "K:"; K; DetailedPrint(K, 10);
     329        "N: "; N;   Syzextra::DetailedPrint(N, 10);
     330
     331        "K:"; K;   Syzextra::DetailedPrint(K, 10);
    333332
    334333        "RANKS: ", @RANK;
     
    339338        "transpose(N) * transpose(MRES): ";
    340339        transpose(N) * transpose(MRES);
    341         DetailedPrint(module(_), 2);
    342         m2_end(666);
     340          Syzextra::DetailedPrint(module(_), 2);
     341          Syzextra::m2_end(666);
    343342      }
    344343    }
     
    357356  {
    358357    "Sstep::NextSyzOutput: ";
    359     DetailedPrint(N);
     358      Syzextra::DetailedPrint(N);
    360359    attrib(N, "isHomog");
    361360  }
     
    371370"
    372371{
    373   def data = GetInducedData();
     372  def data =   Syzextra::GetInducedData();
    374373           
    375374  if( (!defined(RES)) || (!defined(MRES)) || (typeof(data) != "list") || (size(data) != 2) )
     
    505504  if( size(M) > 0 )
    506505  {
    507     Sort_c_ds(@N);
     506    Syzextra::Sort_c_ds(@N);
    508507
    509508    if( @KERCHECK )
     
    527526
    528527          "ERROR: MySort: wrong sorting in 'MySort': @N != @M!!!";
    529           m2_end(666);
     528            Syzextra::m2_end(666);
    530529        }
    531530      }
     
    549548    ERROR("Sorry: need an ideal or a module for input");
    550549  }
    551 
    552   // TODO! DONE?
    553550  def @save = basering;
    554551 
     
    588585  }
    589586
    590  
     587  int @RINGCHANGE = 0;
     588
     589  if( typeof( attrib(SSinit, "RINGCHANGE") ) == "int" )
     590  {
     591    @RINGCHANGE = attrib(SSinit, "RINGCHANGE");
     592  }
     593
     594
    591595  if( @DEBUG )
    592596  {
    593597    "SSinit::Input";
    594598    type(M);
    595 //    DetailedPrint(M);
    596599    attrib(M);
    597600  }
     
    606609    option(set, opts);
    607610    kill opts;
    608   }//  else
    609   // {
    610     M = simplify(M, 1 + 2 + 4 + 32); // interreduce?
    611   // }
     611  }
     612
     613  M = simplify(M, 1 + 2 + 4 + 32);
    612614
    613615  if( @IGNORETAILS )
     
    621623    }
    622624  }
    623 
    624  
    625 
     625 
    626626  def @N = MySort(M); // TODO: replace with inplace sorting!!!
    627627  def LEAD = lead(@N);
     
    646646
    647647      "ERROR: wrong sorting (in SSnit): @N != M!!!";
    648       m2_end(666);
     648        Syzextra::m2_end(666);
    649649    }
    650650
     
    658658
    659659      "ERROR: wrong sorting (in SSnit): @LEAD != LEAD!!!";
    660       m2_end(666);
     660        Syzextra::m2_end(666);
    661661    }
    662662   
     
    665665  M = @N;
    666666 
    667   def TAIL = Tail(M);
     667  def TAIL =   Syzextra::Tail(M);
    668668
    669669  int @RANK = nrows(M); int @SIZE = ncols(M);
     
    672672 
    673673  // TODO: what about real modules? weighted ones?
    674  
    675   list @l = ringlist(@save);
    676 
    677   int @z = 0; ideal @m = maxideal(1); intvec @wdeg = deg(@m[1..ncols(@m)]);
    678 
    679   // NOTE: @wdeg will be ignored anyway :(
    680   @l[3] = list(list("C", @z), list("lp", @wdeg));
    681 
    682   kill @z, @wdeg; // since these vars are ring independent!
    683 
    684   def S = ring(@l); // --MakeInducedSchreyerOrdering(1);
    685 
    686   module F = freemodule(@RANK);
    687   intvec @V = deg(F[1..@RANK]);
    688  
    689   setring S; // ring with an easy divisibility test ("C, lex")
    690 
    691   if( @DEBUG )
    692   {
    693     "SSinit::NewRing(C, lex)";
    694     basering;
    695     DetailedPrint(basering);
    696   }
     674
     675  if( @RINGCHANGE )
     676  {
     677    list @l = ringlist(@save);
     678    int @z = 0; ideal @m = maxideal(1); intvec @wdeg = deg(@m[1..ncols(@m)]);
     679    // NOTE: @wdeg will be ignored anyway :(
     680    @l[3] = list(list("C", @z), list("lp", @wdeg));
     681    kill @z, @m, @wdeg; // since these vars are ring independent!
     682    def S = ring(@l); // --  Syzextra::MakeInducedSchreyerOrdering(1);
     683    kill @l;
     684    setring S; // ring with an easy divisibility test ("C, lex") // or not!???
     685    if( @DEBUG )
     686    {
     687      "SSinit::NewRing(C,lex)?";
     688      basering;
     689        Syzextra::DetailedPrint(basering);
     690    }
     691  } else
     692  { def S = basering; }
    697693
    698694  // Setup the leading syzygy^{-1} module to zero:
    699695  module Z = 0; Z[@RANK] = 0; attrib(Z, "isHomog", intvec(0)); 
     696
     697  if( !@RINGCHANGE )
     698  {
     699    if( defined(RES) )  { if( @DEBUG ){ "WARN: killing existing object: RES!"; }; kill RES; }
     700    if( defined(MRES) ) { if( @DEBUG ){ "WARN: killing existing object: MRES!"; }; kill MRES; }
     701    if( defined(LRES) ) { if( @DEBUG ){ "WARN: killing existing object: LRES!"; }; kill LRES; }
     702    if( defined(TRES) ) { if( @DEBUG ){ "WARN: killing existing object: TRES!"; }; kill TRES; }
     703  }
    700704
    701705  module MRES = Z;
     
    704708  list LRES; LRES[1] = Z;
    705709  list TRES; TRES[1] = Z;
    706  
    707   def M = imap(@save, M);
    708 
     710 
     711  if( !defined(M) )
     712  {
     713    def M = imap(@save, M);
     714  }
     715
     716  module F = freemodule(@RANK); intvec @V = deg(F[1..@RANK]); kill F;
     717 
    709718  attrib(M, "isHomog", @V);
    710719  attrib(M, "isSB", 1);
    711720  attrib(M, "degrees", @DEGS); 
    712721 
    713   def LEAD = imap(@save, LEAD);
     722  if( !defined(LEAD) )
     723  {
     724    def LEAD = imap(@save, LEAD);
     725  } 
    714726 
    715727  attrib(LEAD, "isHomog", @V);
    716728  attrib(LEAD, "isSB", 1); 
    717729 
    718   def TAIL = imap(@save, TAIL);
     730  if( !defined(TAIL) )
     731  {
     732    def TAIL = imap(@save, TAIL);
     733  } 
    719734
    720735  if( @DEBUG )
     
    724739    attrib(M);
    725740    attrib(M, "isHomog");
    726 //    DetailedPrint(M);
    727741  }
    728742
     
    734748      transpose( transpose(M) * transpose(MRES) );
    735749      "ERROR: transpose( transpose(M) * transpose(MRES) ) != 0!!!";
    736       m2_end(666);
     750        Syzextra::m2_end(666);
    737751    }
    738752  }
     
    765779  }
    766780
    767 
    768781  if( typeof( attrib(SSinit, "HYBRIDNF") ) == "int" )
    769782  {
     
    773786    attrib(S, "HYBRIDNF", 0);
    774787  }
    775  
     788
     789  // maybe resetting existing ring attributes!
    776790  attrib(S, "DEBUG", @DEBUG);
    777791  attrib(S, "SYZCHECK", @SYZCHECK);
     
    785799    "SSinit::MRES";
    786800    MRES;
    787 //    DetailedPrint(MRES);
     801//      Syzextra::DetailedPrint(MRES);
    788802    attrib(MRES, "isHomog");
    789803    attrib(S);
     
    860874  }
    861875
    862   module SS = ComputeLeadingSyzygyTerms(L);
     876  module SS =   Syzextra::ComputeLeadingSyzygyTerms(L);
    863877
    864878  if( @KERCHECK )
     
    878892    {
    879893      a = L[i];
    880       c = leadcomp(a);
     894      c =   Syzextra::leadcomp(a);
    881895      r = int(c);
    882896
    883       aa = leadmonomial(a);
     897      aa =   Syzextra::leadmonomial(a);
    884898
    885899      M = 0;
     
    889903        b = L[j];
    890904
    891         if( leadcomp(b) == c )
     905        if(   Syzextra::leadcomp(b) == c )
    892906        {
    893           bb = leadmonomial(b);
     907          bb =   Syzextra::leadmonomial(b);
    894908
    895909          M[j] = (lcm(aa, bb) / aa);
     
    915929
    916930        "basering: "; basering;
    917 //        DetailedPrint(basering);
     931//          Syzextra::DetailedPrint(basering);
    918932
    919933        "S: ";  S;
    920 //        DetailedPrint(_, 1);
     934//          Syzextra::DetailedPrint(_, 1);
    921935        "SS: "; SS;
    922 //        DetailedPrint(_, 1);
     936//          Syzextra::DetailedPrint(_, 1);
    923937
    924938        "DIFF: ";
    925939        module(matrix(S) - matrix(SS));
    926 //        DetailedPrint(_, 2);     
     940//          Syzextra::DetailedPrint(_, 2);     
    927941        print(matrix(S) - matrix(SS));
    928         m2_end(666);
     942          Syzextra::m2_end(666);
    929943      }
    930944    }
     
    979993  }
    980994
    981   module SS = Compute2LeadingSyzygyTerms(L);
     995  module SS =   Syzextra::Compute2LeadingSyzygyTerms(L);
    982996
    983997  if( @DEBUG )
     
    9941008        transpose( transpose(SS) * transpose(L) );
    9951009        "ERROR: transpose( transpose(SS) * transpose(L) ) != 0!!!";
    996         m2_end(666);
     1010          Syzextra::m2_end(666);
    9971011      }
    9981012    }
     
    10231037      a = L[i];
    10241038  //    "a: ", a;
    1025       c = leadcomp(a);
     1039      c =   Syzextra::leadcomp(a);
    10261040      r = int(c);
    10271041
    1028       aa = leadmonomial(a);
     1042      aa =   Syzextra::leadmonomial(a);
    10291043
    10301044      M = 0;
     
    10351049  //      "b: ", b;
    10361050
    1037         if( leadcomp(b) == c )
     1051        if(   Syzextra::leadcomp(b) == c )
    10381052        {
    1039           bb = leadmonomial(b);
     1053          bb =   Syzextra::leadmonomial(b);
    10401054          @lcm = lcm(aa, bb);
    10411055
     
    10781092          transpose( transpose(S) * transpose(L) );
    10791093          "ERROR: transpose( transpose(S) * transpose(L) ) != 0!!!";
    1080           m2_end(666);
     1094            Syzextra::m2_end(666);
    10811095        }
    10821096      }
     
    10871101      "ERROR: SSCompute2LeadingSyzygyTerms: size(S) != size(SS)";
    10881102
    1089       "basering: "; basering; //      DetailedPrint(basering);
     1103      "basering: "; basering; //        Syzextra::DetailedPrint(basering);
    10901104
    10911105      "S: ";  S;
    1092 //      DetailedPrint(S, 2);
     1106//        Syzextra::DetailedPrint(S, 2);
    10931107      "SS: "; SS;
    1094 //      DetailedPrint(SS, 2);
    1095       m2_end(666);
     1108//        Syzextra::DetailedPrint(SS, 2);
     1109        Syzextra::m2_end(666);
    10961110    }   
    10971111
     
    11031117
    11041118        "basering: ";  basering;
    1105 //        DetailedPrint(basering);
     1119//          Syzextra::DetailedPrint(basering);
    11061120
    11071121        "lead(S ): "; lead(S );
    1108 //        DetailedPrint(_, 2);
     1122//          Syzextra::DetailedPrint(_, 2);
    11091123        "lead(SS): "; lead(SS);
    1110 //        DetailedPrint(_, 2);
     1124//          Syzextra::DetailedPrint(_, 2);
    11111125
    11121126        "DIFF: ";
    11131127        print( matrix(lead(S)) - matrix(lead(SS))  );
    11141128        module(matrix(lead(S)) - matrix(lead(SS)));
    1115 //        DetailedPrint(_ , 4);
    1116         m2_end(666);
     1129//          Syzextra::DetailedPrint(_ , 4);
     1130          Syzextra::m2_end(666);
    11171131      }
    11181132
     
    11201134      if( @TAILREDSYZ )
    11211135      {
    1122       if( size(module(matrix(Tail(S)) - matrix(Tail(SS)))) > 0 )
     1136      if( size(module(matrix(  Syzextra::Tail(S)) - matrix(  Syzextra::Tail(SS)))) > 0 )
    11231137      {
    11241138        "ERROR: SSCompute2LeadingSyzygyTerms: Tail(S) != Tail(SS) ";
    11251139
    11261140        "basering: ";  basering;
    1127 //        DetailedPrint(basering);
    1128 
    1129         "Tail(S ): "; Tail(S );
    1130 //        DetailedPrint(_, 2);
    1131         "Tail(SS): "; Tail(SS);
    1132 //        DetailedPrint(_, 2);
     1141//          Syzextra::DetailedPrint(basering);
     1142
     1143        "Tail(S ): ";   Syzextra::Tail(S );
     1144//          Syzextra::DetailedPrint(_, 2);
     1145        "Tail(SS): ";   Syzextra::Tail(SS);
     1146//          Syzextra::DetailedPrint(_, 2);
    11331147
    11341148        "DIFF: ";
    1135         module( matrix(Tail(S)) - matrix(Tail(SS)) );
    1136 //        DetailedPrint(_, 4);
    1137         print( matrix(Tail(S)) - matrix(Tail(SS)) );
    1138         m2_end(666);
     1149        module( matrix(  Syzextra::Tail(S)) - matrix(  Syzextra::Tail(SS)) );
     1150//          Syzextra::DetailedPrint(_, 4);
     1151        print( matrix(  Syzextra::Tail(S)) - matrix(  Syzextra::Tail(SS)) );
     1152          Syzextra::m2_end(666);
    11391153      }
    11401154      }
     
    11421156  }
    11431157 
    1144   module S2 = Tail(SS);
     1158  module S2 =   Syzextra::Tail(SS);
    11451159  SS = lead(SS); // (C,lp) on base ring!
    11461160
     
    11531167      type(S2);
    11541168      L;
    1155       m2_end(666);
     1169        Syzextra::m2_end(666);
    11561170    }
    11571171  } 
     
    12141228  if( @DEBUG && (syzterm != 0) )
    12151229  {
    1216     def @@c = leadcomp(syzterm); int @@r = int(@@c);
    1217     def @@product = leadmonomial(syzterm) * L[@@r];
     1230    def @@c =   Syzextra::leadcomp(syzterm); int @@r = int(@@c);
     1231    def @@product =   Syzextra::leadmonomial(syzterm) * L[@@r];
    12181232
    12191233    if( @@product != product)
     
    12211235      "product: ", product, ", @@product: ", @@product;
    12221236      "ERROR: 'syzterm' results in wrong product !!!???";
    1223       m2_end(666);
     1237        Syzextra::m2_end(666);
    12241238    }
    12251239  }
     
    12271241  if( typeof(#[1]) == "module" )
    12281242  {
    1229     vector my = FindReducer(product, syzterm, L/*, T*/, #[1]);
     1243    vector my =   Syzextra::FindReducer(product, syzterm, L/*, T*/, #[1]);
    12301244  } else
    12311245  {
    1232     vector my = FindReducer(product, syzterm, L/*, T*/);
     1246    vector my =   Syzextra::FindReducer(product, syzterm, L/*, T*/);
    12331247  }
    12341248 
     
    12361250  if( @KERCHECK )
    12371251  {
    1238     bigint c = leadcomp(product); int r = int(c);
     1252    bigint c =   Syzextra::leadcomp(product); int r = int(c);
    12391253
    12401254    def a, b, bb;
     
    12471261      a = L[k];
    12481262      // with the same mod. component
    1249       if( leadcomp(a) == c )
     1263      if(   Syzextra::leadcomp(a) == c )
    12501264      {
    1251         b = - (leadmonomial(product) / leadmonomial(L[k]));
     1265        b = - (  Syzextra::leadmonomial(product) /   Syzextra::leadmonomial(L[k]));
    12521266
    12531267        // which divides the product: looking for the 1st appropriate one!
     
    12871301    if( my != nf )
    12881302    {
    1289       "ERROR in FindReducer => ", my, " != nf: ", nf;
    1290       m2_end(666);
     1303      "ERROR in   Syzextra::FindReducer => ", my, " != nf: ", nf;
     1304        Syzextra::m2_end(666);
    12911305    }
    12921306  }
     
    13461360  if( @SYZCHECK && (syzterm != 0) )
    13471361  {
    1348     def @@c = leadcomp(syzterm); int @@r = int(@@c);
    1349     poly @@m = leadmonomial(syzterm); def @@t = L[@@r];
     1362    def @@c =   Syzextra::leadcomp(syzterm); int @@r = int(@@c);
     1363    poly @@m =   Syzextra::leadmonomial(syzterm); def @@t = L[@@r];
    13501364
    13511365    if( (@@m != m) || (@@t != t))
     
    13541368      "@@m: ", @@m, ", @@t: ", @@t;
    13551369      "ERROR: 'syzterm' results in wrong m * t !!!";
    1356       m2_end(666);
     1370        Syzextra::m2_end(666);
    13571371    }
    13581372  }
     
    13601374  if( typeof(#[1]) == "module" )
    13611375  {
    1362     vector ss = ReduceTerm(m, t, syzterm, L, T, #[1]);
     1376    vector ss =   Syzextra::ReduceTerm(m, t, syzterm, L, T, #[1]);
    13631377  } else
    13641378  {
    1365     vector ss = ReduceTerm(m, t, syzterm, L, T);
     1379    vector ss =   Syzextra::ReduceTerm(m, t, syzterm, L, T);
    13661380  }
    13671381
     
    13801394      if( size(s) != 0 )
    13811395      {
    1382         poly @b = leadmonomial(s);
    1383 
    1384         def @c = leadcomp(s); int k = int(@c);
     1396        poly @b =   Syzextra::leadmonomial(s);
     1397
     1398        def @c =   Syzextra::leadcomp(s); int k = int(@c);
    13851399
    13861400        if( @TREEOUTPUT ){ "\CHILD{", (s), "}{", ( @b*L[k]), "}"; }
     
    13921406    if( s != ss )
    13931407    {
    1394       "ERROR in ReduceTerm => old: ", s, " != ker: ", ss;
     1408      "ERROR in   Syzextra::ReduceTerm => old: ", s, " != ker: ", ss;
    13951409      "m: ", m;
    13961410      "t: ", t;
    13971411      "syzterm: ", syzterm;
    13981412       L; T; #;
    1399       m2_end(666);
     1413        Syzextra::m2_end(666);
    14001414    } 
    14011415  }
     
    14451459  if( typeof(#[1]) == "module" )
    14461460  {
    1447     vector ss = TraverseTail(m, @tail, L, T, #[1]);
     1461    vector ss =   Syzextra::TraverseTail(m, @tail, L, T, #[1]);
    14481462  } else
    14491463  {
    1450     vector ss = TraverseTail(m, @tail, L, T);
     1464    vector ss =   Syzextra::TraverseTail(m, @tail, L, T);
    14511465  }
    14521466
     
    14681482    if( s != ss )
    14691483    {
    1470       "ERROR in TraverseTail => old: ", s, " != ker: ", ss;
     1484      "ERROR in   Syzextra::TraverseTail => old: ", s, " != ker: ", ss;
    14711485      "m: ", m;
    14721486      "@tail: ", @tail;
    14731487      L; T; #;
    1474       m2_end(666);
     1488        Syzextra::m2_end(666);
    14751489    } 
    14761490  }
     
    15211535  if( typeof(#[1]) == "module" )
    15221536  {
    1523     def my = SchreyerSyzygyNF(syz_lead, syz_2, L, T, #[1]);
     1537    def my =   Syzextra::SchreyerSyzygyNF(syz_lead, syz_2, L, T, #[1]);
    15241538  } else
    15251539  {
    1526     def my = SchreyerSyzygyNF(syz_lead, syz_2, L, T);
     1540    def my =   Syzextra::SchreyerSyzygyNF(syz_lead, syz_2, L, T);
    15271541  }
    15281542
     
    15311545    int @TREEOUTPUT  = attrib(basering, "TREEOUTPUT");
    15321546   
    1533     def spoly = leadmonomial(syz_lead) * T[int(leadcomp(syz_lead))]
    1534               + leadmonomial(syz_2)    * T[int(leadcomp(syz_2))];
     1547    def spoly =   Syzextra::leadmonomial(syz_lead) * T[int(  Syzextra::leadcomp(syz_lead))]
     1548              +   Syzextra::leadmonomial(syz_2)    * T[int(  Syzextra::leadcomp(syz_2))];
    15351549
    15361550    vector @tail = syz_2;
     
    15401554    while (size(spoly) > 0)
    15411555    {
    1542       syz_2 = SSFindReducer(lead(spoly), 0, L, #); spoly = Tail(spoly);
     1556      syz_2 = SSFindReducer(lead(spoly), 0, L, #); spoly =   Syzextra::Tail(spoly);
    15431557
    15441558      if( size(syz_2) != 0)
    15451559      {         
    1546         @b = leadmonomial(syz_2);
    1547         k =  int(leadcomp(syz_2));
     1560        @b =   Syzextra::leadmonomial(syz_2);
     1561        k =  int(  Syzextra::leadcomp(syz_2));
    15481562       
    15491563        if( @TREEOUTPUT ){ "\CHILD{", (syz_2), "}{", ( lead(spoly)), "}"; }
     
    15571571    if( my != @tail )
    15581572    {
    1559       "ERROR in SchreyerSyzygyNF => old: ", @tail, " != ker: ", my;
     1573      "ERROR in   Syzextra::SchreyerSyzygyNF => old: ", @tail, " != ker: ", my;
    15601574     
    15611575      "syzygy_lead: ", syz_lead;
     
    15631577     
    15641578      L; T; #;
    1565       m2_end(666);
     1579        Syzextra::m2_end(666);
    15661580    }
    15671581  }
     
    15831597static proc SSComputeSyzygy(def L, def T)
    15841598{
    1585 //  rtimer, "***TIMESNAP0 for ComputeSyzygy(L,T): on level: [",attrib(basering,"SYZNUMBER"),"] :: t: ", timer, ", r: ", rtimer;
     1599//  rtimer, "***TIMESNAP0 for   Syzextra::ComputeSyzygy(L,T): on level: [",attrib(basering,"SYZNUMBER"),"] :: t: ", timer, ", r: ", rtimer;
    15861600  int @DEBUG    = attrib(basering, "DEBUG");
    15871601  int @KERCHECK = attrib(basering, "KERCHECK");
     
    15921606    "SSComputeSyzygy::Input";
    15931607    "basering: ", basering; attrib(basering);
    1594 //    DetailedPrint(basering);
     1608//      Syzextra::DetailedPrint(basering);
    15951609
    15961610//    "iCompShift: ", iCompShift;
     
    16011615
    16021616//  option(prot);
    1603 //  rtimer, "***TIME for ComputeSyzygy(L,T): on level: [",attrib(basering,"SYZNUMBER"),"] :: t: ", timer, ", r: ", rtimer;
    1604   list @res=ComputeSyzygy(L,T);
    1605 //  rtimer, "***TIME for ComputeSyzygy(L,T): on level: [",attrib(basering,"SYZNUMBER"),"] :: t: ", timer, ", r: ", rtimer;
     1617//  rtimer, "***TIME for   Syzextra::ComputeSyzygy(L,T): on level: [",attrib(basering,"SYZNUMBER"),"] :: t: ", timer, ", r: ", rtimer;
     1618  list @res=  Syzextra::ComputeSyzygy(L,T);
     1619//  rtimer, "***TIME for   Syzextra::ComputeSyzygy(L,T): on level: [",attrib(basering,"SYZNUMBER"),"] :: t: ", timer, ", r: ", rtimer;
    16061620//  option(noprot); // TODO: restore!
    16071621
     
    16451659      type(LL);
    16461660      type(@LL);
    1647       m2_end(666);
     1661        Syzextra::m2_end(666);
    16481662    }
    16491663
     
    16561670      type(LL);
    16571671      type(@LL);
    1658       m2_end(666);
     1672        Syzextra::m2_end(666);
    16591673    }
    16601674
     
    16821696        if( !@IGNORETAILS )
    16831697        {
    1684           c = leadcomp(a); r = int(c); aa = leadmonomial(a);
     1698          c =   Syzextra::leadcomp(a); r = int(c); aa =   Syzextra::leadmonomial(a);
    16851699         
    16861700          if( @TREEOUTPUT ){ "\ROOT{", (lead(a)), "}"; }
     
    16941708            if( @LEAD2SYZ ) // with the 2nd syz. term:
    16951709            {     
    1696               a2 = LL2[k]; c = leadcomp(a2); r = int(c); aa = leadmonomial(a2);
     1710              a2 = LL2[k]; c =   Syzextra::leadcomp(a2); r = int(c); aa =   Syzextra::leadmonomial(a2);
    16971711             
    16981712              if( @TREEOUTPUT ){ "\CHILD{", (lead(a2)), "}{", ( aa*L[r]), "}"; }
     
    17211735              {
    17221736                "ERROR in SSComputeSyzygy: could not find the 2nd syzygy term during the hybrid NF!!!";
    1723                 m2_end(666);
     1737                  Syzextra::m2_end(666);
    17241738              }
    17251739            }
     
    17531767//              transpose( transpose(N) * transpose(MRES) );             
    17541768         
    1755           m2_end(666);
     1769            Syzextra::m2_end(666);
    17561770        }
    17571771
     
    17701784      type(TT);
    17711785      type(@TT);
    1772       m2_end(666);
     1786        Syzextra::m2_end(666);
    17731787    }
    17741788
     
    17831797      type(LL);
    17841798      type(@LL);
    1785       m2_end(666);
     1799        Syzextra::m2_end(666);
    17861800    }   
    17871801   
     
    18041818  }
    18051819
    1806 //  rtimer, "***TIMESNAP1 for ComputeSyzygy(L,T): on level: [",attrib(basering,"SYZNUMBER"),"] :: t: ", timer, ", r: ", rtimer;
     1820//  rtimer, "***TIMESNAP1 for   Syzextra::ComputeSyzygy(L,T): on level: [",attrib(basering,"SYZNUMBER"),"] :: t: ", timer, ", r: ", rtimer;
    18071821  return (@SYZ, @LL, @TT);
    18081822}
     
    18261840  def L =  lead(M);
    18271841  intvec @V = deg(M[1..ncols(M)]);  @W;  @V;  @W = @V;  attrib(L, "isHomog", @W); 
    1828   SetInducedReferrence(L, @RANK, 0);
     1842    Syzextra::SetInducedReferrence(L, @RANK, 0);
    18291843*/
    18301844
     
    18351849
    18361850  // General setting:
    1837 //  SetInducedReferrence(MRES, 0, 0); // limit: 0!
     1851//    Syzextra::SetInducedReferrence(MRES, 0, 0); // limit: 0!
    18381852  int @l = size(RES);
    18391853
     
    18681882    @V;
    18691883    @RANK;
    1870 //    DetailedPrint(MRES);
     1884//      Syzextra::DetailedPrint(MRES);
    18711885    attrib(MRES, "isHomog");
    18721886  }
     
    18921906        "MRES", MRES;
    18931907
    1894         "N: "; N; // DetailedPrint(N, 2);
    1895 
    1896         "LL:"; LL; // DetailedPrint(LL, 1);
    1897         "TT:"; TT; // DetailedPrint(TT, 10);
     1908        "N: "; N; //   Syzextra::DetailedPrint(N, 2);
     1909
     1910        "LL:"; LL; //   Syzextra::DetailedPrint(LL, 1);
     1911        "TT:"; TT; //   Syzextra::DetailedPrint(TT, 10);
    18981912
    18991913        "RANKS: ", @RANK;
     
    19041918        "transpose(N) * transpose(MRES): ";
    19051919        transpose(N) * transpose(MRES);
    1906         // DetailedPrint(module(_), 2);
    1907         m2_end(666);
     1920        //   Syzextra::DetailedPrint(module(_), 2);
     1921          Syzextra::m2_end(666);
    19081922      }
    19091923    }
     
    19321946    "SSstep::NextSyzOutput: ";
    19331947    N;
    1934 //    DetailedPrint(N);
     1948//      Syzextra::DetailedPrint(N);
    19351949    attrib(N);
    19361950  }
     
    19541968
    19551969  /// TODO!
    1956 //  def data = GetInducedData();
     1970//  def data =   Syzextra::GetInducedData();
    19571971
    19581972  if( (!defined(RES)) || (!defined(MRES)) ) /* || (typeof(data) != "list") || (size(data) != 2) */
     
    21282142}
    21292143
    2130 // cannot be automatically used via overloading :(
    2131 proc SRES_list(SRES SR)
    2132 "TODO!"
    2133 {
    2134   def save = basering; 
    2135   def R = SR.r;
    2136 
    2137   if( 0 )  // ( save == R ) // TODO: not implemented :(((
    2138   {
    2139     list L = SR.rsltn;
    2140     return (L);
    2141   }
    2142    
    2143   setring R;
    2144   list L = SR.rsltn;
    2145   setring save; 
    2146   return (imap( R, L ));
    2147 }
    2148 
    21492144static proc SRES_minres(SRES SR)
    21502145{
     
    21532148  def R = SR.r; S.r = R;
    21542149  setring R;
    2155   S.rsltn = minres(SR.rsltn);
     2150  S.rsltn = minres(SR.rsltn); // in target ring :(
    21562151  return (S);
    21572152}
    21582153
    2159 static proc loadme()
    2160 {
    2161   int @DEBUG = 0; // !system("with", "ndebug");
    2162 
    2163   if( @DEBUG )
    2164   {
     2154
     2155// cannot be automatically used via overloading :(
     2156proc SRES_list(def SR)
     2157"USAGE:  SRES_list(resolution)
     2158RETURN:  list
     2159PURPOSE: convert given resolution to a list
     2160NOTE:    result is over basering
     2161SEE ALSO: s_res, resolution
     2162EXAMPLE: example s_res; shows an example
     2163"
     2164{
     2165  if( typeof(SR) != "SRES" )
     2166  {
     2167    list @@@L = SR;
     2168    return (@@@L);
     2169  }
     2170 
     2171  def save = basering; 
     2172  def R = SR.r;
     2173
     2174//    if( 0 )  // ( save == R ) // TODO: not implemented :(((
     2175//    {      list L = SR.rsltn;      return (L);    }
    21652176   
    2166 //    "ndebug?: ", system("with", "ndebug");
    2167 //    "om_ndebug?: ", system("with", "om_ndebug");
    2168 
    2169     listvar(Syzextra);
    2170     listvar(Schreyer);
    2171     listvar(Top);
    2172   }
    2173 
    2174   if( !defined(Schreyer::DetailedPrint) )
    2175   {
    2176     if( 1 )
    2177     {
    2178 /*
    2179       if( system("with", "ndebug") )
    2180       {
    2181         "Loading the Debug version!";
    2182       } else
    2183       {
    2184         "Loading the Release version!";
    2185       }
    2186 */     
     2177  setring R;
     2178 
     2179  list @@@L = SR.rsltn;
     2180  setring save; 
     2181  return (imap( R, @@@L ));
     2182}
     2183
     2184static proc mod_init()
     2185{
     2186  int @DEBUG = 0; // !system("with", "ndebug"); //    "om_ndebug?: ", system("with", "om_ndebug");
     2187
     2188  if( @DEBUG )  {    listvar(Top);  }
     2189
     2190  if( !defined(SRES) )
     2191  {
    21872192      load("syzextra.so");
    21882193
    2189       if( @DEBUG )
    2190       {
    2191         listvar(Syzextra);
    2192       }
     2194      if( @DEBUG ){        listvar(Syzextra);      }
    21932195     
    2194 //      exportto(Top, Syzextra::ClearContent);
    2195 //      exportto(Top, Syzextra::ClearDenominators);
    2196       exportto(Schreyer, Syzextra::m2_end);
    2197      
    2198 //      export Syzextra;
    2199 
    2200 //      exportto(Schreyer, Syzextra::noop);
    2201       exportto(Schreyer, Syzextra::DetailedPrint);
    2202       exportto(Schreyer, Syzextra::leadmonomial);
    2203       exportto(Schreyer, Syzextra::leadcomp);
    2204 //      exportto(Schreyer, Syzextra::leadrawexp);
    2205 //      exportto(Schreyer, Syzextra::ISUpdateComponents);
    2206       exportto(Schreyer, Syzextra::SetInducedReferrence);
    2207       exportto(Schreyer, Syzextra::GetInducedData);
    2208 //      exportto(Schreyer, Syzextra::GetAMData);
    2209 //      exportto(Schreyer, Syzextra::SetSyzComp);
    2210       exportto(Schreyer, Syzextra::MakeInducedSchreyerOrdering);
    2211 //      exportto(Schreyer, Syzextra::MakeSyzCompOrdering);
    2212       exportto(Schreyer, Syzextra::idPrepare);
    2213 //      exportto(Schreyer, Syzextra::reduce_syz);
    2214 //      exportto(Schreyer, Syzextra::p_Content);
    2215 
    2216       exportto(Schreyer, Syzextra::ProfilerStart); exportto(Schreyer, Syzextra::ProfilerStop);
    2217 
    2218       exportto(Schreyer, Syzextra::Tail);
    2219       exportto(Schreyer, Syzextra::ComputeLeadingSyzygyTerms);     
    2220       exportto(Schreyer, Syzextra::Compute2LeadingSyzygyTerms);
    2221       exportto(Schreyer, Syzextra::Sort_c_ds);
    2222 
    2223       exportto(Schreyer, Syzextra::FindReducer);
    2224 
    2225       exportto(Schreyer, Syzextra::ReduceTerm);
    2226       exportto(Schreyer, Syzextra::TraverseTail);
    2227 
    2228       exportto(Schreyer, Syzextra::SchreyerSyzygyNF);
    2229       exportto(Schreyer, Syzextra::ComputeSyzygy);
    2230 
    2231       exportto(Schreyer, Syzextra::ComputeResolution);
    2232 
    2233       exportto(Schreyer, Syzextra::NumberStatsInit);
    2234       exportto(Schreyer, Syzextra::NumberStatsPrint);
    2235 
    2236       newstruct("SRES","ring r,resolution rsltn"); // http://www.singular.uni-kl.de/Manual/latest/sing_179.htm#SEC218
    2237       // TODO: SSres - return SRESOLUTION?
    2238 
     2196//      exportto(Top,   Syzextra::ClearContent); //      exportto(Top,   Syzextra::ClearDenominators);     exportto(Schreyer,   Syzextra::noop);
     2197//      exportto(Schreyer,   Syzextra::leadrawexp); //      exportto(Schreyer,   Syzextra::ISUpdateComponents);
     2198//      exportto(Schreyer,   Syzextra::GetAMData);//      exportto(Schreyer,   Syzextra::SetSyzComp);
     2199//      exportto(Schreyer,   Syzextra::MakeSyzCompOrdering); //      exportto(Schreyer,   Syzextra::reduce_syz);//      exportto(Schreyer,   Syzextra::p_Content);
     2200
     2201//    exportto(Schreyer,   Syzextra::DetailedPrint);
     2202//    exportto(Schreyer,   Syzextra::m2_end);
     2203//    exportto(Schreyer,   Syzextra::leadmonomial);
     2204//    exportto(Schreyer,   Syzextra::leadcomp);
     2205//    exportto(Schreyer,   Syzextra::SetInducedReferrence);
     2206//    exportto(Schreyer,   Syzextra::GetInducedData);
     2207//    exportto(Schreyer,   Syzextra::MakeInducedSchreyerOrdering);
     2208//    exportto(Schreyer,   Syzextra::idPrepare);   
     2209//    exportto(Schreyer,   Syzextra::ProfilerStart);   exportto(Schreyer,   Syzextra::ProfilerStop);
     2210//    exportto(Schreyer,   Syzextra::NumberStatsInit); exportto(Schreyer,   Syzextra::NumberStatsPrint);   
     2211//    exportto(Schreyer,   Syzextra::Tail);
     2212//    exportto(Schreyer,   Syzextra::ComputeLeadingSyzygyTerms);
     2213//    exportto(Schreyer,   Syzextra::Compute2LeadingSyzygyTerms);
     2214//    exportto(Schreyer,   Syzextra::Sort_c_ds);   
     2215//    exportto(Schreyer,   Syzextra::FindReducer);
     2216//    exportto(Schreyer,   Syzextra::ReduceTerm);
     2217//    exportto(Schreyer,   Syzextra::TraverseTail);   
     2218//    exportto(Schreyer,   Syzextra::SchreyerSyzygyNF);
     2219//    exportto(Schreyer,   Syzextra::ComputeSyzygy);
     2220//    exportto(Schreyer,   Syzextra::ComputeResolution);
     2221   
     2222    // TODO: SSres - return SRESOLUTION?
     2223    newstruct("SRES","ring r,resolution rsltn"); // http://www.singular.uni-kl.de/Manual/latest/sing_179.htm#SEC218
    22392224//      system("install","SRES","string",SRES_string, 1);
    2240       system("install","SRES","print",SRES_print, 1);
    2241 
    2242       system("install","SRES","betti",SRES_betti1, 1); // http://www.singular.uni-kl.de/Manual/latest/sing_260.htm#SEC299
    2243       system("install","SRES","betti",SRES_betti2, 2); // http://www.singular.uni-kl.de/Manual/latest/sing_260.htm#SEC299
    2244       system("install","SRES","minres",SRES_minres, 1); // http://www.singular.uni-kl.de/Manual/latest/sing_344.htm#SEC383
    2245 
    2246 //      system("install","SRES","list", SRES_list, 1); // will never work :(((
    2247      
    2248       // TODO: SSsyz? SSYZYGY? // TODO: C/C++ computation for Syzygy?
    2249 //      newstruct("SSYZ","ring r,module szg"); // http://www.singular.uni-kl.de/Manual/latest/sing_179.htm#SEC218
    2250 //      system("install","SSYZYGY","string",SSYZYGY_string, 1);
    2251 //      system("install","SSYZYGY","print",SSYZYGY_print, 1);
    2252 //      system("install","SSYZYGY","module",SSYZYGY_module, 1);
    2253     }
    2254 
    2255 //    exportto(Top, DetailedPrint);
    2256 //    exportto(Top, GetInducedData);
    2257 
    2258     if( @DEBUG )
    2259     {
    2260       listvar(Top);
    2261       listvar(Schreyer);
    2262     }
    2263   }
    2264  
    2265   mod_assure_load();
    2266 }
    2267 
    2268 
    2269 
    2270 static proc mod_assure_load()
    2271 {
    2272   if( !defined(GetInducedData) )
    2273   {
    2274     "ERROR: Sorry but we are missing the dynamic module (syzextra.so)...";
    2275     $
    2276     // m2_end(666); // :(
    2277   }
    2278 }
    2279 
    2280 static proc mod_init()
    2281 {
    2282   loadme();
     2225    system("install","SRES","print",SRES_print, 1);
     2226    system("install","SRES","betti",SRES_betti1, 1); // http://www.singular.uni-kl.de/Manual/latest/sing_260.htm#SEC299
     2227    system("install","SRES","betti",SRES_betti2, 2); // http://www.singular.uni-kl.de/Manual/latest/sing_260.htm#SEC299
     2228    system("install","SRES","minres",SRES_minres, 1); // http://www.singular.uni-kl.de/Manual/latest/sing_344.htm#SEC383
     2229    system("install","SRES","list", SRES_list, 1); // will never work :(((
     2230
     2231//    exportto(Top, s_res); //   Syzextra::GetInducedData);
     2232
     2233    if( @DEBUG )    {      listvar(Top);      listvar(Schreyer);    }
     2234  }
    22832235}
    22842236
     
    23952347   
    23962348    "ERROR: There were some wrong betti numbers... ";
    2397 //    m2_end(666);   
     2349//      Syzextra::m2_end(666);   
    23982350  } else
    23992351  {
     
    24942446  {
    24952447    "ERROR: non-square M!!!";
    2496     m2_end(666);
     2448      Syzextra::m2_end(666);
    24972449  }
    24982450
     
    25042456    "MRES': "; M; print(M);
    25052457
    2506     m2_end(666);
     2458      Syzextra::m2_end(666);
    25072459  }
    25082460//  "MRES': "; M; print(M);
     
    25112463  {
    25122464    "ERROR: wrong starting zero module!!!";
    2513     m2_end(666);
     2465      Syzextra::m2_end(666);
    25142466  }
    25152467
     
    25442496 
    25452497  option(redSB); option(redTail);
    2546   if(@PROFILE){ProfilerStart(@prof);}
     2498  if(@PROFILE){  Syzextra::ProfilerStart(@prof);}
    25472499  timer=0;rtimer=0;def R=SSres(I,0);@m=rtimer;
    2548   if(@PROFILE){ProfilerStop();}
     2500  if(@PROFILE){  Syzextra::ProfilerStop();}
    25492501  setring R;module M;list @l=list();@l[size(RES)-1]=list();r=nrows(RES[1]);for(i=2;i<=size(RES);i++){M=RES[i];rr=nrows(M);if((r>0)&&(size(M)>0)&&(r<rr)){M=transpose(M);M=M[(r+1)..ncols(M)];M=transpose(M);RES[i]=M;};r=rr;@l[i-1] = M;};resolution RR=@l;RR=minres(RR);def S=betti(RR,1);@t=rtimer;
    2550 //  DetailedPrint(RR,0);
     2502//    Syzextra::DetailedPrint(RR,0);
    25512503  SCheck(R);
    25522504  StopAddResTest(RR, S, @t,@m);
     
    25562508proc s_res(def I, int l)
    25572509"USAGE:  s_res(ideal/module M, int len)
    2558 RETURN:  SRES, a blackbox object containing a (part of) Schreyer resolution
     2510RETURN:  resolution object or SRES
    25592511PURPOSE: compute a Schreyer resolution of M of length at most len (see [BMSS])
    25602512NOTE:    If given len is zero then nvars(basering) + 1 is used instead.
    2561 @* SRES can be printed, treated by betti and minres or converted to list & mapped into the current ring with @code{SRES_list}
    25622513@* This functions is not related to other helpers from this library.
    25632514@* One can switch on computation protocol and statistic (depending on the build) by setting the @code{prot} option.
     
    25692520"
    25702521{
    2571   int @prot = (find(option(),"prot") != 0) && (defined(NumberStatsInit)) && (defined(NumberStatsPrint));
    2572   def R=SSinit(I); setring R; int @l = size(RES);
    2573   SRES ret; ret.r = R;
    2574   if(@prot){ NumberStatsInit(); }
    2575   ret.rsltn = ComputeResolution(RES[@l], LRES[@l], TRES[@l], l);
    2576   if(@prot){ NumberStatsPrint("Number statistic for s_res with ComputeResolution"); }
     2522  int @prot = (find(option(),"prot") != 0) && (defined(  Syzextra::NumberStatsInit)) && (defined(  Syzextra::NumberStatsPrint));
     2523  def @save = basering;
     2524 
     2525  int @RINGCHANGE = 0;
     2526
     2527  if( typeof( attrib(SSinit, "RINGCHANGE") ) == "int" )
     2528  {
     2529    @RINGCHANGE = attrib(SSinit, "RINGCHANGE");
     2530  }
     2531 
     2532  def R=SSinit(I);
     2533  if( @RINGCHANGE ){ setring R; }
     2534 
     2535  int @l = size(RES);
     2536  if(@prot){   Syzextra::NumberStatsInit(); }
     2537  def rsltn =   Syzextra::ComputeResolution(RES[@l], LRES[@l], TRES[@l], l);
     2538  if(@prot){   Syzextra::NumberStatsPrint("Number statistic for s_res with   Syzextra::ComputeResolution"); }
     2539 
     2540  if( !@RINGCHANGE )
     2541  {
     2542    return (rsltn); // ret
     2543  }
     2544 
     2545  SRES ret; ret.r = R; ret.rsltn = rsltn; 
    25772546  return (ret);
    25782547}
     
    25812550  ring R;
    25822551  module M = maxideal(1); M;
    2583   SRES rs = s_res(M, 0);
     2552  def rs = s_res(M, 0);
    25842553  print(rs);
    25852554  print(betti(rs, 0)); // non-minimal betties
     
    25892558}
    25902559
     2560static proc s_res_bm(def I)
     2561{
     2562  int @prot = (find(option(),"prot") != 0) && (defined(  Syzextra::NumberStatsInit)) && (defined(  Syzextra::NumberStatsPrint));
     2563  def @save = basering;
     2564 
     2565  int @RINGCHANGE = 0;
     2566
     2567  if( typeof( attrib(SSinit, "RINGCHANGE") ) == "int" )
     2568  {
     2569    @RINGCHANGE = attrib(SSinit, "RINGCHANGE");
     2570  }
     2571  int t,tt,sum;
     2572 
     2573t=rtimer;def R=SSinit(I);tt=rtimer;
     2574
     2575  "%% Setup(SSinit) TIME:", tt - t; // if(@prot){ } ?
     2576  int sum = (tt-t);
     2577
     2578  if( @RINGCHANGE ){ setring R; }
     2579 
     2580  int @l = size(RES);
     2581  module N, L, T, LL, TT;
     2582  L = LRES[@l];
     2583  T = TRES[@l];
     2584
     2585 
     2586  int ss = attrib(basering, "SYZNUMBER");
     2587 
     2588  while ( 1 )
     2589  {
     2590    if(@prot){   Syzextra::NumberStatsInit(); }
     2591
     2592//  SSstep():
     2593t=rtimer;(N,LL,TT)=SSComputeSyzygy(L,T);tt=rtimer;
     2594   
     2595    @l = @l + 1;
     2596    if(@prot){   Syzextra::NumberStatsPrint("Number statistic for SSComputeSyzygy["+string(@l-2)+"]"); }
     2597    "%% SSstep[",@l-2, "] TIME:", tt - t;  // if(@prot){ } ?
     2598    sum = sum + (tt-t);
     2599   
     2600    if( (size(LL) == 0) || (size(N) == 0) ) { break; }
     2601    L = LL; T = TT; RES[@l] = N; // LRES[@l] = LL; TRES[@l] = TT;
     2602
     2603    ss = ss + 1; attrib(basering, "SYZNUMBER", ss );   
     2604  }
     2605 
     2606  "%% Whole Resolution (with "+string(@l)+"syzygies) TIME:", sum;  // if(@prot){ } ?
     2607  resolution rsltn = list(RES[2..size(RES)]);
     2608 
     2609  if( !@RINGCHANGE )
     2610  {
     2611    return (rsltn); // ret
     2612  }
     2613 
     2614  SRES ret; ret.r = R; ret.rsltn = rsltn;
     2615  return (ret);
     2616}
     2617
     2618
    25912619static proc s_syz(def I)
    25922620{
     
    25942622  int @l = size(RES); //   def M =  RES[@l];
    25952623  module N, LL, TT; (N, LL, TT) = SSComputeSyzygy(LRES[@l], TRES[@l]);
    2596   SSYZ ret; ret.r = R; ret.szg = N; // Schreyer::ComputeResolution(RES[2], LRES[2], TRES[2], 0);
     2624  SSYZ ret; ret.r = R; ret.szg = N; // Schreyer::  Syzextra::ComputeResolution(RES[2], LRES[2], TRES[2], 0);
    25972625  return (ret);
    25982626}
     
    26162644 
    26172645  option(redSB); option(redTail);
    2618   if(@PROFILE){ProfilerStart(@prof);}
    2619   timer=0;rtimer=0;def R=SSinit(I);setring R;def RR=ComputeResolution(RES[2], LRES[2], TRES[2], 0);
     2646  if(@PROFILE){  Syzextra::ProfilerStart(@prof);}
     2647  timer=0;rtimer=0;def R=SSinit(I);setring R;def RR=  Syzextra::ComputeResolution(RES[2], LRES[2], TRES[2], 0);
    26202648@m=rtimer;
    2621   if(@PROFILE){ProfilerStop();}
    2622 RR=minres(RR);def S=betti(RR,1);@t=rtimer;
    2623 //  DetailedPrint(RR,0);  print(RR);  print(S, "betti");
     2649  if(@PROFILE){  Syzextra::ProfilerStop();}
     2650RR=minres(RR); def S=betti(RR,1);@t=rtimer;
     2651//    Syzextra::DetailedPrint(RR,0);  print(RR);  print(S, "betti");
    26242652  SCheck(R);
    26252653  StopAddResTest(RR, S, @t,@m);
     
    27172745static proc testSimple(list #)
    27182746{
    2719   mod_assure_load();
    2720 
    27212747  def DEBUG = 0;
    27222748  if(size(#) > 0) { DEBUG = #[1]; }
  • Singular/LIB/standard.lib

    r8af63a r11d9d00  
    13891389     return(nres(m,i));
    13901390   }
     1391   
     1392/* if( attrib(basering, "global") == 1 ) // preparations for s_res usage. in testing!
     1393   {
     1394     if (p_opt) { "using s_res";}
     1395     if( !defined(s_res) )
     1396     {
     1397       def @@v=option(get); option(noloadLib); option(noloadProc); LIB( "schreyer.lib" ); // for s_res
     1398       option(set, @@v); kill @@v;
     1399     } 
     1400     resolution re = s_res(m,i);
     1401     if(size(#)>2)
     1402     {
     1403       re=minres(re);
     1404     }
     1405     return(re);   
     1406   }*/
    13911407
    13921408   if(homog(m)==1)
  • Singular/LIB/swalk.lib

    • Property mode changed from 100644 to 100755
  • Singular/Makefile.am

    r8af63a r11d9d00  
    1 ACLOCAL_AMFLAGS = -I ../m4
     1ACLOCAL_AMFLAGS = -I../m4
    22
    33GIT_VERSION := $(shell $(top_srcdir)/git-version-gen $(top_srcdir)/.tarball-git-version)
     
    156156bin_PROGRAMS = Singular ESingular TSingular $(optional_Singular_programs)
    157157
     158# the following dependency leads to Singular relinking upon a library update!
    158159Singular ESingular TSingular $(optional_Singular_programs): ${abs_builddir}/LIB
    159160
  • Singular/extra.cc

    r8af63a r11d9d00  
    709709        return TRUE;
    710710      }
     711      if (rField_is_Ring(currRing))
     712      {
     713        WerrorS("field required");
     714        return TRUE;
     715      }
    711716      matrix pMat  = (matrix)h->Data();
    712717      matrix lMat  = (matrix)h->next->Data();
     
    943948      if (h!=NULL)
    944949      {
    945         res->rtyp=h->Typ();
    946         if (h->Typ()==BIGINTMAT_CMD)
    947         {
    948           res->data=(char *)singflint_LLL((bigintmat*)h->Data());
    949           return FALSE;
    950         }
    951         else if (h->Typ()==INTMAT_CMD)
    952         {
    953           res->data=(char *)singflint_LLL((intvec*)h->Data());
    954           return FALSE;
    955         }
    956         else return TRUE;
     950        if(h->next == NULL)
     951        {
     952            res->rtyp=h->Typ();
     953            if (h->Typ()==BIGINTMAT_CMD)
     954            {
     955              res->data=(char *)singflint_LLL((bigintmat*)h->Data(), NULL);
     956              return FALSE;
     957            }
     958            else if (h->Typ()==INTMAT_CMD)
     959            {
     960              res->data=(char *)singflint_LLL((intvec*)h->Data(), NULL);
     961              return FALSE;
     962            }
     963            else return TRUE;
     964        }
     965        if(h->next->Typ()!= INT_CMD)
     966        {
     967            WerrorS("matrix,int or bigint,int expected");
     968            return TRUE;
     969        }
     970        if(h->next->Typ()== INT_CMD)
     971        {
     972            if(((int)((long)(h->next->Data())) != 0) && (int)((long)(h->next->Data()) != 1))
     973            {
     974                WerrorS("int is different from 0, 1");
     975                return TRUE;
     976            }
     977            res->rtyp=h->Typ();
     978            if((long)(h->next->Data()) == 0)
     979            {
     980                if (h->Typ()==BIGINTMAT_CMD)
     981                {
     982                  res->data=(char *)singflint_LLL((bigintmat*)h->Data(), NULL);
     983                  return FALSE;
     984                }
     985                else if (h->Typ()==INTMAT_CMD)
     986                {
     987                  res->data=(char *)singflint_LLL((intvec*)h->Data(), NULL);
     988                  return FALSE;
     989                }
     990                else return TRUE;
     991            }
     992            // This will give also the transformation matrix U s.t. res = U * m
     993            if((long)(h->next->Data()) == 1)
     994            {
     995                if (h->Typ()==BIGINTMAT_CMD)
     996                {
     997                  bigintmat* m = (bigintmat*)h->Data();
     998                  bigintmat* T = new bigintmat(m->rows(),m->rows(),m->basecoeffs());
     999                  for(int i = 1; i<=m->rows(); i++)
     1000                  {
     1001                    n_Delete(&(BIMATELEM(*T,i,i)),T->basecoeffs());
     1002                    BIMATELEM(*T,i,i)=n_Init(1, T->basecoeffs());
     1003                  }
     1004                  m = singflint_LLL(m,T);
     1005                  lists L = (lists)omAllocBin(slists_bin);
     1006                  L->Init(2);
     1007                  L->m[0].rtyp = BIGINTMAT_CMD;  L->m[0].data = (void*)m;
     1008                  L->m[1].rtyp = BIGINTMAT_CMD;  L->m[1].data = (void*)T;
     1009                  res->data=L;
     1010                  res->rtyp=LIST_CMD;
     1011                  return FALSE;
     1012                }
     1013                else if (h->Typ()==INTMAT_CMD)
     1014                {
     1015                  intvec* m = (intvec*)h->Data();
     1016                  intvec* T = new intvec(m->rows(),m->rows(),(int)0);
     1017                  for(int i = 1; i<=m->rows(); i++)
     1018                    IMATELEM(*T,i,i)=1;
     1019                  m = singflint_LLL(m,T);
     1020                  lists L = (lists)omAllocBin(slists_bin);
     1021                  L->Init(2);
     1022                  L->m[0].rtyp = INTMAT_CMD;  L->m[0].data = (void*)m;
     1023                  L->m[1].rtyp = INTMAT_CMD;  L->m[1].data = (void*)T;
     1024                  res->data=L;
     1025                  res->rtyp=LIST_CMD;
     1026                  return FALSE;
     1027                }
     1028                else return TRUE;
     1029            }
     1030        }
     1031       
    9571032      }
    9581033      else return TRUE;
  • Singular/ipshell.cc

    r8af63a r11d9d00  
    20732073  // 0: string: integer
    20742074  // no further entries --> Z
    2075   int_number modBase = NULL;
     2075  mpz_ptr modBase = NULL;
    20762076  unsigned int modExponent = 1;
    20772077
    2078   modBase = (int_number) omAlloc(sizeof(mpz_t));
     2078  modBase = (mpz_ptr) omAlloc(sizeof(mpz_t));
    20792079  if (L->nr == 0)
    20802080  {
     
    21302130  {
    21312131    //R->cf->ch = R->cf->modExponent;
    2132     if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*sizeof(NATNUMBER)))
     2132    if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*sizeof(unsigned long)))
    21332133    {
    21342134      /* this branch should be active for modExponent = 2..32 resp. 2..64,
     
    51235123#ifdef HAVE_RINGS
    51245124  //unsigned int ringtype = 0;
    5125   int_number modBase = NULL;
     5125  mpz_ptr modBase = NULL;
    51265126  unsigned int modExponent = 1;
    51275127#endif
     
    52665266  else if ((pn->name != NULL) && (strcmp(pn->name, "integer") == 0))
    52675267  {
    5268     modBase = (int_number) omAlloc(sizeof(mpz_t));
     5268    modBase = (mpz_ptr) omAlloc(sizeof(mpz_t));
    52695269    mpz_init_set_si(modBase, 0);
    52705270    if (pn->next!=NULL)
     
    53095309    if (modExponent > 1 && cf == NULL)
    53105310    {
    5311       if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*sizeof(NATNUMBER)))
     5311      if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*sizeof(unsigned long)))
    53125312      {
    53135313        /* this branch should be active for modExponent = 2..32 resp. 2..64,
  • Singular/number2.cc

    r8af63a r11d9d00  
    4444    {
    4545      ZnmInfo info;
    46       mpz_ptr modBase= (int_number) omAlloc(sizeof(mpz_t));
     46      mpz_ptr modBase= (mpz_ptr) omAlloc(sizeof(mpz_t));
    4747      mpz_init_set_ui(modBase,i2);
    4848      info.base= modBase;
  • Singular/walk.cc

    • Property mode changed from 100644 to 100755
    r350269 r11d9d00  
    431431#endif
    432432
    433 #ifdef CHECK_IDEAL_MWALK
     433//#ifdef CHECK_IDEAL_MWALK
    434434static void idString(ideal L, const char* st)
    435435{
     
    443443  Print(" %s;", pString(L->m[nL-1]));
    444444}
    445 #endif
     445//#endif
    446446
    447447#if defined(CHECK_IDEAL_MWALK) || defined(ENDWALKS)
     
    560560  }
    561561  return p0;
     562}
     563
     564/*****************************************************************************
     565 * compute the gcd of the entries of the vectors curr_weight and diff_weight *
     566 *****************************************************************************/
     567static int simplify_gcd(intvec* curr_weight, intvec* diff_weight)
     568{
     569  int j;
     570  int nRing = currRing->N;
     571  int gcd_tmp = (*curr_weight)[0];
     572  for (j=1; j<nRing; j++)
     573  {
     574    gcd_tmp = gcd(gcd_tmp, (*curr_weight)[j]);
     575    if(gcd_tmp == 1)
     576    {
     577      break;
     578    }
     579  }
     580  if(gcd_tmp != 1)
     581  {
     582    for (j=0; j<nRing; j++)
     583    {
     584    gcd_tmp = gcd(gcd_tmp, (*diff_weight)[j]);
     585    if(gcd_tmp == 1)
     586      {
     587        break;
     588      }
     589    }
     590  }
     591  return gcd_tmp;
    562592}
    563593
     
    955985}
    956986
    957 /*****************************************************************************
    958 * create a weight matrix order as intvec of an extra weight vector (a(iv),lp)*
    959 ******************************************************************************/
     987/*********************************************************************************
     988* create a weight matrix order as intvec of an extra weight vector (a(iv),M(iw)) *
     989**********************************************************************************/
    960990intvec* MivMatrixOrderRefine(intvec* iv, intvec* iw)
    961991{
    962   assume(iv->length() == iw->length());
    963   int i, nR = iv->length();
     992  assume((iv->length())*(iv->length()) == iw->length());
     993  int i,j, nR = iv->length();
    964994 
    965995  intvec* ivm = new intvec(nR*nR);
     
    968998  {
    969999    (*ivm)[i] = (*iv)[i];
    970     (*ivm)[i+nR] = (*iw)[i];
    971   }
    972   for(i=2; i<nR; i++)
    973   {
    974     (*ivm)[i*nR+i-2] = 1;
     1000  }
     1001  for(i=1; i<nR; i++)
     1002  {
     1003    for(j=0; j<nR; j++)
     1004    {
     1005      (*ivm)[j+i*nR] = (*iw)[j+i*nR];
     1006    }
    9751007  }
    9761008  return ivm;
     
    18611893}
    18621894
     1895
     1896/**************************************************************
     1897 * Look for the position of the smallest absolut value in vec *
     1898 **************************************************************/
     1899static int MivAbsMaxArg(intvec* vec)
     1900{
     1901  int k = MivAbsMax(vec);
     1902  int i=0;
     1903  while(1)
     1904  {
     1905    if((*vec)[i] == k || (*vec)[i] == -k)
     1906    {
     1907      break;
     1908    }
     1909    i++;
     1910  }
     1911  return i;
     1912}
     1913
     1914
    18631915/**********************************************************************
    18641916 * Compute a next weight vector between curr_weight and target_weight *
     
    18751927
    18761928  int nRing = currRing->N;
    1877   int checkRed, j, kkk, nG = IDELEMS(G);
     1929  int checkRed, j, nG = IDELEMS(G);
    18781930  intvec* ivtemp;
    18791931
     
    19131965  mpz_init(dcw);
    19141966
    1915   //int tn0, tn1, tz1, ncmp, gcd_tmp, ntmp;
    19161967  int gcd_tmp;
    19171968  intvec* diff_weight = MivSub(target_weight, curr_weight);
     
    19191970  intvec* diff_weight1 = MivSub(target_weight, curr_weight);
    19201971  poly g;
    1921   //poly g, gw;
     1972
    19221973  for (j=0; j<nG; j++)
    19231974  {
     
    19812032    }
    19822033  }
    1983 //Print("\n// Alloc Size = %d \n", nRing*sizeof(mpz_t));
     2034  //Print("\n// Alloc Size = %d \n", nRing*sizeof(mpz_t));
    19842035  mpz_t *vec=(mpz_t*)omAlloc(nRing*sizeof(mpz_t));
    19852036
    19862037
    1987   // there is no 0<t<1 and define the next weight vector that is equal to the current weight vector
     2038  // there is no 0<t<1 and define the next weight vector that is equal
     2039  // to the current weight vector
    19882040  if(mpz_cmp(t_nenner, t_null) == 0)
    19892041  {
     
    20562108#endif
    20572109
    2058   //  BOOLEAN isdwpos;
    2059 
    2060   // construct a new weight vector
     2110// construct a new weight vector and check whether vec[j] is overflow,
     2111// i.e. vec[j] > 2^31.
     2112// If vec[j] doesn't overflow, define a weight vector. Otherwise,
     2113// report that overflow appears. In the second case, test whether the
     2114// the correctness of the new vector plays an important role
     2115
    20612116  for (j=0; j<nRing; j++)
    20622117  {
     
    21022157    }
    21032158  }
    2104 
     2159  // reduce the vector with the gcd
     2160  if(mpz_cmp_si(ggt,1) != 0)
     2161  {
     2162    for (j=0; j<nRing; j++)
     2163    {
     2164      mpz_divexact(vec[j], vec[j], ggt);
     2165    }
     2166  }
    21052167#ifdef  NEXT_VECTORS_CC
    21062168  PrintS("\n// gcd of elements of the vector: ");
     
    21082170#endif
    21092171
    2110 /**********************************************************************
    2111 * construct a new weight vector and check whether vec[j] is overflow, *
    2112 * i.e. vec[j] > 2^31.                                                 *
    2113 * If vec[j] doesn't overflow, define a weight vector. Otherwise,      *
    2114 * report that overflow appears. In the second case, test whether the  *
    2115 * the correctness of the new vector plays an important role           *
    2116 **********************************************************************/
    2117   kkk=0;
    21182172  for(j=0; j<nRing; j++)
    21192173    {
     
    21312185
    21322186  REDUCTION:
     2187  checkRed = 1;
    21332188  for (j=0; j<nRing; j++)
    21342189  {
    2135     (*diff_weight)[j] = mpz_get_si(vec[j]);
    2136   }
    2137   while(MivAbsMax(diff_weight) >= 5)
    2138   {
    2139     for (j=0; j<nRing; j++)
    2140     {
    2141       if(mpz_cmp_si(ggt,1)==0)
    2142       {
    2143         (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5);
    2144         // Print("\n//  vector[%d] = %d \n",j+1, (*diff_weight1)[j]);
    2145       }
    2146       else
    2147       {
    2148         mpz_divexact(vec[j], vec[j], ggt);
    2149         (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5);
    2150         // Print("\n//  vector[%d] = %d \n",j+1, (*diff_weight1)[j]);
    2151       }
    2152 /*
    2153       if((*diff_weight1)[j] == 0)
    2154       {
    2155         kkk = kkk + 1;
    2156       }
    2157 */
    2158     }
    2159 
    2160 
    2161 /*
    2162     if(kkk > nRing - 1)
    2163     {
    2164       // diff_weight was reduced to zero
    2165       // Print("\n // MwalkNextWeightCC: geaenderter Vector gleich Null! \n");
    2166       goto TEST_OVERFLOW;
    2167     }
    2168 */
    2169 
    2170     if(test_w_in_ConeCC(G,diff_weight1) != 0)
    2171     {
    2172       Print("\n// MwalkNextWeightCC: geaenderter vector liegt in Groebnerkegel! \n");
    2173       for (j=0; j<nRing; j++)
    2174       {
    2175         (*diff_weight)[j] = (*diff_weight1)[j];
    2176       }
    2177       if(MivAbsMax(diff_weight) < 5)
    2178       {
    2179         checkRed = 1;
    2180         goto SIMPLIFY_GCD;
    2181       }
    2182     }
    2183     else
    2184     {
    2185       // Print("\n// MwalkNextWeightCC: geaenderter vector liegt nicht in Groebnerkegel! \n");
    2186       break;
    2187     }
     2190    (*diff_weight1)[j] = mpz_get_si(vec[j]);
     2191  }
     2192  while(test_w_in_ConeCC(G,diff_weight1))
     2193  {
     2194    for(j=0; j<nRing; j++)
     2195    {
     2196      (*diff_weight)[j] = (*diff_weight1)[j];
     2197      mpz_set_si(vec[j], (*diff_weight)[j]);     
     2198    }
     2199    for(j=0; j<nRing; j++)
     2200    {
     2201      (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5);
     2202    }
     2203  }
     2204  if(MivAbsMax(diff_weight)>10000)
     2205  {
     2206    for(j=0; j<nRing; j++)
     2207    {
     2208      (*diff_weight1)[j] = (*diff_weight)[j];
     2209    }
     2210    j = 0;
     2211    while(test_w_in_ConeCC(G,diff_weight1))
     2212    {
     2213      (*diff_weight)[j] = (*diff_weight1)[j];
     2214      mpz_set_si(vec[j], (*diff_weight)[j]);
     2215      j = MivAbsMaxArg(diff_weight1);
     2216      (*diff_weight1)[j] = floor(0.1*(*diff_weight1)[j] + 0.5);
     2217    }
     2218    goto SIMPLIFY_GCD;
    21882219  }
    21892220
     
    22242255   mpz_clear(t_null);
    22252256
    2226 
    2227 
    22282257  if(Overflow_Error == FALSE)
    22292258  {
    22302259    Overflow_Error = nError;
    22312260  }
    2232  rComplete(currRing);
    2233   for(kkk=0; kkk<IDELEMS(G);kkk++)
    2234   {
    2235     poly p=G->m[kkk];
     2261  rComplete(currRing);
     2262  for(j=0; j<IDELEMS(G); j++)
     2263  {
     2264    poly p=G->m[j];
    22362265    while(p!=NULL)
    22372266    {
     
    22732302}
    22742303
    2275 /**************************************************************
     2304/********************************************************************
    22762305 * define and execute a new ring which order is (a(vb),a(va),lp,C)  *
    2277  * ************************************************************/
     2306 * ******************************************************************/
    22782307static void VMrHomogeneous(intvec* va, intvec* vb)
    22792308{
     
    24272456  //rChangeCurrRing(r);
    24282457}
    2429 
     2458//unused
     2459#if 0
    24302460static ring VMrDefault1(intvec* va)
    24312461{
     
    24982528  return r;
    24992529}
    2500 
     2530#endif
    25012531/****************************************************************
    25022532 * define and execute a new ring with ordering (a(va),Wp(vb),C) *
     
    31283158    else
    31293159    {
    3130       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung
     3160      rChangeCurrRing(VMrDefault(curr_weight));
    31313161    }
    31323162    newRing = currRing;
     
    38843914    else
    38853915    {
    3886       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung
     3916      rChangeCurrRing(VMrDefault(curr_weight));
    38873917    }
    38883918    newRing = currRing;
     
    41454175    else
    41464176    {
    4147       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung
     4177      rChangeCurrRing(VMrDefault(curr_weight));
    41484178    }
    41494179    newRing = currRing;
     
    42874317intvec* Xivlp;
    42884318
    4289 #if 0
    4290 /********************************
    4291  * compute a next weight vector *
    4292  ********************************/
    4293 static intvec* MWalkRandomNextWeight(ideal G, intvec* curr_weight, intvec* target_weight, int weight_rad, int pert_deg)
    4294 {
    4295   int i, weight_norm;
    4296   int nV = currRing->N;
    4297   intvec* next_weight2;
    4298   intvec* next_weight22 = new intvec(nV);
    4299   intvec* next_weight = MwalkNextWeightCC(curr_weight,target_weight, G);
    4300   if(MivComp(next_weight, target_weight) == 1)
    4301   {
    4302     return(next_weight);
    4303   }
    4304   else
    4305   {
    4306     //compute a perturbed next weight vector "next_weight1"
    4307     intvec* next_weight1 = MkInterRedNextWeight(MPertVectors(G, MivMatrixOrder(curr_weight), pert_deg), target_weight, G);
    4308     //Print("\n // size of next_weight1 = %d", sizeof((*next_weight1)));
    4309 
    4310     //compute a random next weight vector "next_weight2"
    4311     while(1)
    4312     {
    4313       weight_norm = 0;
    4314       while(weight_norm == 0)
    4315       {
    4316         for(i=0; i<nV; i++)
    4317         {
    4318           //Print("\n//  next_weight[%d]  = %d", i, (*next_weight)[i]);
    4319           (*next_weight22)[i] = rand() % 60000 - 30000;
    4320           weight_norm = weight_norm + (*next_weight22)[i]*(*next_weight22)[i];
    4321         }
    4322         weight_norm = 1 + floor(sqrt(weight_norm));
    4323       }
    4324 
    4325       for(i=nV-1; i>=0; i--)
    4326       {
    4327         if((*next_weight22)[i] < 0)
    4328         {
    4329           (*next_weight22)[i] = 1 + (*curr_weight)[i] + floor(weight_rad*(*next_weight22)[i]/weight_norm);
    4330         }
    4331         else
    4332         {
    4333           (*next_weight22)[i] = (*curr_weight)[i] + floor(weight_rad*(*next_weight22)[i]/weight_norm);
    4334         }
    4335       //Print("\n//  next_weight22[%d]  = %d", i, (*next_weight22)[i]);
    4336       }
    4337 
    4338       if(test_w_in_ConeCC(G, next_weight22) == 1)
    4339       {
    4340         //Print("\n//MWalkRandomNextWeight: next_weight2 im Kegel\n");
    4341         next_weight2 = MkInterRedNextWeight(next_weight22, target_weight, G);
    4342         delete next_weight22;
    4343         break;
    4344       }
    4345     }
    4346     intvec* result = new intvec(nV);
    4347     ideal G_test = MwalkInitialForm(G, next_weight);
    4348     ideal G_test1 = MwalkInitialForm(G, next_weight1);
    4349     ideal G_test2 = MwalkInitialForm(G, next_weight2);
    4350 
    4351     // compare next_weights
    4352     if(IDELEMS(G_test1) < IDELEMS(G_test))
    4353     {
    4354       if(IDELEMS(G_test2) <= IDELEMS(G_test1)) // |G_test2| <= |G_test1| < |G_test|
    4355       {
    4356         for(i=0; i<nV; i++)
    4357         {
    4358           (*result)[i] = (*next_weight2)[i];
    4359         }
    4360       }
    4361       else // |G_test1| < |G_test|, |G_test1| < |G_test2|
    4362       {
    4363         for(i=0; i<nV; i++)
    4364         {
    4365           (*result)[i] = (*next_weight1)[i];
    4366         }
    4367       }
    4368     }
    4369     else
    4370     {
    4371       if(IDELEMS(G_test2) <= IDELEMS(G_test)) // |G_test2| <= |G_test| <= |G_test1|
    4372       {
    4373         for(i=0; i<nV; i++)
    4374         {
    4375           (*result)[i] = (*next_weight2)[i];
    4376         }
    4377       }
    4378       else // |G_test| <= |G_test1|, |G_test| < |G_test2|
    4379       {
    4380         for(i=0; i<nV; i++)
    4381         {
    4382           (*result)[i] = (*next_weight)[i];
    4383         }
    4384       }
    4385     }
    4386     delete next_weight;
    4387     delete next_weight1;
    4388     idDelete(&G_test);
    4389     idDelete(&G_test1);
    4390     idDelete(&G_test2);
    4391     if(test_w_in_ConeCC(G, result) == 1)
    4392     {
    4393       delete next_weight2;
    4394       return result;
    4395     }
    4396     else
    4397     {
    4398       delete result;
    4399       return next_weight2;
    4400     }
    4401   }
    4402 }
    4403 #endif
    44044319
    44054320/********************************
     
    44164331
    44174332  //compute a perturbed next weight vector "next_weight1"
    4418   //intvec* next_weight1 = MkInterRedNextWeight(MPertVectors(G,MivMatrixOrderRefine(curr_weight,target_weight),pert_deg),target_weight,G);
    44194333  intvec* next_weight1 =MkInterRedNextWeight(curr_weight,target_weight,G);
    44204334  //compute a random next weight vector "next_weight2"
     
    44454359    {
    44464360      next_weight2 = MkInterRedNextWeight(next_weight22,target_weight,G);
     4361      if(MivAbsMax(next_weight2)>1147483647)
     4362      {
     4363        for(i=0; i<nV; i++)
     4364        {
     4365          (*next_weight22)[i] = (*next_weight2)[i];
     4366        }
     4367        i = 0;
     4368        while(test_w_in_ConeCC(G,next_weight22))
     4369        {
     4370          (*next_weight2)[i] = (*next_weight22)[i];
     4371          i = MivAbsMaxArg(next_weight22);
     4372          (*next_weight22)[i] = floor(0.1*(*next_weight22)[i] + 0.5);
     4373        }
     4374      }
    44474375      delete next_weight22;
    44484376      break;
     
    45754503    else
    45764504    {
    4577       rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung
     4505      rChangeCurrRing(VMrDefault(orig_target_weight));
    45784506    }
    45794507    TargetRing = currRing;
     
    46464574    else
    46474575    {
    4648       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung
     4576      rChangeCurrRing(VMrDefault(curr_weight));
    46494577    }
    46504578    newRing = currRing;
     
    47554683    else
    47564684    {
    4757       rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung
     4685      rChangeCurrRing(VMrDefault(orig_target_weight));
    47584686    }
    47594687    F1 = idrMoveR(G, newRing,currRing);
     
    47864714      else
    47874715      {
    4788         rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung
     4716        rChangeCurrRing(VMrDefault(orig_target_weight));
    47894717      }
    47904718    KSTD_Finish:
     
    48844812      tim = clock();
    48854813      /*
    4886         Print("\n// **** Grᅵbnerwalk took %d steps and ", nwalk);
     4814        Print("\n// **** Groebnerwalk took %d steps and ", nwalk);
    48874815        PrintS("\n// **** call the rec. Pert. Walk to compute a red GB of:");
    48884816        idElements(Gomega, "G_omega");
     
    49144842      oldRing = currRing;
    49154843
    4916       /* create a new ring newRing */
     4844      // create a new ring newRing
    49174845       if (rParameter(currRing) != NULL)
    49184846       {
     
    49214849       else
    49224850       {
    4923          rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung
     4851         rChangeCurrRing(VMrDefault(curr_weight));
    49244852       }
    49254853      newRing = currRing;
     
    49474875      else
    49484876      {
    4949         rChangeCurrRing(VMrDefault(curr_weight));  //Aenderung
     4877        rChangeCurrRing(VMrDefault(curr_weight));
    49504878      }
    49514879      newRing = currRing;
     
    49594887      M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
    49604888      delete hilb_func;
    4961 #endif // BUCHBERGER_ALG
     4889#endif
    49624890      tstd = tstd + clock() - to;
    49634891
     
    49684896
    49694897      to = clock();
    4970       // compute a representation of the generators of submod (M) with respect to those of mod (Gomega). Gomega is a reduced Groebner basis w.r.t. the current ring.
     4898      // compute a representation of the generators of submod (M) with respect
     4899      // to those of mod (Gomega).
     4900      // Gomega is a reduced Groebner basis w.r.t. the current ring.
    49714901      F = MLifttwoIdeal(Gomega2, M1, G);
    49724902      tlift = tlift + clock() - to;
     
    50184948      else
    50194949      {
    5020         rChangeCurrRing(VMrDefault(target_weight)); // Aenderung
     4950        rChangeCurrRing(VMrDefault(target_weight));
    50214951      }
    50224952      F1 = idrMoveR(G, newRing,currRing);
     
    50654995 * THE GROEBNER WALK ALGORITHM *
    50664996 *******************************/
    5067 ideal Mwalk(ideal Go, intvec* orig_M, intvec* target_M, ring baseRing)
     4997ideal Mwalk(ideal Go, intvec* orig_M, intvec* target_M,
     4998            ring baseRing, int reduction, int printout)
    50684999{
    5069   BITSET save1 = si_opt_1; // save current options
    5070   //si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
    5071   //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
    5072   //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
     5000  // save current options
     5001  BITSET save1 = si_opt_1;
     5002  if(reduction == 0)
     5003  {
     5004    // no reduced Groebner basis
     5005    si_opt_1 &= (~Sy_bit(OPT_REDSB));
     5006    // not tail reductions
     5007    //si_opt_1 &= (~Sy_bit(OPT_REDTAIL));
     5008  }
    50735009  Set_Error(FALSE);
    50745010  Overflow_Error = FALSE;
     
    51115047#endif
    51125048  rComplete(currRing);
    5113 #ifdef CHECK_IDEAL_MWALK
    5114     idString(Go,"Go");
    5115 #endif
     5049//#ifdef CHECK_IDEAL_MWALK
     5050  if(printout > 2)
     5051  {
     5052    idString(Go,"//** Mwalk: Go");
     5053  }
     5054//#endif
    51165055#ifdef TIME_TEST
    51175056  to = clock();
    51185057#endif
    5119      if(orig_M->length() == nV)
    5120       {
    5121         newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
    5122       }
    5123       else
    5124       {
    5125         newRing = VMatrDefault(orig_M);
    5126       }
     5058  if(orig_M->length() == nV)
     5059  {
     5060    // define a new ring with ordering "(a(curr_weight),lp)
     5061    newRing = VMrDefault(curr_weight);
     5062  }
     5063  else
     5064  {
     5065    newRing = VMatrDefault(orig_M);
     5066  }
    51275067  rChangeCurrRing(newRing);
    51285068  ideal G = MstdCC(idrMoveR(Go,baseRing,currRing));
     
    51405080    to = clock();
    51415081#endif
    5142 #ifdef CHECK_IDEAL_MWALK
    5143     idString(G,"G");
    5144 #endif
    5145     Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
     5082//#ifdef CHECK_IDEAL_MWALK
     5083    if(printout > 2)
     5084    {
     5085      idString(G,"//** Mwalk: G");
     5086    }
     5087//#endif
     5088    // compute an initial form ideal of <G> w.r.t. "curr_vector"
     5089    Gomega = MwalkInitialForm(G, curr_weight);
    51465090#ifdef TIME_TEST
    5147     tif = tif + clock()-to; //time for computing initial form ideal
    5148 #endif
    5149 #ifdef CHECK_IDEAL_MWALK
    5150     idString(Gomega,"Gomega");
    5151 #endif
     5091    //time for computing initial form ideal
     5092    tif = tif + clock()-to;
     5093#endif
     5094//#ifdef CHECK_IDEAL_MWALK
     5095    if(printout > 1)
     5096    {
     5097      idString(Gomega,"//** Mwalk: Gomega");
     5098    }
     5099//#endif
    51525100#ifndef  BUCHBERGER_ALG
    51535101    if(isNolVector(curr_weight) == 0)
     
    51645112      if(orig_M->length() == nV)
    51655113      {
    5166         newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
     5114        // define a new ring with ordering "(a(curr_weight),lp)
     5115        newRing = VMrDefault(curr_weight);
    51675116      }
    51685117      else
     
    51755124     if(target_M->length() == nV)
    51765125     {
    5177        newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))"
     5126       //define a new ring with ordering "(a(curr_weight),Wp(target_weight))"
     5127       newRing = VMrRefine(curr_weight,target_weight);
    51785128     }
    51795129     else
    51805130     {
     5131       //define a new ring with matrix ordering
    51815132       newRing = VMatrRefine(target_M,curr_weight);
    51825133     }
     
    51995150#endif
    52005151    idSkipZeroes(M);
    5201 #ifdef CHECK_IDEAL_MWALK
    5202     PrintS("\n//** Mwalk: computed M.\n");
    5203     idString(M, "M");
    5204 #endif
     5152//#ifdef CHECK_IDEAL_MWALK
     5153    if(printout > 2)
     5154    {
     5155      idString(M, "//** Mwalk: M");
     5156    }
     5157//#endif
    52055158    //change the ring to baseRing
    52065159    rChangeCurrRing(baseRing);
     
    52125165    to = clock();
    52135166#endif
    5214     // compute a representation of the generators of submod (M) with respect to those of mod (Gomega), where Gomega is a reduced Groebner basis w.r.t. the current ring
     5167    // compute a representation of the generators of submod (M) with respect to those of mod (Gomega),
     5168    // where Gomega is a reduced Groebner basis w.r.t. the current ring
    52155169    F = MLifttwoIdeal(Gomega2, M1, G);
    52165170#ifdef TIME_TEST
    52175171    tlift = tlift + clock() - to;
    52185172#endif
    5219 #ifdef CHECK_IDEAL_MWALK
    5220     idString(F, "F");
    5221 #endif
     5173//#ifdef CHECK_IDEAL_MWALK
     5174    if(printout > 2)
     5175    {
     5176      idString(F, "//** Mwalk: F");
     5177    }
     5178//#endif
    52225179    idDelete(&Gomega2);
    52235180    idDelete(&M1);
     
    52295186    to = clock();
    52305187#endif
    5231     //G = kStd(F1,NULL,testHomog,NULL,NULL,0,0,NULL);
     5188
    52325189#ifdef TIME_TEST
    52335190    tstd = tstd + clock() - to;
    52345191#endif
    52355192    idSkipZeroes(G);
    5236 #ifdef CHECK_IDEAL_MWALK
    5237     idString(G, "G");
    5238 #endif
     5193//#ifdef CHECK_IDEAL_MWALK
     5194    if(printout > 2)
     5195    {
     5196      idString(G, "//** Mwalk: G");
     5197    }
     5198//#endif
    52395199#ifdef TIME_TEST
    52405200    to = clock();
     
    52445204    tnw = tnw + clock() - to;
    52455205#endif
    5246 #ifdef PRINT_VECTORS
    5247     MivString(curr_weight, target_weight, next_weight);
    5248 #endif
    5249     if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1)// || test_w_in_ConeCC(G, target_weight) == 1 || MivComp(next_weight,curr_weight) == 1)
    5250     {
    5251 #ifdef CHECK_IDEAL_MWALK
    5252       PrintS("\n//** Mwalk: entering last cone.\n");
    5253 #endif
     5206//#ifdef PRINT_VECTORS
     5207    if(printout > 0)
     5208    {
     5209      MivString(curr_weight, target_weight, next_weight);
     5210    }
     5211//#endif
     5212    if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1 || test_w_in_ConeCC(G, target_weight) == 1)
     5213    {
     5214//#ifdef CHECK_IDEAL_MWALK
     5215      if(printout > 0)
     5216      {
     5217        PrintS("\n//** Mwalk: entering last cone.\n");
     5218      }
     5219//#endif
    52545220      Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
    52555221      if(target_M->length() == nV)
     
    52645230      Gomega1 = idrMoveR(Gomega, baseRing,currRing);
    52655231      idDelete(&Gomega);
    5266 #ifdef CHECK_IDEAL_MWALK
    5267       idString(Gomega1, "Gomega");
    5268 #endif
     5232//#ifdef CHECK_IDEAL_MWALK
     5233      if(printout > 1)
     5234      {
     5235        idString(Gomega1, "//** Mwalk: Gomega");
     5236      }
     5237//#endif
    52695238      M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
    5270 #ifdef CHECK_IDEAL_MWALK
    5271       idString(M,"M");
    5272 #endif
     5239//#ifdef CHECK_IDEAL_MWALK
     5240      if(printout > 1)
     5241      {
     5242        idString(M,"//** Mwalk: M");
     5243      }
     5244//#endif
    52735245      rChangeCurrRing(baseRing);
    52745246      M1 =  idrMoveR(M, newRing,currRing);
     
    52775249      idDelete(&Gomega1);
    52785250      F = MLifttwoIdeal(Gomega2, M1, G);
    5279 #ifdef CHECK_IDEAL_MWALK
    5280       idString(F,"F");
    5281 #endif
     5251//#ifdef CHECK_IDEAL_MWALK
     5252    if(printout > 2)
     5253    {
     5254      idString(F,"//** Mwalk: F");
     5255    }
     5256//#endif
    52825257      idDelete(&Gomega2);
    52835258      idDelete(&M1);
     
    52915266      to = clock();
    52925267#endif
    5293  //     if(si_opt_1 == (Sy_bit(OPT_REDSB)))
    5294   //    {
    5295         G = kInterRedCC(G,NULL); //reduce the Groebner basis <G> w.r.t. currRing, if option(redSB) is set
    5296   //    }
     5268      //interreduce the Groebner basis <G> w.r.t. currRing
     5269      G = kInterRedCC(G,NULL);
    52975270#ifdef TIME_TEST
    52985271      tred = tred + clock() - to;
     
    53015274      delete next_weight;
    53025275      break;
    5303 #ifdef CHECK_IDEAL_MWALK
    5304       PrintS("\n//** Mwalk: last cone.\n");
    5305 #endif
    5306     }
    5307 #ifdef CHECK_IDEAL_MWALK
    5308     PrintS("\n//** Mwalk: update weight vectors.\n");
    5309 #endif
     5276    }
    53105277    for(i=nV-1; i>=0; i--)
    53115278    {
     
    53185285  ideal result = idrMoveR(G,baseRing,currRing);
    53195286  idDelete(&G);
    5320 /*#ifdef CHECK_IDEAL_MWALK
    5321   pDelete(&p);
    5322 #endif*/
    53235287  delete tmp_weight;
    53245288  delete ivNull;
     
    53285292#endif
    53295293#ifdef TIME_TEST
    5330   Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep);
    53315294  TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep);
    5332   Print("\n//** Mwalk: Ergebnis.\n");
    53335295  //Print("\n// pSetm_Error = (%d)", ErrorCheck());
    53345296  //Print("\n// Overflow_Error? (%d)\n", Overflow_Error);
    53355297#endif
     5298  Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep);
    53365299  return(result);
    53375300}
    53385301
    5339 // 07.11.2012
    5340 // THE RANDOM WALK ALGORITHM  ideal Go, intvec* orig_M, intvec* target_M, ring baseRing
    5341 ideal Mrwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, int pert_deg, ring baseRing)
     5302// THE RANDOM WALK ALGORITHM
     5303ideal Mrwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, int pert_deg,
     5304             int reduction, int printout)
    53425305{
    53435306  BITSET save1 = si_opt_1; // save current options
    5344   //si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
    5345   //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
    5346   //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
     5307  if(reduction == 0)
     5308  {
     5309    si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
     5310    //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
     5311    //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
     5312  }
    53475313  Set_Error(FALSE);
    53485314  Overflow_Error = FALSE;
     
    53545320#endif
    53555321  nstep=0;
    5356   int i,nwalk,endwalks = 0;
    5357   int nV = baseRing->N;
     5322  int i,polylength,nwalk,endwalks = 0;
     5323  int nV = currRing->N;
    53585324
    53595325  ideal Gomega, M, F, Gomega1, Gomega2, M1; //, F1;
    53605326  ring newRing;
    5361   ring XXRing = baseRing;
     5327  ring baseRing = currRing;
     5328  ring XXRing = currRing;
    53625329  intvec* ivNull = new intvec(nV);
    53635330  intvec* curr_weight = new intvec(nV);
     
    53655332  intvec* exivlp = Mivlp(nV);
    53665333  intvec* tmp_weight = new intvec(nV);
     5334  intvec* next_weight= new intvec(nV);
    53675335  for(i=0; i<nV; i++)
    53685336  {
     
    53855353#endif
    53865354  rComplete(currRing);
    5387 #ifdef CHECK_IDEAL_MWALK
    5388     idString(Go,"Go");
    5389 #endif
    53905355#ifdef TIME_TEST
    53915356  to = clock();
    53925357#endif
    5393      if(orig_M->length() == nV)
    5394       {
    5395         newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
    5396       }
    5397       else
    5398       {
    5399         newRing = VMatrDefault(orig_M);
    5400       }
     5358  if(orig_M->length() == nV)
     5359  {
     5360    newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
     5361  }
     5362  else
     5363  {
     5364    newRing = VMatrDefault(orig_M);
     5365  }
    54015366  rChangeCurrRing(newRing);
    54025367  ideal G = MstdCC(idrMoveR(Go,baseRing,currRing));
     
    54145379    to = clock();
    54155380#endif
    5416 #ifdef CHECK_IDEAL_MWALK
    5417     idString(G,"G");
    5418 #endif
     5381//#ifdef CHECK_IDEAL_MWALK
     5382    if(printout > 2)
     5383    {
     5384      idString(G,"//** Mrwalk: G");
     5385    }
     5386//#endif
    54195387    Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
     5388    //polylength = 1 if there is a polynomial in Gomega with at least 3 monomials and 0 otherwise
     5389    polylength = lengthpoly(Gomega);
    54205390#ifdef TIME_TEST
    54215391    tif = tif + clock()-to; //time for computing initial form ideal
    54225392#endif
    5423 #ifdef CHECK_IDEAL_MWALK
    5424     idString(Gomega,"Gomega");
    5425 #endif
     5393//#ifdef CHECK_IDEAL_MWALK
     5394    if(printout > 1)
     5395    {
     5396      idString(Gomega,"//** Mrwalk: Gomega");
     5397    }
     5398//#endif
    54265399#ifndef  BUCHBERGER_ALG
    54275400    if(isNolVector(curr_weight) == 0)
     
    54735446#endif
    54745447    idSkipZeroes(M);
    5475 #ifdef CHECK_IDEAL_MWALK
    5476     PrintS("\n//** Mwalk: computed M.\n");
    5477     idString(M, "M");
    5478 #endif
     5448//#ifdef CHECK_IDEAL_MWALK
     5449    if(printout > 2)
     5450    {
     5451      idString(M, "//** Mrwalk: M");
     5452    }
     5453//#endif
    54795454    //change the ring to baseRing
    54805455    rChangeCurrRing(baseRing);
     
    54865461    to = clock();
    54875462#endif
    5488     // compute a representation of the generators of submod (M) with respect to those of mod (Gomega), where Gomega is a reduced Groebner basis w.r.t. the current ring
     5463    // compute a representation of the generators of submod (M) with respect to those of mod (Gomega),
     5464    // where Gomega is a reduced Groebner basis w.r.t. the current ring
    54895465    F = MLifttwoIdeal(Gomega2, M1, G);
    54905466#ifdef TIME_TEST
    54915467    tlift = tlift + clock() - to;
    54925468#endif
    5493 #ifdef CHECK_IDEAL_MWALK
    5494     idString(F, "F");
    5495 #endif
     5469//#ifdef CHECK_IDEAL_MWALK
     5470    if(printout > 2)
     5471    {
     5472      idString(F, "//** Mrwalk: F");
     5473    }
     5474//#endif
    54965475    idDelete(&Gomega2);
    54975476    idDelete(&M1);
     
    55025481#ifdef TIME_TEST
    55035482    to = clock();
    5504 #endif
    5505     //G = kStd(F1,NULL,testHomog,NULL,NULL,0,0,NULL);
    5506 #ifdef TIME_TEST
    55075483    tstd = tstd + clock() - to;
    55085484#endif
    55095485    idSkipZeroes(G);
    5510 #ifdef CHECK_IDEAL_MWALK
    5511     idString(G, "G");
    5512 #endif
     5486//#ifdef CHECK_IDEAL_MWALK
     5487    if(printout > 2)
     5488    {
     5489      idString(G, "//** Mrwalk: G");
     5490    }
     5491//#endif
    55135492#ifdef TIME_TEST
    55145493    to = clock();
    55155494#endif
    5516     intvec* next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, pert_deg);//next_weight = MwalkNextWeightCC(curr_weight,target_weight,G);
     5495    next_weight = MwalkNextWeightCC(curr_weight,target_weight,G);
     5496    if(polylength > 0)
     5497    {
     5498      //there is a polynomial in Gomega with at least 3 monomials,
     5499      //low-dimensional facet of the cone
     5500      delete next_weight;
     5501      next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, pert_deg);
     5502    }
    55175503#ifdef TIME_TEST
    55185504    tnw = tnw + clock() - to;
    55195505#endif
    5520 #ifdef PRINT_VECTORS
    5521     MivString(curr_weight, target_weight, next_weight);
    5522 #endif
     5506//#ifdef PRINT_VECTORS
     5507    if(printout > 0)
     5508    {
     5509      MivString(curr_weight, target_weight, next_weight);
     5510    }
     5511//#endif
    55235512    if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1)// || test_w_in_ConeCC(G, target_weight) == 1 || MivComp(next_weight,curr_weight) == 1)
    55245513    {
     
    55275516#endif
    55285517      Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
     5518//#ifdef CHECK_IDEAL_MWALK
     5519      if(printout > 1)
     5520      {
     5521        idString(Gomega, "//** Mrwalk: Gomega");
     5522      }
     5523//#endif
    55295524      if(target_M->length() == nV)
    55305525      {
     
    55385533      Gomega1 = idrMoveR(Gomega, baseRing,currRing);
    55395534      idDelete(&Gomega);
    5540 #ifdef CHECK_IDEAL_MWALK
    5541       idString(Gomega1, "Gomega");
    5542 #endif
    55435535      M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
    5544 #ifdef CHECK_IDEAL_MWALK
    5545       idString(M,"M");
    5546 #endif
     5536//#ifdef CHECK_IDEAL_MWALK
     5537      if(printout > 2)
     5538      {
     5539        idString(M,"//** Mrwalk: M");
     5540      }
     5541//#endif
    55475542      rChangeCurrRing(baseRing);
    55485543      M1 =  idrMoveR(M, newRing,currRing);
     
    55515546      idDelete(&Gomega1);
    55525547      F = MLifttwoIdeal(Gomega2, M1, G);
    5553 #ifdef CHECK_IDEAL_MWALK
    5554       idString(F,"F");
    5555 #endif
    55565548      idDelete(&Gomega2);
    55575549      idDelete(&M1);
     
    55605552      idDelete(&F);
    55615553      baseRing = currRing;
    5562       si_opt_1 = save1; //set original options, e. g. option(RedSB)
    55635554      idSkipZeroes(G);
    55645555#ifdef TIME_TEST
    55655556      to = clock();
    55665557#endif
    5567  //     if(si_opt_1 == (Sy_bit(OPT_REDSB)))
    5568   //    {
    5569         //G = kInterRedCC(G,NULL); //reduce the Groebner basis <G> w.r.t. currRing, if option(redSB) is set
    5570   //    }
     5558//#ifdef CHECK_IDEAL_MWALK
     5559      if(printout > 2)
     5560      {
     5561        idString(G,"//** Mrwalk: G");
     5562      }
     5563/*#endif
     5564      if(si_opt_1 == (Sy_bit(OPT_REDSB)))
     5565      {*/
     5566        G = kInterRedCC(G,NULL); //interreduce the Groebner basis <G> w.r.t. currRing
     5567//      }
    55715568#ifdef TIME_TEST
    55725569      tred = tred + clock() - to;
     
    55755572      delete next_weight;
    55765573      break;
    5577 #ifdef CHECK_IDEAL_MWALK
    5578       PrintS("\n//** Mwalk: last cone.\n");
    5579 #endif
    5580     }
    5581 #ifdef CHECK_IDEAL_MWALK
    5582     PrintS("\n//** Mwalk: update weight vectors.\n");
    5583 #endif
     5574    }
    55845575    for(i=nV-1; i>=0; i--)
    55855576    {
     
    55895580    delete next_weight;
    55905581  }
     5582  baseRing = currRing;
    55915583  rChangeCurrRing(XXRing);
    55925584  ideal result = idrMoveR(G,baseRing,currRing);
    55935585  idDelete(&G);
    5594 /*#ifdef CHECK_IDEAL_MWALK
    5595   pDelete(&p);
    5596 #endif*/
     5586  si_opt_1 = save1; //set original options, e. g. option(RedSB)
    55975587  delete tmp_weight;
    55985588  delete ivNull;
     
    56015591  delete last_omega;
    56025592#endif
     5593  Print("\n//** Mrwalk: Groebner Walk took %d steps.\n", nstep);
    56035594#ifdef TIME_TEST
    5604   Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep);
    56055595  TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep);
    5606   Print("\n//** Mwalk: Ergebnis.\n");
    56075596  //Print("\n// pSetm_Error = (%d)", ErrorCheck());
    56085597  //Print("\n// Overflow_Error? (%d)\n", Overflow_Error);
     
    57515740// use kStd, if nP = 0, else call LastGB
    57525741ideal Mpwalk(ideal Go, int op_deg, int tp_deg,intvec* curr_weight,
    5753              intvec* target_weight, int nP)
     5742             intvec* target_weight, int nP, int reduction, int printout)
    57545743{
     5744  BITSET save1 = si_opt_1; // save current options
     5745  if(reduction == 0)
     5746  {
     5747    si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
     5748    //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
     5749    //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
     5750  }
    57555751  Set_Error(FALSE  );
    57565752  Overflow_Error = FALSE;
     
    57905786  ring XXRing = currRing;
    57915787
    5792 
    57935788  to = clock();
    5794   /* perturbs the original vector */
     5789  // perturbs the original vector
    57955790  if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) := "dp"
    57965791  {
     
    58095804      DefRingPar(curr_weight);
    58105805    else
    5811       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 1
     5806      rChangeCurrRing(VMrDefault(curr_weight));
    58125807
    58135808    G = idrMoveR(Go, XXRing,currRing);
     
    58245819  ring HelpRing = currRing;
    58255820
    5826   /* perturbs the target weight vector */
     5821  // perturbs the target weight vector
    58275822  if(tp_deg > 1 && tp_deg <= nV)
    58285823  {
     
    58305825      DefRingPar(target_weight);
    58315826    else
    5832       rChangeCurrRing(VMrDefault(target_weight)); // Aenderung 2
     5827      rChangeCurrRing(VMrDefault(target_weight));
    58335828
    58345829    TargetRing = currRing;
     
    58525847    G = idrMoveR(ssG, TargetRing,currRing);
    58535848  }
    5854   /*
    5855     Print("\n// Perturbationwalkalg. vom Gradpaar (%d,%d):",op_deg,tp_deg);
    5856     ivString(curr_weight, "new sigma");
    5857     ivString(target_weight, "new tau");
    5858   */
     5849    if(printout > 0)
     5850    {
     5851      Print("\n//** Mpwalk: Perturbation Walk of degree (%d,%d):",op_deg,tp_deg);
     5852      ivString(curr_weight, "//** Mpwalk: new current weight");
     5853      ivString(target_weight, "//** Mpwalk: new target weight");
     5854    }
    58595855  while(1)
    58605856  {
     
    58645860       "curr_weight" */
    58655861    Gomega = MwalkInitialForm(G, curr_weight);
    5866 
     5862//#ifdef CHECK_IDEAL_MWALK
     5863      if(printout > 1)
     5864      {
     5865        idString(Gomega,"//** Mpwalk: Gomega");
     5866      }
     5867//#endif
    58675868
    58685869#ifdef ENDWALKS
    5869     if(endwalks == 1){
     5870    if(endwalks == 1)
     5871    {
    58705872      Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
    58715873      idElements(G, "G");
    5872       // idElements(Gomega, "Gw");
    58735874      headidString(G, "G");
    5874       //headidString(Gomega, "Gw");
    58755875    }
    58765876#endif
     
    58915891      DefRingPar(curr_weight);
    58925892    else
    5893       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 3
     5893      rChangeCurrRing(VMrDefault(curr_weight));
    58945894
    58955895    newRing = currRing;
     
    59185918    M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
    59195919    delete hilb_func;
    5920 #endif // BUCHBERGER_ALG
     5920#endif
     5921//#ifdef CHECK_IDEAL_MWALK
     5922      if(printout > 2)
     5923      {
     5924        idString(M,"//** Mpwalk: M");
     5925      }
     5926//#endif
    59215927
    59225928    if(endwalks == 1){
     
    59345940    M1 =  idrMoveR(M, newRing,currRing);
    59355941    Gomega2 =  idrMoveR(Gomega1, newRing,currRing);
    5936 
    5937     //if(endwalks==1)  PrintS("\n// Lifting is working:..");
    59385942
    59395943    to=clock();
     
    59475951      xtlift=clock()-to;
    59485952
     5953//#ifdef CHECK_IDEAL_MWALK
     5954    if(printout > 2)
     5955    {
     5956      idString(F,"//** Mpwalk: F");
     5957    }
     5958//#endif
     5959
    59495960    idDelete(&M1);
    59505961    idDelete(&Gomega2);
     
    59545965    rChangeCurrRing(newRing);
    59555966    F1 = idrMoveR(F, oldRing,currRing);
    5956 
    5957     //if(endwalks==1)PrintS("\n// InterRed is working now:");
    59585967
    59595968    to=clock();
     
    59715980
    59725981    to=clock();
    5973     /* compute a next weight vector */
     5982    // compute a next weight vector
    59745983    next_weight = MkInterRedNextWeight(curr_weight,target_weight, G);
    59755984    tnw=tnw+clock()-to;
    5976 #ifdef PRINT_VECTORS
    5977     MivString(curr_weight, target_weight, next_weight);
    5978 #endif
     5985//#ifdef PRINT_VECTORS
     5986    if(printout > 2)
     5987    {
     5988      MivString(curr_weight, target_weight, next_weight);
     5989    }
     5990//#endif
    59795991
    59805992    if(Overflow_Error == TRUE)
     
    60146026        DefRingPar(orig_target);
    60156027      else
    6016         rChangeCurrRing(VMrDefault(orig_target)); //Aenderung
     6028        rChangeCurrRing(VMrDefault(orig_target));
    60176029
    60186030    TargetRing=currRing;
     
    60686080    Eresult = idrMoveR(G, newRing,currRing);
    60696081  }
     6082  si_opt_1 = save1; //set original options, e. g. option(RedSB)
    60706083  delete ivNull;
    60716084  if(tp_deg != 1)
     
    60826095             tnw+xtnw);
    60836096
    6084   Print("\n// pSetm_Error = (%d)", ErrorCheck());
    6085   Print("\n// It took %d steps and Overflow_Error? (%d)\n", nstep,  Overflow_Error);
    6086 #endif
     6097  //Print("\n// pSetm_Error = (%d)", ErrorCheck());
     6098  //Print("\n// It took %d steps and Overflow_Error? (%d)\n", nstep,  Overflow_Error);
     6099#endif
     6100  Print("\n//** Mpwalk: Perturbation Walk took %d steps.\n", nstep);
     6101  return(Eresult);
     6102}
     6103
     6104/*******************************************************
     6105 * THE PERTURBATION WALK ALGORITHM WITH RANDOM ELEMENT *
     6106 *******************************************************/
     6107ideal Mprwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad,
     6108              int op_deg, int tp_deg, int nP, int reduction, int printout)
     6109{
     6110  BITSET save1 = si_opt_1; // save current options
     6111  if(reduction == 0)
     6112  {
     6113    si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
     6114    //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
     6115    //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
     6116  }
     6117  Set_Error(FALSE);
     6118  Overflow_Error = FALSE;
     6119  //Print("// pSetm_Error = (%d)", ErrorCheck());
     6120
     6121  clock_t  tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
     6122  xtextra=0;
     6123  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
     6124  tinput = clock();
     6125
     6126  clock_t tim;
     6127
     6128  nstep = 0;
     6129  int i, ntwC=1, ntestw=1, polylength, nV = currRing->N;
     6130  int endwalks=0;
     6131
     6132  ideal Gomega, M, F, G, Gomega1, Gomega2, M1,F1,Eresult,ssG;
     6133  ring newRing, oldRing, TargetRing;
     6134  intvec* iv_M_dp;
     6135  intvec* iv_M_lp;
     6136  intvec* exivlp = Mivlp(nV);
     6137  intvec* curr_weight = new intvec(nV);
     6138  intvec* target_weight = new intvec(nV);
     6139  for(i=0; i<nV; i++)
     6140  {
     6141    (*curr_weight)[i] = (*orig_M)[i];
     6142    (*target_weight)[i] = (*target_M)[i];
     6143  }
     6144  intvec* orig_target = target_weight;
     6145  intvec* pert_target_vector = target_weight;
     6146  intvec* ivNull = new intvec(nV);
     6147  intvec* iv_dp = MivUnit(nV);// define (1,1,...,1)
     6148#ifndef BUCHBERGER_ALG
     6149  intvec* hilb_func;
     6150#endif
     6151  intvec* next_weight;
     6152
     6153  // to avoid (1,0,...,0) as the target vector
     6154  intvec* last_omega = new intvec(nV);
     6155  for(i=nV-1; i>0; i--)
     6156    (*last_omega)[i] = 1;
     6157  (*last_omega)[0] = 10000;
     6158
     6159  ring XXRing = currRing;
     6160
     6161  to = clock();
     6162  // perturbs the original vector
     6163  if(orig_M->length() == nV)
     6164  {
     6165    if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) := "dp"
     6166    {
     6167      G = MstdCC(Go);
     6168      tostd = clock()-to;
     6169      if(op_deg != 1)
     6170      {
     6171        iv_M_dp = MivMatrixOrderdp(nV);
     6172        //ivString(iv_M_dp, "iv_M_dp");
     6173        curr_weight = MPertVectors(G, iv_M_dp, op_deg);
     6174      }
     6175    }
     6176    else
     6177    {
     6178      //define ring order := (a(curr_weight),lp);
     6179      if (rParameter(currRing) != NULL)
     6180        DefRingPar(curr_weight);
     6181      else
     6182        rChangeCurrRing(VMrDefault(curr_weight));
     6183
     6184      G = idrMoveR(Go, XXRing,currRing);
     6185      G = MstdCC(G);
     6186      tostd = clock()-to;
     6187      if(op_deg != 1)
     6188      {
     6189        iv_M_dp = MivMatrixOrder(curr_weight);
     6190        curr_weight = MPertVectors(G, iv_M_dp, op_deg);
     6191      }
     6192    }
     6193  }
     6194  else
     6195  {
     6196    rChangeCurrRing(VMatrDefault(orig_M));
     6197    G = idrMoveR(Go, XXRing,currRing);
     6198    G = MstdCC(G);
     6199    tostd = clock()-to;
     6200    if(op_deg != 1)
     6201    {
     6202      curr_weight = MPertVectors(G, orig_M, op_deg);
     6203    }
     6204  }
     6205
     6206  delete iv_dp;
     6207  if(op_deg != 1) delete iv_M_dp;
     6208
     6209  ring HelpRing = currRing;
     6210
     6211  // perturbs the target weight vector
     6212  if(target_M->length() == nV)
     6213  {
     6214    if(tp_deg > 1 && tp_deg <= nV)
     6215    {
     6216      if (rParameter(currRing) != NULL)
     6217        DefRingPar(target_weight);
     6218      else
     6219        rChangeCurrRing(VMrDefault(target_weight));
     6220
     6221      TargetRing = currRing;
     6222      ssG = idrMoveR(G,HelpRing,currRing);
     6223      if(MivSame(target_weight, exivlp) == 1)
     6224      {
     6225        iv_M_lp = MivMatrixOrderlp(nV);
     6226        //ivString(iv_M_lp, "iv_M_lp");
     6227        //target_weight = MPertVectorslp(ssG, iv_M_lp, tp_deg);
     6228        target_weight = MPertVectors(ssG, iv_M_lp, tp_deg);
     6229      }
     6230      else
     6231      {
     6232        iv_M_lp = MivMatrixOrder(target_weight);
     6233        //target_weight = MPertVectorslp(ssG, iv_M_lp, tp_deg);
     6234        target_weight = MPertVectors(ssG, iv_M_lp, tp_deg);
     6235      }
     6236      delete iv_M_lp;
     6237      pert_target_vector = target_weight;
     6238      rChangeCurrRing(HelpRing);
     6239      G = idrMoveR(ssG, TargetRing,currRing);
     6240    }
     6241  }
     6242  else
     6243  {
     6244    if(tp_deg > 1 && tp_deg <= nV)
     6245    {
     6246      rChangeCurrRing(VMatrDefault(target_M));
     6247      TargetRing = currRing;
     6248      ssG = idrMoveR(G,HelpRing,currRing);
     6249      target_weight = MPertVectors(ssG, target_M, tp_deg);
     6250    }
     6251  }
     6252  if(printout > 0)
     6253  {
     6254    Print("\n//** Mprwalk: Random Perturbation Walk of degree (%d,%d):",op_deg,tp_deg);
     6255    ivString(curr_weight, "//** Mprwalk: new current weight");
     6256    ivString(target_weight, "//** Mprwalk: new target weight");
     6257  }
     6258  while(1)
     6259  {
     6260    nstep ++;
     6261    to = clock();
     6262    /* compute an initial form ideal of <G> w.r.t. the weight vector
     6263       "curr_weight" */
     6264    Gomega = MwalkInitialForm(G, curr_weight);
     6265//#ifdef CHECK_IDEAL_MWALK
     6266    if(printout > 1)
     6267    {
     6268      idString(Gomega,"//** Mprwalk: Gomega");
     6269    }
     6270//#endif
     6271    polylength = lengthpoly(Gomega);
     6272#ifdef ENDWALKS
     6273    if(endwalks == 1)
     6274    {
     6275      Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
     6276      idElements(G, "G");
     6277      headidString(G, "G");
     6278    }
     6279#endif
     6280
     6281    tif = tif + clock()-to;
     6282
     6283#ifndef  BUCHBERGER_ALG
     6284    if(isNolVector(curr_weight) == 0)
     6285      hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
     6286    else
     6287      hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
     6288#endif // BUCHBERGER_ALG
     6289
     6290    oldRing = currRing;
     6291
     6292    if(target_M->length() == nV)
     6293    {
     6294      // define a new ring with ordering "(a(curr_weight),lp)
     6295      if (rParameter(currRing) != NULL)
     6296        DefRingPar(curr_weight);
     6297      else
     6298        rChangeCurrRing(VMrDefault(curr_weight));
     6299    }
     6300    else
     6301    {
     6302      rChangeCurrRing(VMatrRefine(target_M,curr_weight));
     6303    }
     6304    newRing = currRing;
     6305    Gomega1 = idrMoveR(Gomega, oldRing,currRing);
     6306
     6307#ifdef ENDWALKS
     6308    if(endwalks==1)
     6309    {
     6310      Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
     6311      idElements(Gomega1, "Gw");
     6312      headidString(Gomega1, "headGw");
     6313      PrintS("\n// compute a rGB of Gw:\n");
     6314
     6315#ifndef  BUCHBERGER_ALG
     6316      ivString(hilb_func, "w");
     6317#endif
     6318    }
     6319#endif
     6320
     6321    tim = clock();
     6322    to = clock();
     6323    /* compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" */
     6324#ifdef  BUCHBERGER_ALG
     6325    M = MstdhomCC(Gomega1);
     6326#else
     6327    M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
     6328    delete hilb_func;
     6329#endif
     6330//#ifdef CHECK_IDEAL_MWALK
     6331    if(printout > 2)
     6332    {
     6333      idString(M,"//** Mprwalk: M");
     6334    }
     6335//#endif
     6336
     6337    if(endwalks == 1)
     6338    {
     6339      xtstd = xtstd+clock()-to;
     6340#ifdef ENDWALKS
     6341      Print("\n// time for the last std(Gw)  = %.2f sec\n",
     6342            ((double) clock())/1000000 -((double)tim) /1000000);
     6343#endif
     6344    }
     6345    else
     6346      tstd=tstd+clock()-to;
     6347
     6348    /* change the ring to oldRing */
     6349    rChangeCurrRing(oldRing);
     6350    M1 =  idrMoveR(M, newRing,currRing);
     6351    Gomega2 =  idrMoveR(Gomega1, newRing,currRing);
     6352
     6353    to=clock();
     6354    /* compute a representation of the generators of submod (M)
     6355       with respect to those of mod (Gomega).
     6356       Gomega is a reduced Groebner basis w.r.t. the current ring */
     6357    F = MLifttwoIdeal(Gomega2, M1, G);
     6358    if(endwalks != 1)
     6359      tlift = tlift+clock()-to;
     6360    else
     6361      xtlift=clock()-to;
     6362
     6363//#ifdef CHECK_IDEAL_MWALK
     6364    if(printout > 2)
     6365    {
     6366      idString(F,"//** Mprwalk: F");
     6367    }
     6368//#endif
     6369
     6370    idDelete(&M1);
     6371    idDelete(&Gomega2);
     6372    idDelete(&G);
     6373
     6374    /* change the ring to newRing */
     6375    rChangeCurrRing(newRing);
     6376    F1 = idrMoveR(F, oldRing,currRing);
     6377
     6378    to=clock();
     6379    /* reduce the Groebner basis <G> w.r.t. new ring */
     6380    G = kInterRedCC(F1, NULL);
     6381    if(endwalks != 1)
     6382      tred = tred+clock()-to;
     6383    else
     6384      xtred=clock()-to;
     6385
     6386    idDelete(&F1);
     6387
     6388    if(endwalks == 1)
     6389      break;
     6390
     6391    to=clock();
     6392    // compute a next weight vector
     6393    next_weight = MkInterRedNextWeight(curr_weight,target_weight, G);
     6394    if(polylength > 0)
     6395    {
     6396      //there is a polynomial in Gomega with at least 3 monomials,
     6397      //low-dimensional facet of the cone
     6398      delete next_weight;
     6399      next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, op_deg);
     6400    }
     6401    tnw=tnw+clock()-to;
     6402//#ifdef PRINT_VECTORS
     6403    if(printout > 2)
     6404    {
     6405      MivString(curr_weight, target_weight, next_weight);
     6406    }
     6407//#endif
     6408
     6409    if(Overflow_Error == TRUE)
     6410    {
     6411      ntwC = 0;
     6412      //ntestomega = 1;
     6413      //Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
     6414      //idElements(G, "G");
     6415      delete next_weight;
     6416      goto FINISH_160302;
     6417    }
     6418    if(MivComp(next_weight, ivNull) == 1){
     6419      newRing = currRing;
     6420      delete next_weight;
     6421      //Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
     6422      break;
     6423    }
     6424    if(MivComp(next_weight, target_weight) == 1)
     6425      endwalks = 1;
     6426
     6427    for(i=nV-1; i>=0; i--)
     6428      (*curr_weight)[i] = (*next_weight)[i];
     6429
     6430    delete next_weight;
     6431  }//while
     6432
     6433  if(tp_deg != 1)
     6434  {
     6435    FINISH_160302:
     6436    if(target_M->length() == nV)
     6437    {
     6438      if(MivSame(orig_target, exivlp) == 1)
     6439        if (rParameter(currRing) != NULL)
     6440          DefRingParlp();
     6441        else
     6442          VMrDefaultlp();
     6443      else
     6444        if (rParameter(currRing) != NULL)
     6445          DefRingPar(orig_target);
     6446        else
     6447          rChangeCurrRing(VMrDefault(orig_target));
     6448    }
     6449    else
     6450    {
     6451      rChangeCurrRing(VMatrDefault(target_M));
     6452    }
     6453    TargetRing=currRing;
     6454    F1 = idrMoveR(G, newRing,currRing);
     6455#ifdef CHECK_IDEAL
     6456      headidString(G, "G");
     6457#endif
     6458
     6459    // check whether the pertubed target vector stays in the correct cone
     6460    if(ntwC != 0){
     6461      ntestw = test_w_in_ConeCC(F1, pert_target_vector);
     6462    }
     6463
     6464    if( ntestw != 1 || ntwC == 0)
     6465    {
     6466      /*
     6467      if(ntestw != 1){
     6468        ivString(pert_target_vector, "tau");
     6469        PrintS("\n// ** perturbed target vector doesn't stay in cone!!");
     6470        Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
     6471        idElements(F1, "G");
     6472      }
     6473      */
     6474      // LastGB is "better" than the kStd subroutine
     6475      to=clock();
     6476      ideal eF1;
     6477      if(nP == 0 || tp_deg == 1 || MivSame(orig_target, exivlp) != 1 || target_M->length() != nV){
     6478        // PrintS("\n// ** calls \"std\" to compute a GB");
     6479        eF1 = MstdCC(F1);
     6480        idDelete(&F1);
     6481      }
     6482      else {
     6483        // PrintS("\n// ** calls \"LastGB\" to compute a GB");
     6484        rChangeCurrRing(newRing);
     6485        ideal F2 = idrMoveR(F1, TargetRing,currRing);
     6486        eF1 = LastGB(F2, curr_weight, tp_deg-1);
     6487        F2=NULL;
     6488      }
     6489      xtextra=clock()-to;
     6490      ring exTargetRing = currRing;
     6491
     6492      rChangeCurrRing(XXRing);
     6493      Eresult = idrMoveR(eF1, exTargetRing,currRing);
     6494    }
     6495    else{
     6496      rChangeCurrRing(XXRing);
     6497      Eresult = idrMoveR(F1, TargetRing,currRing);
     6498    }
     6499  }
     6500  else {
     6501    rChangeCurrRing(XXRing);
     6502    Eresult = idrMoveR(G, newRing,currRing);
     6503  }
     6504  si_opt_1 = save1; //set original options, e. g. option(RedSB)
     6505  delete ivNull;
     6506  if(tp_deg != 1)
     6507    delete target_weight;
     6508
     6509  if(op_deg != 1 )
     6510    delete curr_weight;
     6511
     6512  delete exivlp;
     6513  delete last_omega;
     6514
     6515#ifdef TIME_TEST
     6516  TimeStringFractal(tinput, tostd, tif+xtif, tstd+xtstd,0, tlift+xtlift, tred+xtred,
     6517             tnw+xtnw);
     6518
     6519  //Print("\n// pSetm_Error = (%d)", ErrorCheck());
     6520  //Print("\n// It took %d steps and Overflow_Error? (%d)\n", nstep,  Overflow_Error);
     6521#endif
     6522  Print("\n//** Mprwalk: Perturbation Walk took %d steps.\n", nstep);
    60876523  return(Eresult);
    60886524}
     
    61106546 * Perturb the start weight vector at the top level, i.e. nlev = 1     *
    61116547 ***********************************************************************/
    6112 static ideal rec_fractal_call(ideal G, int nlev, intvec* omtmp)
     6548static ideal rec_fractal_call(ideal G, int nlev, intvec* ivtarget, int printout)
    61136549{
    61146550  Overflow_Error =  FALSE;
     
    61276563  intvec* next_vect;
    61286564  intvec* omega2 = new intvec(nV);
     6565  intvec* omtmp = new intvec(nV);
    61296566  intvec* altomega = new intvec(nV);
    61306567
     6568  for(i = nV -1; i>0; i--)
     6569  {
     6570    (*omtmp)[i] = (*ivtarget)[i];
     6571  }
    61316572  //BOOLEAN isnewtarget = FALSE;
    61326573
     
    61696610    NEXT_VECTOR_FRACTAL:
    61706611    to=clock();
    6171     /* determine the next border */
     6612    // determine the next border
    61726613    next_vect = MkInterRedNextWeight(omega,omega2,G);
    61736614    xtnw=xtnw+clock()-to;
    6174 #ifdef PRINT_VECTORS
    6175     MivString(omega, omega2, next_vect);
    6176 #endif
     6615
    61776616    oRing = currRing;
    61786617
    6179     /* We only perturb the current target vector at the recursion  level 1 */
     6618    // We only perturb the current target vector at the recursion  level 1
    61806619    if(Xngleich == 0 && nlev == 1) //(ngleich == 0) important, e.g. ex2, ex3
    61816620      if (MivComp(next_vect, omega2) == 1)
    61826621      {
    6183         /* to dispense with taking initial (and lifting/interreducing
    6184            after the call of recursion */
    6185         //Print("\n\n// ** Perturb the both vectors with degree %d with",nlev);
    6186         //idElements(G, "G");
     6622        // to dispense with taking initial (and lifting/interreducing
     6623        // after the call of recursion
     6624        if(printout > 0)
     6625        {
     6626          Print("\n//** rec_fractal_call: Perturb the both vectors with degree %d.",nlev);
     6627          //idElements(G, "G");
     6628        }
    61876629
    61886630        Xngleich = 1;
    61896631        nlev +=1;
    61906632
    6191         if (rParameter(currRing) != NULL)
    6192           DefRingPar(omtmp);
     6633        if(ivtarget->length() == nV)
     6634        {
     6635          if (rParameter(currRing) != NULL)
     6636            DefRingPar(omtmp);
     6637          else
     6638            rChangeCurrRing(VMrDefault(omtmp));
     6639        }
    61936640        else
    6194           rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung3
    6195 
     6641        {
     6642          rChangeCurrRing(VMatrDefault(ivtarget));
     6643        }
    61966644        testring = currRing;
    61976645        Gt = idrMoveR(G, oRing,currRing);
    61986646
    6199         /* perturb the original target vector w.r.t. the current GB */
    6200         delete Xtau;
    6201         Xtau = NewVectorlp(Gt);
     6647        // perturb the original target vector w.r.t. the current GB
     6648        if(ivtarget->length() == nV)
     6649        {
     6650          delete Xtau;
     6651          Xtau = NewVectorlp(Gt);
     6652        }
     6653        else
     6654        {
     6655          delete Xtau;
     6656          Xtau = Mfpertvector(Gt,ivtarget);
     6657        }
    62026658
    62036659        rChangeCurrRing(oRing);
    62046660        G = idrMoveR(Gt, testring,currRing);
    62056661
    6206         /* perturb the current vector w.r.t. the current GB */
     6662        // perturb the current vector w.r.t. the current GB
    62076663        Mwlp = MivWeightOrderlp(omega);
    62086664        Xsigma = Mfpertvector(G, Mwlp);
     
    62226678        next_vect = MkInterRedNextWeight(omega,omega2,G);
    62236679        xtnw=xtnw+clock()-to;
    6224 
    6225 #ifdef PRINT_VECTORS
     6680      }
     6681//#ifdef PRINT_VECTORS
     6682      if(printout > 0)
     6683      {
    62266684        MivString(omega, omega2, next_vect);
    6227 #endif
    6228       }
    6229 
     6685      }
     6686//#endif
    62306687
    62316688    /* check whether the the computed vector is in the correct cone */
     
    62366693    {
    62376694      delete next_vect;
    6238       if (rParameter(currRing) != NULL)
    6239       {
    6240         DefRingPar(omtmp);
     6695      if(ivtarget->length() == nV)
     6696      {
     6697        if (rParameter(currRing) != NULL)
     6698          DefRingPar(omtmp);
     6699        else
     6700          rChangeCurrRing(VMrDefault(omtmp));
    62416701      }
    62426702      else
    62436703      {
    6244         rChangeCurrRing(VMrDefault1(omtmp)); // Aenderung4
     6704        rChangeCurrRing(VMatrDefault(ivtarget));
    62456705      }
    62466706#ifdef TEST_OVERFLOW
     
    62486708      Gt = NULL; return(Gt);
    62496709#endif
    6250 
    6251       //Print("\n\n// apply BB's alg. in ring r = %s;", rString(currRing));
     6710      if(printout > 0)
     6711      {
     6712        Print("\n//** rec_fractal_call: applying Buchberger's algorithm in ring r = %s;",
     6713              rString(currRing));
     6714      }
    62526715      to=clock();
    62536716      Gt = idrMoveR(G, oRing,currRing);
     
    62586721      delete omega2;
    62596722      delete altomega;
    6260 
    6261       //Print("\n// Leaving the %d-th recursion with %d steps", nlev, nwalks);
    6262       //Print("  ** Overflow_Error? (%d)", Overflow_Error);
     6723      if(printout > 0)
     6724      {
     6725        Print("\n//** rec_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     6726              nlev, nwalks);
     6727        //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     6728      }
     6729
    62636730      nnflow ++;
    62646731
     
    62776744    if (MivComp(next_vect, XivNull) == 1)
    62786745    {
    6279       if (rParameter(currRing) != NULL)
    6280         DefRingPar(omtmp);
     6746      if(ivtarget->length() == nV)
     6747      {
     6748        if (rParameter(currRing) != NULL)
     6749          DefRingPar(omtmp);
     6750        else
     6751          rChangeCurrRing(VMrDefault(omtmp));
     6752      }
    62816753      else
    6282         rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung5
     6754      {
     6755        rChangeCurrRing(VMatrDefault(ivtarget));
     6756      }
    62836757
    62846758      testring = currRing;
     
    62896763        delete next_vect;
    62906764        delete altomega;
    6291         //Print("\n// Leaving the %d-th recursion with %d steps ",nlev, nwalks);
    6292         //Print(" ** Overflow_Error? (%d)", Overflow_Error);
    6293 
     6765        if(printout > 0)
     6766        {
     6767          Print("\n//** rec_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     6768              nlev, nwalks);
     6769          //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     6770        }
    62946771        return (Gt);
    62956772      }
     
    63026779        //07.08.03
    63036780        //ivString(Xtau, "old Xtau");
    6304         intvec* Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp));
     6781        intvec* Xtautmp;
     6782        if(ivtarget->length() == nV)
     6783        {
     6784          Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp));
     6785        }
     6786        else
     6787        {
     6788          Xtautmp = Mfpertvector(Gt, ivtarget);
     6789        }
    63056790#ifdef TEST_OVERFLOW
    63066791      if(Overflow_Error == TRUE)
     
    63306815
    63316816      FRACTAL_MSTDCC:
    6332         //Print("\n//  apply BB-Alg in ring = %s;", rString(currRing));
     6817        if(printout > 0)
     6818        {
     6819          Print("\n//** rec_fractal_call: apply Buchberger's algorithm in ring = %s.\n",
     6820                rString(currRing));
     6821        }
    63336822        to=clock();
    63346823        G = MstdCC(Gt);
     
    63386827
    63396828        // update the original target vector w.r.t. the current GB
    6340         if(MivSame(Xivinput, Xivlp) == 1)
    6341           if (rParameter(currRing) != NULL)
    6342             DefRingParlp();
     6829        if(ivtarget->length() == nV)
     6830        {
     6831          if(MivSame(Xivinput, Xivlp) == 1)
     6832            if (rParameter(currRing) != NULL)
     6833              DefRingParlp();
     6834            else
     6835              VMrDefaultlp();
    63436836          else
    6344             VMrDefaultlp();
     6837            if (rParameter(currRing) != NULL)
     6838              DefRingPar(Xivinput);
     6839            else
     6840              rChangeCurrRing(VMrDefault(Xivinput));
     6841        }
    63456842        else
    6346           if (rParameter(currRing) != NULL)
    6347             DefRingPar(Xivinput);
    6348           else
    6349             rChangeCurrRing(VMrDefault1(Xivinput)); //Aenderung6
    6350 
     6843        {
     6844          rChangeCurrRing(VMatrRefine(ivtarget,Xivinput));
     6845        }
    63516846        testring = currRing;
    63526847        Gt = idrMoveR(G, oRing,currRing);
     
    63616856        delete next_vect;
    63626857        delete altomega;
    6363         /*
    6364           Print("\n// Leaving the %d-th recursion with %d steps,", nlev,nwalks);
    6365           Print(" ** Overflow_Error? (%d)", Overflow_Error);
    6366         */
     6858        if(printout > 0)
     6859        {
     6860          Print("\n//** rec_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     6861              nlev, nwalks);
     6862          //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     6863        }
    63676864        if(Overflow_Error == TRUE)
    63686865          nnflow ++;
     
    63836880    Gomega = MwalkInitialForm(G, omega);
    63846881    xtif=xtif+clock()-to;
    6385 
     6882    if(printout > 1)
     6883    {
     6884      idString(Gomega,"//** rec_fractal_call: Gomega");
     6885    }
    63866886#ifndef  BUCHBERGER_ALG
    63876887    if(isNolVector(omega) == 0)
     
    63906890      hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
    63916891#endif // BUCHBERGER_ALG
    6392 
    6393     if (rParameter(currRing) != NULL)
    6394       DefRingPar(omega);
     6892    if(ivtarget->length() == nV)
     6893    {
     6894      if (rParameter(currRing) != NULL)
     6895        DefRingPar(omega);
     6896      else
     6897        rChangeCurrRing(VMrDefault(omega));
     6898    }
    63956899    else
    6396       rChangeCurrRing(VMrDefault1(omega)); //Aenderung7
    6397 
     6900    {
     6901      rChangeCurrRing(VMatrRefine(ivtarget,omega));
     6902    }
    63986903    Gomega1 = idrMoveR(Gomega, oRing,currRing);
    63996904
    6400     /* Maximal recursion depth, to compute a red. GB */
    6401     /* Fractal walk with the alternative recursion */
    6402     /* alternative recursion */
     6905    // Maximal recursion depth, to compute a red. GB
     6906    // Fractal walk with the alternative recursion
     6907    // alternative recursion
    64036908    // if(nlev == nV || lengthpoly(Gomega1) == 0)
    64046909    if(nlev == Xnlev || lengthpoly(Gomega1) == 0)
    64056910      //if(nlev == nV) // blind recursion
    64066911    {
    6407       /*
    6408       if(Xnlev != nV)
    6409       {
    6410         Print("\n// ** Xnlev = %d", Xnlev);
    6411         ivString(Xtau, "Xtau");
    6412       }
    6413       */
    64146912      to=clock();
    64156913#ifdef  BUCHBERGER_ALG
     
    64216919      xtstd=xtstd+clock()-to;
    64226920    }
    6423     else {
     6921    else
     6922    {
    64246923      rChangeCurrRing(oRing);
    64256924      Gomega1 = idrMoveR(Gomega1, oRing,currRing);
    6426       Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega);
    6427     }
    6428 
    6429     //convert a Groebner basis from a ring to another ring,
     6925      Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega,printout);
     6926    }
     6927    if(printout > 2)
     6928    {
     6929      idString(Gresult,"//** rec_fractal_call: M");
     6930    }
     6931    //convert a Groebner basis from a ring to another ring
    64306932    new_ring = currRing;
    64316933
     
    64356937
    64366938    to=clock();
    6437     /* Lifting process */
     6939    // Lifting process
    64386940    F = MLifttwoIdeal(Gomega2, Gresult1, G);
    64396941    xtlift=xtlift+clock()-to;
     6942    if(printout > 2)
     6943    {
     6944      idString(F,"//** rec_fractal_call: F");
     6945    }
    64406946    idDelete(&Gresult1);
    64416947    idDelete(&Gomega2);
     
    64566962 * Perturb the start weight vector at the top level with random element *
    64576963 ************************************************************************/
    6458 static ideal rec_r_fractal_call(ideal G, int nlev, intvec* omtmp, int weight_rad)
     6964static ideal rec_r_fractal_call(ideal G, int nlev, intvec* ivtarget,
     6965                int weight_rad, int printout)
    64596966{
    64606967  Overflow_Error =  FALSE;
    64616968  //Print("\n\n// Entering the %d-th recursion:", nlev);
    64626969
    6463   int i, nV = currRing->N;
     6970  int i, polylength, nV = currRing->N;
    64646971  ring new_ring, testring;
    64656972  //ring extoRing;
     
    64736980  intvec* next_vect;
    64746981  intvec* omega2 = new intvec(nV);
     6982  intvec* omtmp = new intvec(nV);
    64756983  intvec* altomega = new intvec(nV);
    64766984
    64776985  //BOOLEAN isnewtarget = FALSE;
    64786986
     6987  for(i = nV -1; i>0; i--)
     6988  {
     6989    (*omtmp)[i] = (*ivtarget)[i];
     6990  }
    64796991  // to avoid (1,0,...,0) as the target vector (Hans)
    64806992  intvec* last_omega = new intvec(nV);
     
    65167028    to=clock();
    65177029    /* determine the next border */
    6518     next_vect = MWalkRandomNextWeight(G, omega,omega2, weight_rad, 1+nlev);
    6519     //next_vect = MkInterRedNextWeight(omega,omega2,G);
     7030    next_vect = MkInterRedNextWeight(omega,omega2,G);
     7031    if(polylength > 0)
     7032    {
     7033      //there is a polynomial in Gomega with at least 3 monomials,
     7034      //low-dimensional facet of the cone
     7035      delete next_vect;
     7036      next_vect = MWalkRandomNextWeight(G,omega,omega2,weight_rad,1+nlev);
     7037      if(isNolVector(next_vect))
     7038      {
     7039        delete next_vect;
     7040        next_vect = MkInterRedNextWeight(omega,omega2,G);
     7041      }
     7042    }
    65207043    xtnw=xtnw+clock()-to;
    6521 #ifdef PRINT_VECTORS
    6522     MivString(omega, omega2, next_vect);
    6523 #endif
     7044
    65247045    oRing = currRing;
    65257046
    6526     /* We only perturb the current target vector at the recursion  level 1 */
     7047    // We only perturb the current target vector at the recursion  level 1
    65277048    if(Xngleich == 0 && nlev == 1) //(ngleich == 0) important, e.g. ex2, ex3
    65287049      if (MivComp(next_vect, omega2) == 1)
    65297050      {
    6530         /* to dispense with taking initial (and lifting/interreducing
    6531            after the call of recursion */
    6532         //Print("\n\n// ** Perturb the both vectors with degree %d with",nlev);
    6533         //idElements(G, "G");
    6534 
     7051        // to dispense with taking initials and lifting/interreducing
     7052        // after the call of recursion.
     7053        if(printout > 0)
     7054        {
     7055          Print("\n//** rec_r_fractal_call: Perturb the both vectors with degree %d.",nlev);
     7056          //idElements(G, "G");
     7057        }
    65357058        Xngleich = 1;
    65367059        nlev +=1;
    6537 
    6538         if (rParameter(currRing) != NULL)
    6539           DefRingPar(omtmp);
     7060        if(ivtarget->length() == nV)
     7061        {
     7062          if (rParameter(currRing) != NULL)
     7063            DefRingPar(omtmp);
     7064          else
     7065            rChangeCurrRing(VMrDefault(omtmp));
     7066        }
    65407067        else
    6541           rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung3
    6542 
     7068        {
     7069          rChangeCurrRing(VMatrDefault(ivtarget));
     7070        }
    65437071        testring = currRing;
    65447072        Gt = idrMoveR(G, oRing,currRing);
    65457073
    6546         /* perturb the original target vector w.r.t. the current GB */
    6547         delete Xtau;
    6548         Xtau = NewVectorlp(Gt);
     7074        // perturb the original target vector w.r.t. the current GB
     7075        if(ivtarget->length() == nV)
     7076        {
     7077          delete Xtau;
     7078          Xtau = NewVectorlp(Gt);
     7079        }
     7080        else
     7081        {
     7082          delete Xtau;
     7083          Xtau = Mfpertvector(Gt,ivtarget);
     7084        }
    65497085
    65507086        rChangeCurrRing(oRing);
    6551         G = idrMoveR(Gt, testring,currRing);
    6552 
    6553         /* perturb the current vector w.r.t. the current GB */
     7087        G = idrMoveR(Gt,testring,currRing);
     7088
     7089        // perturb the current vector w.r.t. the current GB
    65547090        Mwlp = MivWeightOrderlp(omega);
     7091        if(ivtarget->length() > nV)
     7092        {
     7093          delete Mwlp;
     7094          Mwlp = MivMatrixOrderRefine(omega,ivtarget);
     7095        }
    65557096        Xsigma = Mfpertvector(G, Mwlp);
    65567097        delete Mwlp;
     
    65687109
    65697110        next_vect = MkInterRedNextWeight(omega,omega2,G);
     7111        if(polylength > 0)
     7112        {
     7113          //there is a polynomial in Gomega with at least 3 monomials,
     7114          //low-dimensional facet of the cone
     7115          delete next_vect;
     7116          next_vect = MWalkRandomNextWeight(G,omega,omega2,weight_rad,1+nlev);
     7117          if(isNolVector(next_vect))
     7118          {
     7119            delete next_vect;
     7120            next_vect = MkInterRedNextWeight(omega,omega2,G);
     7121          }
     7122        }
    65707123        xtnw=xtnw+clock()-to;
    6571 
    6572 #ifdef PRINT_VECTORS
     7124      }
     7125//#ifdef PRINT_VECTORS
     7126      if(printout > 0)
     7127      {
    65737128        MivString(omega, omega2, next_vect);
    6574 #endif
    6575       }
    6576 
    6577 
    6578     /* check whether the the computed vector is in the correct cone */
    6579     /* If no, the reduced GB of an omega-homogeneous ideal will be
     7129      }
     7130//#endif
     7131
     7132    /* check whether the the computed vector is in the correct cone
     7133       If no, the reduced GB of an omega-homogeneous ideal will be
    65807134       computed by Buchberger algorithm and stop this recursion step*/
    65817135    //if(test_w_in_ConeCC(G, next_vect) != 1) //e.g. Example s7, cyc6
     
    65837137    {
    65847138      delete next_vect;
    6585       if (rParameter(currRing) != NULL)
    6586       {
    6587         DefRingPar(omtmp);
     7139      if(ivtarget->length() == nV)
     7140      {
     7141        if (rParameter(currRing) != NULL)
     7142        {
     7143          DefRingPar(omtmp);
     7144        }
     7145        else
     7146        {
     7147          rChangeCurrRing(VMrDefault(omtmp));
     7148        }
    65887149      }
    65897150      else
    65907151      {
    6591         rChangeCurrRing(VMrDefault1(omtmp)); // Aenderung4
     7152        rChangeCurrRing(VMatrDefault(ivtarget));
    65927153      }
    65937154#ifdef TEST_OVERFLOW
    65947155      Gt = idrMoveR(G, oRing,currRing);
    6595       Gt = NULL; return(Gt);
    6596 #endif
    6597 
    6598       //Print("\n\n// apply BB's alg. in ring r = %s;", rString(currRing));
     7156      Gt = NULL;
     7157      return(Gt);
     7158#endif
     7159      if(printout > 0)
     7160      {
     7161        Print("\n//** rec_r_fractal_call: applying Buchberger's algorithm in ring r = %s;",
     7162              rString(currRing));
     7163      }
    65997164      to=clock();
    66007165      Gt = idrMoveR(G, oRing,currRing);
     
    66057170      delete omega2;
    66067171      delete altomega;
    6607 
    6608       //Print("\n// Leaving the %d-th recursion with %d steps", nlev, nwalks);
    6609       //Print("  ** Overflow_Error? (%d)", Overflow_Error);
     7172      if(printout > 0)
     7173      {
     7174        Print("\n//** rec_r_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     7175              nlev, nwalks);
     7176        //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     7177      }
    66107178      nnflow ++;
    6611 
    66127179      Overflow_Error = FALSE;
    66137180      return (G1);
    66147181    }
    6615 
    6616 
    6617     /* If the perturbed target vector stays in the correct cone,
    6618        return the current GB,
    6619        otherwise, return the computed  GB by the Buchberger-algorithm.
    6620        Then we update the perturbed target vectors w.r.t. this GB. */
    6621 
    6622     /* the computed vector is equal to the origin vector, since
    6623        t is not defined */
     7182    /*
     7183       If the perturbed target vector stays in the correct cone,
     7184       return the current Groebner basis.
     7185       Otherwise, return the Groebner basis computed with Buchberger's
     7186       algorithm.
     7187       Then we update the perturbed target vectors w.r.t. this GB.
     7188    */
    66247189    if (MivComp(next_vect, XivNull) == 1)
    66257190    {
    6626       if (rParameter(currRing) != NULL)
    6627         DefRingPar(omtmp);
     7191      // The computed vector is equal to the origin vector,
     7192      // because t is not defined
     7193      if(ivtarget->length() == nV)
     7194      {
     7195        if (rParameter(currRing) != NULL)
     7196          DefRingPar(omtmp);
     7197        else
     7198          rChangeCurrRing(VMrDefault(omtmp));
     7199      }
    66287200      else
    6629         rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung5
    6630 
     7201      {
     7202        rChangeCurrRing(VMatrDefault(ivtarget));
     7203      }
    66317204      testring = currRing;
    66327205      Gt = idrMoveR(G, oRing,currRing);
    66337206
    6634       if(test_w_in_ConeCC(Gt, omega2) == 1) {
     7207      if(test_w_in_ConeCC(Gt, omega2) == 1)
     7208      {
    66357209        delete omega2;
    66367210        delete next_vect;
    66377211        delete altomega;
    6638         //Print("\n// Leaving the %d-th recursion with %d steps ",nlev, nwalks);
    6639         //Print(" ** Overflow_Error? (%d)", Overflow_Error);
    6640 
     7212        if(printout > 0)
     7213        {
     7214          Print("\n//** rec_r_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     7215                nlev, nwalks);
     7216          //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     7217        }
    66417218        return (Gt);
    66427219      }
    66437220      else
    6644       {
    6645         //ivString(omega2, "tau'");
    6646         //Print("\n//  tau' doesn't stay in the correct cone!!");
    6647 
     7221      {
     7222        if(printout > 0)
     7223        {
     7224          Print("\n//** rec_r_fractal_call: target weight doesn't stay in the correct cone.\n");
     7225        }
    66487226#ifndef  MSTDCC_FRACTAL
    6649         //07.08.03
    66507227        //ivString(Xtau, "old Xtau");
    6651         intvec* Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp));
     7228        intvec* Xtautmp;
     7229        if(ivtarget->length() == nV)
     7230        {
     7231          Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp));
     7232        }
     7233        else
     7234        {
     7235          Xtautmp = Mfpertvector(Gt, ivtarget);
     7236        }
    66527237#ifdef TEST_OVERFLOW
    66537238      if(Overflow_Error == TRUE)
     
    66777262
    66787263      FRACTAL_MSTDCC:
    6679         //Print("\n//  apply BB-Alg in ring = %s;", rString(currRing));
     7264        if(printout > 0)
     7265        {
     7266          Print("\n//** rec_r_fractal_call: apply Buchberge's algorithm in ring = %s.\n",
     7267                rString(currRing));
     7268        }
    66807269        to=clock();
    66817270        G = MstdCC(Gt);
     
    66857274
    66867275        // update the original target vector w.r.t. the current GB
    6687         if(MivSame(Xivinput, Xivlp) == 1)
    6688           if (rParameter(currRing) != NULL)
    6689             DefRingParlp();
     7276        if(ivtarget->length() == nV)
     7277        {
     7278          if(MivSame(Xivinput, Xivlp) == 1)
     7279            if (rParameter(currRing) != NULL)
     7280              DefRingParlp();
     7281            else
     7282              VMrDefaultlp();
    66907283          else
    6691             VMrDefaultlp();
     7284            if (rParameter(currRing) != NULL)
     7285              DefRingPar(Xivinput);
     7286            else
     7287              rChangeCurrRing(VMrDefault(Xivinput));
     7288        }
    66927289        else
    6693           if (rParameter(currRing) != NULL)
    6694             DefRingPar(Xivinput);
    6695           else
    6696             rChangeCurrRing(VMrDefault1(Xivinput)); //Aenderung6
    6697 
     7290        {
     7291          rChangeCurrRing(VMatrRefine(ivtarget,Xivinput));
     7292        }
    66987293        testring = currRing;
    66997294        Gt = idrMoveR(G, oRing,currRing);
     
    67087303        delete next_vect;
    67097304        delete altomega;
    6710         /*
    6711           Print("\n// Leaving the %d-th recursion with %d steps,", nlev,nwalks);
    6712           Print(" ** Overflow_Error? (%d)", Overflow_Error);
    6713         */
     7305        if(printout > 0)
     7306        {
     7307          Print("\n//** rec_r_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     7308                nlev,nwalks);
     7309          //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     7310        }
    67147311        if(Overflow_Error == TRUE)
    67157312          nnflow ++;
     
    67277324
    67287325    to=clock();
    6729     /* Take the initial form of <G> w.r.t. omega */
     7326    // Take the initial form of <G> w.r.t. omega
    67307327    Gomega = MwalkInitialForm(G, omega);
    67317328    xtif=xtif+clock()-to;
    6732 
     7329    //polylength = 1 if there is a polynomial in Gomega with at least 3 monomials and 0 otherwise
     7330    polylength = lengthpoly(Gomega);
     7331    if(printout > 1)
     7332    {
     7333      idString(Gomega,"//** rec_r_fractal_call: Gomega");
     7334    }
    67337335#ifndef  BUCHBERGER_ALG
    67347336    if(isNolVector(omega) == 0)
     
    67367338    else
    67377339      hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
    6738 #endif // BUCHBERGER_ALG
    6739 
    6740     if (rParameter(currRing) != NULL)
    6741       DefRingPar(omega);
     7340#endif
     7341    if(ivtarget->length() == nV)
     7342    {
     7343      if (rParameter(currRing) != NULL)
     7344        DefRingPar(omega);
     7345      else
     7346        rChangeCurrRing(VMrDefault(omega));
     7347    }
    67427348    else
    6743       rChangeCurrRing(VMrDefault1(omega)); //Aenderung7
    6744 
     7349    {
     7350      rChangeCurrRing(VMatrRefine(ivtarget,omega));
     7351    }
    67457352    Gomega1 = idrMoveR(Gomega, oRing,currRing);
    67467353
    6747     /* Maximal recursion depth, to compute a red. GB */
    6748     /* Fractal walk with the alternative recursion */
    6749     /* alternative recursion */
    6750     // if(nlev == nV || lengthpoly(Gomega1) == 0)
     7354    // Maximal recursion depth, to compute a red. GB
     7355    // Fractal walk with the alternative recursion
     7356    // alternative recursion
    67517357    if(nlev == Xnlev || lengthpoly(Gomega1) == 0)
    6752       //if(nlev == nV) // blind recursion
    6753     {
    6754       /*
    6755       if(Xnlev != nV)
    6756       {
    6757         Print("\n// ** Xnlev = %d", Xnlev);
    6758         ivString(Xtau, "Xtau");
    6759       }
    6760       */
     7358    {
    67617359      to=clock();
    67627360#ifdef  BUCHBERGER_ALG
     
    67657363      Gresult =kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,omega);
    67667364      delete hilb_func;
    6767 #endif // BUCHBERGER_ALG
     7365#endif
    67687366      xtstd=xtstd+clock()-to;
    67697367    }
    6770     else {
     7368    else
     7369    {
    67717370      rChangeCurrRing(oRing);
    67727371      Gomega1 = idrMoveR(Gomega1, oRing,currRing);
    6773       Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega);
    6774     }
    6775 
    6776     //convert a Groebner basis from a ring to another ring,
     7372      Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega,printout);
     7373    }
     7374    if(printout > 2)
     7375    {
     7376      idString(Gresult,"//** rec_r_fractal_call: M");
     7377    }
     7378    //convert a Groebner basis from a ring to another ring
    67777379    new_ring = currRing;
    67787380
     
    67827384
    67837385    to=clock();
    6784     /* Lifting process */
     7386    // Lifting process
    67857387    F = MLifttwoIdeal(Gomega2, Gresult1, G);
    67867388    xtlift=xtlift+clock()-to;
     7389
     7390    if(printout > 2)
     7391    {
     7392      idString(F,"//** rec_r_fractal_call: F");
     7393    }
     7394
    67877395    idDelete(&Gresult1);
    67887396    idDelete(&Gomega2);
     
    67937401
    67947402    to=clock();
    6795     /* Interreduce G */
     7403    // Interreduce G
    67967404    G = kInterRedCC(F1, NULL);
    67977405    xtred=xtred+clock()-to;
     
    67997407  }
    68007408}
    6801 
    6802 
    68037409
    68047410
     
    68077413 *                                                                             *
    68087414 * The main procedur Mfwalk calls the recursive Subroutine                     *
    6809  * rec_fractal_call to compute the wanted Grᅵbner basis.                       *
    6810  * At the main procedur we compute the reduced Grᅵbner basis w.r.t. a "fast"   *
     7415 * rec_fractal_call to compute the wanted Groebner basis.                      *
     7416 * At the main procedur we compute the reduced Groebner basis w.r.t. a "fast"  *
    68117417 * order, e.g. "dp" and a sequence of weight vectors which are row vectors     *
    68127418 * of a matrix. This matrix defines the given monomial order, e.g. "lp"        *
    68137419 *******************************************************************************/
    6814 ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget)
     7420ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget,
     7421             int reduction, int printout)
    68157422{
     7423  BITSET save1 = si_opt_1; // save current options
     7424  if(reduction == 0)
     7425  {
     7426    si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
     7427    //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
     7428  }
    68167429  Set_Error(FALSE);
    68177430  Overflow_Error = FALSE;
     
    68487461      intvec* iv_dp = MivUnit(nV); // define (1,1,...,1)
    68497462      intvec* Mdp;
    6850 
    6851       if(MivSame(ivstart, iv_dp) != 1)
    6852         Mdp = MivWeightOrderdp(ivstart);
     7463      if(ivstart->length() == nV)
     7464      {
     7465        if(MivSame(ivstart, iv_dp) != 1)
     7466          Mdp = MivWeightOrderdp(ivstart);
     7467        else
     7468          Mdp = MivMatrixOrderdp(nV);
     7469      }
    68537470      else
    6854         Mdp = MivMatrixOrderdp(nV);
     7471      {
     7472        Mdp = ivstart;
     7473      }
    68557474
    68567475      Xsigma = Mfpertvector(I, Mdp);
     
    68697488  Xivlp = Mivlp(nV);
    68707489
    6871   if(MivComp(ivtarget, Xivlp)  != 1)
    6872   {
    6873     if (rParameter(currRing) != NULL)
    6874       DefRingPar(ivtarget);
     7490  if(ivtarget->length() == nV)
     7491  {
     7492    if(MivComp(ivtarget, Xivlp)  != 1)
     7493    {
     7494      if (rParameter(currRing) != NULL)
     7495        DefRingPar(ivtarget);
     7496      else
     7497        rChangeCurrRing(VMrDefault(ivtarget));
     7498
     7499      I1 = idrMoveR(I, oldRing,currRing);
     7500      Mlp = MivWeightOrderlp(ivtarget);
     7501      Xtau = Mfpertvector(I1, Mlp);
     7502    }
    68757503    else
    6876       rChangeCurrRing(VMrDefault1(ivtarget)); //Aenderung1
    6877 
    6878     I1 = idrMoveR(I, oldRing,currRing);
    6879     Mlp = MivWeightOrderlp(ivtarget);
    6880     Xtau = Mfpertvector(I1, Mlp);
     7504    {
     7505      if (rParameter(currRing) != NULL)
     7506        DefRingParlp();
     7507      else
     7508        VMrDefaultlp();
     7509
     7510      I1 = idrMoveR(I, oldRing,currRing);
     7511      Mlp =  MivMatrixOrderlp(nV);
     7512      Xtau = Mfpertvector(I1, Mlp);
     7513    }
    68817514  }
    68827515  else
    68837516  {
    6884     if (rParameter(currRing) != NULL)
    6885       DefRingParlp();
    6886     else
    6887       VMrDefaultlp();
    6888 
    6889     I1 = idrMoveR(I, oldRing,currRing);
    6890     Mlp =  MivMatrixOrderlp(nV);
     7517    rChangeCurrRing(VMatrDefault(ivtarget));
     7518    I1 = idrMoveR(I,oldRing,currRing);
     7519    Mlp =  ivtarget;
    68917520    Xtau = Mfpertvector(I1, Mlp);
    68927521  }
     
    68997528  id_Delete(&I, oldRing);
    69007529  ring tRing = currRing;
    6901 
    6902   if (rParameter(currRing) != NULL)
    6903     DefRingPar(ivstart);
     7530  if(ivtarget->length() == nV)
     7531  {
     7532    if (rParameter(currRing) != NULL)
     7533      DefRingPar(ivstart);
     7534    else
     7535      rChangeCurrRing(VMrDefault(ivstart));
     7536  }
    69047537  else
    6905     rChangeCurrRing(VMrDefault1(ivstart)); //Aenderung2
     7538  {
     7539    rChangeCurrRing(VMatrDefault(ivstart));
     7540  }
    69067541
    69077542  I = idrMoveR(I1,tRing,currRing);
     
    69147549  ring helpRing = currRing;
    69157550
    6916   J = rec_fractal_call(J, 1, ivtarget);
     7551  J = rec_fractal_call(J,1,ivtarget,printout);
    69177552
    69187553  rChangeCurrRing(oldRing);
     
    69207555  idSkipZeroes(resF);
    69217556
     7557  si_opt_1 = save1; //set original options, e. g. option(RedSB)
    69227558  delete Xivlp;
    69237559  delete Xsigma;
     
    69387574}
    69397575
    6940 ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget,int weight_rad)
     7576/*******************************************************************************
     7577 * The implementation of the fractal walk algorithm with random element        *
     7578 *                                                                             *
     7579 * The main procedur Mfwalk calls the recursive Subroutine                     *
     7580 * rec_r_fractal_call to compute the wanted Groebner basis.                    *
     7581 * At the main procedure we compute the reduced Groebner basis w.r.t. a "fast" *
     7582 * order, e.g. "dp" and a sequence of weight vectors which are row vectors     *
     7583 * of a matrix. This matrix defines the given monomial order, e.g. "lp"        *
     7584 *******************************************************************************/
     7585ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget,
     7586              int weight_rad, int reduction, int printout)
    69417587{
     7588  BITSET save1 = si_opt_1; // save current options
     7589  if(reduction == 0)
     7590  {
     7591    si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
     7592    //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
     7593  }
    69427594  Set_Error(FALSE);
    69437595  Overflow_Error = FALSE;
     
    69747626      intvec* iv_dp = MivUnit(nV); // define (1,1,...,1)
    69757627      intvec* Mdp;
    6976 
    6977       if(MivSame(ivstart, iv_dp) != 1)
    6978         Mdp = MivWeightOrderdp(ivstart);
     7628      if(ivstart->length() == nV)
     7629      {
     7630        if(MivSame(ivstart, iv_dp) != 1)
     7631          Mdp = MivWeightOrderdp(ivstart);
     7632        else
     7633          Mdp = MivMatrixOrderdp(nV);
     7634      }
    69797635      else
    6980         Mdp = MivMatrixOrderdp(nV);
     7636      {
     7637        Mdp = ivstart;
     7638      }
    69817639
    69827640      Xsigma = Mfpertvector(I, Mdp);
     
    69957653  Xivlp = Mivlp(nV);
    69967654
    6997   if(MivComp(ivtarget, Xivlp)  != 1)
    6998   {
    6999     if (rParameter(currRing) != NULL)
    7000       DefRingPar(ivtarget);
     7655  if(ivtarget->length() == nV)
     7656  {
     7657    if(MivComp(ivtarget, Xivlp)  != 1)
     7658    {
     7659      if (rParameter(currRing) != NULL)
     7660        DefRingPar(ivtarget);
     7661      else
     7662        rChangeCurrRing(VMrDefault(ivtarget));
     7663
     7664      I1 = idrMoveR(I, oldRing,currRing);
     7665      Mlp = MivWeightOrderlp(ivtarget);
     7666      Xtau = Mfpertvector(I1, Mlp);
     7667    }
    70017668    else
    7002       rChangeCurrRing(VMrDefault1(ivtarget)); //Aenderung1
    7003 
    7004     I1 = idrMoveR(I, oldRing,currRing);
    7005     Mlp = MivWeightOrderlp(ivtarget);
    7006     Xtau = Mfpertvector(I1, Mlp);
     7669    {
     7670      if (rParameter(currRing) != NULL)
     7671        DefRingParlp();
     7672      else
     7673        VMrDefaultlp();
     7674
     7675      I1 = idrMoveR(I, oldRing,currRing);
     7676      Mlp =  MivMatrixOrderlp(nV);
     7677      Xtau = Mfpertvector(I1, Mlp);
     7678    }
    70077679  }
    70087680  else
    70097681  {
    7010     if (rParameter(currRing) != NULL)
    7011       DefRingParlp();
    7012     else
    7013       VMrDefaultlp();
    7014 
    7015     I1 = idrMoveR(I, oldRing,currRing);
    7016     Mlp =  MivMatrixOrderlp(nV);
     7682    rChangeCurrRing(VMatrDefault(ivtarget));
     7683    I1 = idrMoveR(I,oldRing,currRing);
     7684    Mlp =  ivtarget;
    70177685    Xtau = Mfpertvector(I1, Mlp);
    70187686  }
     
    70257693  id_Delete(&I, oldRing);
    70267694  ring tRing = currRing;
    7027 
    7028   if (rParameter(currRing) != NULL)
    7029     DefRingPar(ivstart);
     7695  if(ivtarget->length() == nV)
     7696  {
     7697    if (rParameter(currRing) != NULL)
     7698      DefRingPar(ivstart);
     7699    else
     7700      rChangeCurrRing(VMrDefault(ivstart));
     7701  }
    70307702  else
    7031     rChangeCurrRing(VMrDefault1(ivstart)); //Aenderung2
     7703  {
     7704    rChangeCurrRing(VMatrDefault(ivstart));
     7705  }
    70327706
    70337707  I = idrMoveR(I1,tRing,currRing);
     
    70397713  ideal resF;
    70407714  ring helpRing = currRing;
    7041 //ideal G, int nlev, intvec* omtmp, int weight_rad)
    7042   J = rec_r_fractal_call(J, 1, ivtarget,weight_rad);
     7715
     7716  J = rec_r_fractal_call(J,1,ivtarget,weight_rad,printout);
    70437717
    70447718  rChangeCurrRing(oldRing);
     
    70467720  idSkipZeroes(resF);
    70477721
     7722  si_opt_1 = save1; //set original options, e. g. option(RedSB)
    70487723  delete Xivlp;
    70497724  delete Xsigma;
     
    71017776  intvec* hilb_func;
    71027777#endif
    7103   /* to avoid (1,0,...,0) as the target vector */
     7778  // to avoid (1,0,...,0) as the target vector
    71047779  intvec* last_omega = new intvec(nV);
    71057780  for(i=nV-1; i>0; i--)
     
    71167791
    71177792  to=clock();
    7118   /* compute a red. GB w.r.t. the help ring */
     7793  // compute a red. GB w.r.t. the help ring
    71197794  if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) = "dp"
    71207795    G = MstdCC(G);
     
    71257800      DefRingPar(curr_weight);
    71267801    else
    7127       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 4
     7802      rChangeCurrRing(VMrDefault(curr_weight));
    71287803    G = idrMoveR(G, XXRing,currRing);
    71297804    G = MstdCC(G);
     
    71517826      DefRingPar(curr_weight);
    71527827    else
    7153       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 5
     7828      rChangeCurrRing(VMrDefault(curr_weight));
    71547829    to=clock();
    71557830    Gw = idrMoveR(G, exring,currRing);
     
    71867861      DefRingPar(curr_weight);
    71877862    else
    7188       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 6
     7863      rChangeCurrRing(VMrDefault(curr_weight));
    71897864
    71907865    newRing = currRing;
     
    72717946          DefRingPar(target_tmp);
    72727947        else
    7273           rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 8
     7948          rChangeCurrRing(VMrDefault(target_tmp));
    72747949
    72757950      lpRing = currRing;
     
    73318006          DefRingPar(target_tmp);
    73328007        else
    7333           rChangeCurrRing(VMrDefault(target_tmp)); //Aenderung 9
     8008          rChangeCurrRing(VMrDefault(target_tmp));
    73348009
    73358010      lpRing = currRing;
     
    75348209    else
    75358210    {
    7536       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 10
     8211      rChangeCurrRing(VMrDefault(curr_weight));
    75378212    }
    75388213    G = idrMoveR(G, XXRing,currRing);
     
    75678242    else
    75688243    {
    7569       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 11
     8244      rChangeCurrRing(VMrDefault(curr_weight));
    75708245    }
    75718246    to=clock();
     
    76108285    else
    76118286    {
    7612       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 12
     8287      rChangeCurrRing(VMrDefault(curr_weight));
    76138288    }
    76148289    newRing = currRing;
     
    77798454        else
    77808455        {
    7781           rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 13
     8456          rChangeCurrRing(VMrDefault(target_tmp));
    77828457        }
    77838458      }
     
    78528527        else
    78538528        {
    7854           rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 14
     8529          rChangeCurrRing(VMrDefault(target_tmp));
    78558530        }
    78568531      }
     
    80958770    else
    80968771    {
    8097       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 15
     8772      rChangeCurrRing(VMrDefault(curr_weight));
    80988773    }
    80998774    newRing = currRing;
     
    82378912
    82388913  //Print("\n// \"Mpwalk\" (1,%d) took %d steps and %.2f sec. Overflow_Error (%d)", tp_deg, nwalk, ((double) clock()-tinput)/1000000, nOverflow_Error);
    8239 
     8914  Print("\n// Mprwalk took %d steps. Ring= %s;\n", nwalk, rString(currRing));
    82408915  return(result);
    8241 }
    8242 
    8243 /*******************************************************
    8244  * THE PERTURBATION WALK ALGORITHM WITH RANDOM ELEMENT *
    8245  *******************************************************/
    8246 ideal Mprwalk(ideal Go, intvec* curr_weight, intvec* target_weight, int weight_rad, int op_deg, int tp_deg, ring baseRing)
    8247 {
    8248   BITSET save1 = si_opt_1; // save current options
    8249   si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
    8250   Set_Error(FALSE);
    8251   Overflow_Error = FALSE;
    8252 #ifdef TIME_TEST
    8253   clock_t tinput=0, tostd=0, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
    8254   xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
    8255   tinput = clock();
    8256   clock_t tim;
    8257 #endif
    8258   int i,nwalk,nV = baseRing->N;
    8259 
    8260   ideal G, Gomega, M, F, Gomega1, Gomega2, M1;
    8261   ring newRing;
    8262   ring XXRing = baseRing;
    8263   intvec* exivlp = Mivlp(nV);
    8264   intvec* orig_target = target_weight;
    8265   intvec* pert_target_vector = target_weight;
    8266   intvec* ivNull = new intvec(nV);
    8267   intvec* tmp_weight = new intvec(nV);
    8268 #ifdef CHECK_IDEAL_MWALK
    8269   poly p;
    8270 #endif
    8271   for(i=0; i<nV; i++)
    8272   {
    8273     (*tmp_weight)[i] = (*curr_weight)[i];
    8274   }
    8275 #ifndef BUCHBERGER_ALG
    8276   intvec* hilb_func;
    8277    // to avoid (1,0,...,0) as the target vector
    8278   intvec* last_omega = new intvec(nV);
    8279   for(i=0 i<nV; i++)
    8280   {
    8281     (*last_omega)[i] = 1;
    8282   }
    8283   (*last_omega)[0] = 10000;
    8284 #endif
    8285   baseRing = currRing;
    8286   newRing = VMrDefault(curr_weight);
    8287   rChangeCurrRing(newRing);
    8288   G = idrMoveR(Go,baseRing,currRing);
    8289 #ifdef TIME_TEST
    8290   to = clock();
    8291 #endif
    8292   G = kStd(G,NULL,testHomog,NULL,NULL,0,0,NULL);
    8293   idSkipZeroes(G);
    8294 #ifdef TIME_TEST
    8295   tostd = tostd + to - clock();
    8296 #endif
    8297 #ifdef CHECK_IDEAL_MWALK
    8298   idString(G,"G");
    8299 #endif
    8300   if(op_deg >1)
    8301   {
    8302     if(MivComp(curr_weight,MivUnit(nV)) == 1) //ring order is "dp"
    8303     {
    8304       curr_weight = MPertVectors(G, MivMatrixOrderdp(nV), op_deg);
    8305     }
    8306     else //ring order is not "dp"
    8307     {
    8308       curr_weight = MPertVectors(G, MivMatrixOrder(curr_weight), op_deg);
    8309     }
    8310   }
    8311   baseRing = currRing;
    8312   if(tp_deg > 1 && tp_deg <= nV)
    8313   {
    8314     pert_target_vector = target_weight;
    8315   }
    8316 #ifdef CHECK_IDEAL_MWALK
    8317   ivString(curr_weight, "new curr_weight");
    8318   ivString(target_weight, "new target_weight");
    8319 #endif
    8320   nwalk = 0;
    8321   while(1)
    8322   {
    8323     nwalk ++;
    8324 #ifdef TIME_TEST
    8325     to = clock();
    8326 #endif
    8327     Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
    8328 #ifdef TIME_TEST
    8329     tif = tif + clock()-to; //time for computing initial form ideal
    8330 #endif
    8331 #ifdef CHECK_IDEAL_MWALK
    8332     idString(Gomega,"Gomega");
    8333 #endif
    8334 #ifndef  BUCHBERGER_ALG
    8335     if(isNolVector(curr_weight) == 0)
    8336     {
    8337       hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
    8338     }   
    8339     else
    8340     {
    8341       hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
    8342     }
    8343 #endif
    8344     if(nwalk == 1)
    8345     {
    8346       newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
    8347     }
    8348     else
    8349     {
    8350       newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))"
    8351     }
    8352     rChangeCurrRing(newRing);
    8353     Gomega1 = idrMoveR(Gomega, baseRing,currRing);
    8354     idDelete(&Gomega);
    8355     // compute a Groebner basis of <Gomega> w.r.t. "newRing"
    8356 #ifdef TIME_TEST
    8357     to = clock();
    8358 #endif
    8359 #ifndef  BUCHBERGER_ALG
    8360     M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
    8361     delete hilb_func;
    8362 #else
    8363     M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
    8364 #endif
    8365     idSkipZeroes(M);
    8366 #ifdef TIME_TEST
    8367     tstd = tstd + clock() - to;
    8368 #endif
    8369 #ifdef CHECK_IDEAL_MWALK
    8370     idString(M, "M");
    8371 #endif
    8372     //change the ring to baseRing
    8373     rChangeCurrRing(baseRing);
    8374     M1 =  idrMoveR(M, newRing,currRing);
    8375     idDelete(&M);
    8376     Gomega2 = idrMoveR(Gomega1, newRing,currRing);
    8377     idDelete(&Gomega1);
    8378     to = clock();
    8379     // compute a representation of the generators of submod (M) with respect to those of mod (Gomega), where Gomega is a reduced Groebner basis w.r.t. the current ring
    8380     F = MLifttwoIdeal(Gomega2, M1, G);
    8381     idSkipZeroes(F);
    8382 #ifdef TIME_TEST
    8383     tlift = tlift + clock() - to;
    8384 #endif
    8385 #ifdef CHECK_IDEAL_MWALK
    8386     idString(F,"F");
    8387 #endif
    8388     rChangeCurrRing(newRing); // change the ring to newRing
    8389     G = idrMoveR(F,baseRing,currRing);
    8390     idDelete(&F);
    8391     baseRing = currRing; // set baseRing equal to newRing
    8392 #ifdef CHECK_IDEAL_MWALK
    8393     idString(G,"G");
    8394 #endif
    8395 #ifdef TIME_TEST
    8396     to = clock();
    8397 #endif
    8398     intvec* next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, op_deg);
    8399 #ifdef TIME_TEST
    8400     tnw = tnw + clock() - to;
    8401 #endif
    8402 #ifdef PRINT_VECTORS
    8403     MivString(curr_weight, target_weight, next_weight);
    8404 #endif
    8405     if(Overflow_Error == TRUE)
    8406     {
    8407       PrintS("\n//**Mprwalk: OVERFLOW: The computed vector does not stay in cone, the result may be wrong.\n");
    8408       delete next_weight;
    8409       break;
    8410     }
    8411 
    8412     if(test_w_in_ConeCC(G,target_weight) == 1 || MivComp(next_weight, ivNull) == 1)
    8413     {
    8414       delete next_weight;
    8415       break;
    8416     }
    8417     //update tmp_weight and curr_weight
    8418     for(i=nV-1; i>=0; i--)
    8419     {
    8420       (*tmp_weight)[i] = (*curr_weight)[i];
    8421       (*curr_weight)[i] = (*next_weight)[i];
    8422     }
    8423     delete next_weight;
    8424   } //end of while-loop
    8425   Print("\n// Mprwalk took %d steps. Ring= %s;\n", nwalk, rString(currRing));
    8426   idSkipZeroes(G);
    8427   si_opt_1 = save1; //set original options, e. g. option(RedSB)
    8428   baseRing = currRing;
    8429   rChangeCurrRing(XXRing);
    8430   ideal Res = idrMoveR(G,baseRing,currRing);
    8431   delete tmp_weight;
    8432   delete ivNull;
    8433   delete exivlp;
    8434 #ifndef BUCHBERGER_ALG
    8435   delete last_omega;
    8436 #endif
    8437 #ifdef TIME_TEST
    8438   TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep);
    8439 #endif
    8440   return(Res);
    84418916}
    84428917
     
    85178992        else
    85188993        {
    8519           rChangeCurrRing(VMrDefault(cw_tmp)); // Aenderung 16
     8994          rChangeCurrRing(VMrDefault(cw_tmp));
    85208995        }
    85218996        G = idrMoveR(Go, XXRing,currRing);
     
    85919066    else
    85929067    {
    8593       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 17
     9068      rChangeCurrRing(VMrDefault(curr_weight));
    85949069    }
    85959070    newRing = currRing;
     
    86539128      else
    86549129      {
    8655         rChangeCurrRing(VMrDefault(target_weight)); // Aenderung 18
     9130        rChangeCurrRing(VMrDefault(target_weight));
    86569131      }
    86579132      F1 = idrMoveR(G, newRing,currRing);
  • Singular/walk.h

    • Property mode changed from 100644 to 100755
    r350269 r11d9d00  
    5454// compute a Groebner basis of an ideal G w.r.t. lexicographic order
    5555//ideal Mwalk(ideal Go, intvec* orig_M, intvec* target_M);
    56 ideal Mwalk(ideal Go, intvec* orig_M, intvec* target_M, ring baseRing);
     56ideal Mwalk(ideal Go, intvec* orig_M, intvec* target_M, ring baseRing, int reduction, int printout);
    5757
    5858// random walk algorithm to compute a Groebner basis
    59 ideal Mrwalk(ideal Go, intvec* curr_weight, intvec* target_weight, int weight_rad, int pert_deg, ring baseRing);
     59
     60ideal Mrwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, int pert_deg, int reduction, int printout);
    6061
    6162/* the perturbation walk algorithm */
    6263
    63 ideal Mpwalk(ideal Go, int op_deg, int tp_deg,intvec* curr_weight,intvec* target_weight, int nP);
     64ideal Mpwalk(ideal Go, int op_deg, int tp_deg,intvec* curr_weight,intvec* target_weight, int nP, int reduction, int printout);
    6465
    6566/* the perturbation walk algorithm with random element */
    66 
    67 ideal Mprwalk(ideal Go, intvec* curr_weight, intvec* target_weight, int weight_rad, int op_deg, int tp_deg, ring baseRing);
     67ideal Mprwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, int op_deg, int tp_deg, int nP, int reduction, int printout);
    6868
    6969/* The fractal walk algorithm */
    70 ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget);
     70ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget, int reduction, int printout);
    7171
    7272/* The fractal walk algorithm with random element */
    73 ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget,int weight_rad);
     73ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget, int weight_rad, int reduction, int printout);
    7474
    7575/* Implement Tran's idea */
  • Tst/Long/ok_l2.lst

    r8af63a r11d9d00  
    11algemodstd_l
    22bug_tr642
     3bug_tr677
    34king_3_colors_l
    45modstd_l
  • Tst/Long/primdec_l.res.gz.uu

    r8af63a r11d9d00  
    11begin 640 primdec_l.res.gz
    2 M'XL("+EN3U0``W!R:6UD96-?;"YR97,`[%W;CN0X<GWOKTCLTRR4*HC!NP?=
    3 M@+T&C`4,P_#NBSU8#/)6657N'JP[;\K\>I^@1(K*4EZJNK:F=R<QF$J1(H/!
    4 M$T%&,!@S^M.?__6/_S$:C<2GT;__\5]&OUNOUG>?'Z>_^_'#G]HW]&F$RI\?
    5 M?WE<__#['S_P[^C3I]%?OSY^F2]F/W^^^V6QNUNM)^O40WX:I6=UQW1_U[8^
    6 M(JVSAN9N]/7QE^7HZT=)527'/TS&T_%L/!\OQO?CY?AA_/3[\0]_&,__^ONN
    7 MO_TT>IPO)I]'CQ]3G;L;30J:%K-R7BS'J=K?C>YI^5!.4I6H[D:+^V4YZVH$
    8 M&BWIJ9QV5<3D0*VX+Y:EZ.KEW4A.YH6<S@N:S8OY?3%?EI.2IN6L7"8.A>IF
    9 M*/3=Z//C:@WDQ,<OC[_\\VKU;W_^GQ\>N_D(D^8C/GZ=S!]GD\^]]]U\Z>/B
    10 M_S:/_S70QGV*H]#'**3C<7QJ(UM._O`P^?K#XUATC:A*C=3'ELZ?_ONH#;3F
    11 MRV3]];$>??DX`XF?5XNOCXM5/A@1ZXKX\<-/XB__]`&2^!D/'P/,]X5H*N@O
    12 M'TM4%/</!2V?BD6LEZ@/4J/0'M(JYN6R>:?PCBMF35&C*$Q5"6Y?3)OG61%^
    13 MYDVI[6C^\K%3D`\8.^.*^S:LE<N,.8J,O1];,F-KF1BY+]\1&96S4'9HW+\;
    14 M"U&%L*$\0H,>!;,R+>=!<U"B7FM4@*<Y9'5/#PWQZ0R+^?ZI'?`>&@8MFT&2
    15 MX/FI"((&/T]-8[0EM&5!/S$Q3"+L#_RL6Y4-#;EVVO;AEV!ZQNH;@("BR(`&
    16 MB%$`YZ'$B*7"B*5ID"H7RX)U2K%.H0G&+(@IV4P'"P8P[#K\QN&-?(@3"3-@
    17 M1G.FJ&P';.>SN.>.'L*3#VVCZ0+<+)@E-$7[Y0.U\U@^/`5>GTJYI(=$H<5Q
    18 MP3RA+7A[*J:1C?9W`6H/)5H\!`E50(,)%>H^-`^H4,FP4#%;@#NS8!X7#634
    19 M-'D(<J&"8:*"<2(`P#R!)>!$Y0(=(4'#,`;Y"-9+]4215_!=`J.L'*%AB<C[
    20 M,*^&&1F8X9?5(BD+X\*JPP,SAMI['YB4@3T*/#4MZ3X^+,N62H"TF"XC.(PQ
    21 MZ!$F'&124L=/8C&B&[0!K24FJ)>Q6?E0RJ>T"&!*'@F+@'J+@(X7`;WE(J!L
    22 M$="Y14!OM@CHY"*@URX">N=%0.^V".BWM@@T.Q/4.1/Q=\BO..-:=`:,W\V+
    23 MUJY&V]6I7^OWI9<Z]IFF*M/:P6(2&*+OB:'(S3.8GCLZ@[[..^+TZW(4_:UC
    24 MH'(*T?5Y/U#><?3H[3T#@'H<+!L/+S*![99RY69KL>0U?&+H/KOF'+OV.;ON
    25 M/%@]1LN_Y;**NY'AW4@>'6WFR5&>=B<<R49ZAAT.HU#RD1O;R\:V7$0'6[,=
    26 M9?L83QL!I8?&6"\20<L&Y@&F!)LKFH)JV]Q%@QU*,'PS[,\%_H6H^&G&M&9M
    27 M8[93V,=A5V!_9_34UF(6"PFJO/)FP3;-8'@6+>,"4YO!Q#R5LX4J%PJ#+6"5
    28 M%Q+8J!DMN/U"@34>"6]0N6`KMY#]T];PL6:>T.D.#]/N<'!T,AH\ELQC[6DB
    29 M^=DFB(627*CSKCK1Y2<;ME+1.B7JT95JSC2+Z(Z4R0])H[-'TQL0HIS#&K((
    30 MV)0&8[E@)X!]HP?X3,'VEPK%IR1CMN-E,./MB!``&K'OXG+K^I#T@.U_VW89
    31 M+%`TNVEN01NR25"TU.RKQ?:4_,-<7>:+UKBG/LO`#\U9O:$'\Z>PA].B4`]I
    32 M_5A>/^JT->])9D`XS^1S2D0ODM()09V552LGQU->=*)ZE;2N%=CK9792;+W^
    33 MU",P#T),A+#O/+34CC?BOQ^IG5IA?V]B.[_:3CF!Y[R+>=]0SG)Q]$SBB_V6
    34 M%U`^Y93U[3CE_5H[VS?F;&D?ADQ\YMR8(^?&LGS*6:X-LV4NYF/7ISGRX>A4
    35 MSHY>\))8L.F>@8FR4]9@1^FEKLS\:O1.>'3S'G+/%V7NI23XGCDJ<=#<5TE`
    36 M'KLK$=$ACR6BFYR6"/!IOR7A?>RZ)+Q/>B\=\*]S8`:$=</S&_",GH#[-/KR
    37 MXX<O/XDQ1J,FGA6*?%R>3!?%!/O^=+XHYC"ODT6)$O%M2VC##OZT]>ZYS-'G
    38 M28B&<0F@3J8<$YI,8<.F;,@F<RY/\;>8@QV\X==LX::\@W+]!*\>RDF@P)[_
    39 MA*9/Q2180-`!\Z#Q!([X6($-?T+\`F_GX<SPY2<:!]7@!P[0808TQ78\A;@F
    40 M_+Q@P<W"^X;]AGEBYIOI!_8ILH\JR=S/&G8+U=3-`J>$"GX*'7CQ,[,*W?!W
    41 M*IG9Z8P?"7^GD"TF$MZ'.GX=WN+/C.<$*I*YGX2'L+WR@^3MAA]4,S')K#5<
    42 M2QZ4V56QGXK]5.RG0K_07(6>X<$TQB*J@?\T6B]6Z__\^OAE\G7_PU^_TIBO
    43 MDE(#67T:_>_CY\^CK^E^28KNBDW2\27B=+P:K\>;\7:\&]?C_?CP[!)1RN>7
    44 MB%+=C:;;8K5)]WU2HV97K+,:<S=:H6;;U5BTV1>KNJMQJ#D4ZZS&HQ=J]JE&
    45 M57>CS;[8=FV40,VAV&4UF-<6-?O$M<KN6)6Z=+&H]/F+164N7RPJ>_EB4;DK
    46 M+A:5OWRQJ*O+%XM:#%TL'M(A;I^.;W4ZNNW2>6V;SF.;_JETM2FFVT3DD(CL
    47 M$Y$Z$=DE(NO^N72(BUTBL$T$UHG`JG\F78.+W95<;',B.B<"%;Z6R"81F7[`
    48 MWVL!72<"JYR`S0&MB^E^@(LA/#8YH&Z0BWJ`P&8`4'#A,P+;NMB<Y^+$5&`7
    49 M,T0QEVMEV\T%8A&YCNX')K,=F$R?CUQ)=YC-$!_;B[/)M72-S>H\L$.S82JY
    50 MJG8:MDT4-A?YR/5TA^UOB(]+5.)&0/GU<$.LN1QN)MC<"S>0-=>ZC3(TU[J-
    51 M2)M;W$95FWO89O$T-Z_-:FPN4YO]H;WHW.P/\29RVCYBV-6N><2HT_:1Y=JP
    52 M)7@2[2//HGW$B-.&/X$!IPW;PG.#P!%5W*!YY-&V@1]B*PLV(Q(ROR-LD:`,
    53 M"<J0H`P)RI"@#`G*D*`,"<J0H`X)ZI"@#@GJD*`.">J0H`X)ZI"@#@GJD*`.
    54 M">J0H&=(J`L718?<:]_G'GN=.^J[W#??YD[Y9N@L\`943YW67T-ZG9-.ANTM
    55 MF!Z@?.JT?B7Y;4Y^E9-/MO"5C%^B?.J@?"7Y30^7:'+C$--O8/P2Y6CL7\GX
    56 M^B0NW\+T.:K1L3C+\"XGO3V-1T\#HX]QENG74XX.S3'C^U>0[VM@="B.&7\C
    57 MRM&)NEY%=CGY[6E<7J8B5U.-3ML+5"1Z=I'\M^CUZRDG1_&LCFQ[H$0O[I6<
    58 MOQ'EY)P><UZ?1N;TXHD^Y5G.WXAR<HK/:DO=0^:Z97]94UY'-3G@Y[&.#G&D
    59 MO\GIOU!+WHAR<OK/ZG</E2MWJLNZ_3JJZ9!QS/$NI[U]*YS?@"K[P</ZW+M+
    60 MVU-.O>XM]'J?TZ][%QR[?=<47O:.NB(\[9U,)7^L*.SA;W<=:7;SM[M.+.SK
    61 M;RE[SW*B#A'V^K<=??;\^UL4'P#ZVRV?`S;Y$(X/#EG9<SD#G0\AE"F[X'+V
    62 MGKC<R858,!U+Q*+)\"%>N[NLS"8U0X#X8)2Q1WPXVF;O/9=WF:0JKL@8E"',
    63 MDY7YF+;)>TBNR#2)6<QD)IG%;(:26:0,(FE#14:1F:1-5L%<=B"HZGB;57D8
    64 MJ:GA8UTV426YG+F`B@\$69G5?),QH=C.KS,"ELM9!\?E;)7S47.=+70PN<IT
    65 M37.,*1.L9@;S26KFD+)UQQQVD];IZ)MJ<H^RJ;'9,:2I<=F)JJGA(VHV<</G
    66 MU&Q>A@^KV3Q,.+%F[_F0O,K>*RYG]H.O^`:O"[N+/\JW%)EO-L=[9>_4V4W+
    67 MYINMR[=AS_8OGJ[U4.+3M:'7+.C9'!SI:B(GHDEY4*M.!#:)P#H16"4"73I0
    68 ML]7UPJ^OBM#U0EJ)P`N"8F:0@^VUTP@;:B_TVH&YNY)(LP>?"+T.260[,)7V
    69 M6.TO$+D8$.^%7O<#<SDODO8$)*[7T<T`(LWNUP^_OBH:+8:U]/QL,C["OMP/
    70 MO5Z[XGJ7';W0ZY"&#/&1R25LC'$C,!<RN+[_D_T;AMO>)SYXU0'B.CQZ&2/)
    71 M\+_%86V`\E5AMN_JK/9MX;4S>$2'ZBWB@@.43X79OO]HU8DPV_<;K7IQ>.U[
    72 MB7F_.,S6<R57.?F>!J9#W/7[]8LHOR+,=B7]=""]/LSV(LHGPVS?<3CBA''\
    73 MCD,^UUC'34[[6AG&>,A9Z_AZRB?#:U<N^%_A,N=4>.TU3L[[WE1>%V9[%BL]
    74 M"HT<Q[#T<0@KMYBAPA['%=QQ=,4?QQDX\M:/,X0K]G[R99T%KCCTMLG+JKF1
    75 M3^6CP!9'WE9YV39W]:GLF@O[5/;-K7T"JFKNZU-9-)?VJ<RBRN)L+*PL@,EQ
    76 MMVU>YER3O,SLY65F+R^[?CB*VD2!)+8V6R"5><EV['#0;5/W8V[3O*SZ01V.
    77 MN66!4@ZY]8)\(6AY%'#;]>-MJZS,`;=I7A;]H"8'VZ9Y6399#JG<CZMRK.U9
    78 MJ"TO,WAYV?5BH"I$L++`6=6+#H9`VSI[S<RM^W&V/&`U$&>;KK+F)L2,L_5C
    79 M0V`OJW`AI)M5^!!6[BI,"/KF%2$8N,XJ0M@WBXISF&U#F89PG&U%&<@<:`.-
    80 M;W&_+AP+1^UFT&'E\NW5Y\E--L^,WL2<Z&U,?-[%C.<Z)COO8\[R(:8AKV(:
    81 M\C;F&S=[3)MN7,<\XWW,'S[$%.!I3`%>Q13@=4P!WL04X&U,`-[%!.!I3`!>
    82 MQ03@34P`WL;TWSJF__*@.O;2L9>.8^DXEHZ]]#@9S2\_F=C3Q)XF]C1Q;B;.
    83 MS<2YV=C+QEXV]K*12QM[V7%RX;[\Y&)/%WNZV-.-58.!&R=+P(5V3!\EX;GG
    84 M.CS(9B@?>_HXIH^]1!6[X8E:!:AB1SRU/?$415^-D]U!*:C-NGFB:$I"*2I/
    85 MISV=^B3]$10G+"CR+2B*5%`:GZ)X1-(@(=/8,O$N$^\R]0UJU!C&4(K]DS()
    86 ME?H'=6IL9BA%WE7B7:7^2:V$3OUU&E^G\9-JB:!;C9F/Z\]=2$G7_EE*NJD^
    87 MQ33TZIH4=".>IZ`;.DY!-_(X!=VHXQ1THX]3T(TY3D$W]C@%W;CC%'3CCU/0
    88 M;76<@FZSQ'M+EU+0K3R?@F[5Y11TJR^GH%MS10JZM9=3T*V[G()N_2T%_9:"
    89 M?DM!_\VGH+OJEH+>(B%N*>@M$G1+0;^EH%]'^9:"?DM!OT#YEH)^2T&_I:!G
    90 MR)Q>/+<4]%L*^LMVJEL*>L?Q+04]U=Q2T&\IZ*%\2T%ORM]/"KJ3MQ3T6PKZ
    91 M+07]-Y^"[M0M!;TC?TM!/T?YEH*>\+BEH-]2T&\IZ*^B?$M!OZ6@G^/XEH)^
    92 M2T&_I:#?4M"3V&XIZ+<4]+_C%'2G;RGHMQ3T6PKZKY6"[LR%%'1GGZ6@.]<E
    93 M9SN?_J_HH_9_BSZ<A^ZKYWGH7MR-A-V;0OF]+OU>%4K4="@$[64AY9X*(?:%
    94 ME2E1W-/=2-%>\TM5$!KO"V&YBY'H(D2-YA;]//IU'U3V\FY$!M5*U8%ZX3N^
    95 MLJ\H^XM?4?87OJ+LK_B*LK_B*\K^BJ\HB^KR5Y1%=?DKRJ(:_(KRH?#6V@_)