Changeset ca3864 in git


Ignore:
Timestamp:
Jan 21, 2015, 2:54:46 PM (9 years ago)
Author:
Stephan Oberfranz <oberfran@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
7023cea48460891d8d8145b55190cccabdc80741
Parents:
4083faab6546fc5c3396c90683e190ab3b4d13274e33058a3cced5901e5f2b51d7435047555c71ca
Message:
---

Merge branch 'spielwiese' of github.com:Singular/Sources into spielwiese
Files:
12 added
15 deleted
63 edited
1 moved

Legend:

Unmodified
Added
Removed
  • Makefile.am

    r4083fa rca3864  
    88libpolys gfanlib IntegerProgramming \
    99kernel Singular \
    10 dox emacs debian redhat desktop
     10dox emacs desktop
    1111
    12 EXTRA_DIST = README README.md autogen.sh git-version-gen doxy
     12EXTRA_DIST = README README.md README.pkg autogen.sh git-version-gen doxy singular.spec.in
    1313
    1414bin_SCRIPTS = libsingular-config
  • Singular/LIB/grwalk.lib

    r4e3305 rca3864  
    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
     481<<<<<<< HEAD
     482  G = system("Mpwalk",G,n1,n2,curr_weight,target_weight,nP,reduction,printout);
     483 
     484=======
    479485  G = system("Mpwalk", G, n1, n2, curr_weight, target_weight,nP);
    480486
     487>>>>>>> f533f6f7667328bccb271b19b2f603aaebe41596
    481488  setring xR;
    482489  //kill Go;
     
    492499    ring r = 32003,(z,y,x), lp;
    493500    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);
     501    int reduction = 1;
     502    int printout = 2;
     503    pwalk(I,2,2,reduction,printout);
    498504}
    499505
  • Singular/LIB/modwalk.lib

    • Property mode changed from 100644 to 100755
    r4e3305 rca3864  
    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  }
     83<<<<<<< HEAD
     84=======
    8285
    8386//-------------------------  make i homogeneous  -----------------------------
     
    106109  }
    107110
     111>>>>>>> f533f6f7667328bccb271b19b2f603aaebe41596
    108112//-------------------------  compute a standard basis mod p  -----------------------------
    109 
    110113  if(variant == 1)
    111114  {
    112115    if(size(#)>0)
    113116    {
    114       i = rwalk(i,radius,pert_deg,#);
    115      // rwalk(i,radius,pert_deg,#); std(i);
     117      i = rwalk(i,radius,pert_deg,reduction,#);
    116118    }
    117119    else
    118120    {
    119       i = rwalk(i,radius,pert_deg);
     121      i = rwalk(i,radius,pert_deg,reduction);
    120122    }
    121123  }
     
    124126    if(size(#) == 2)
    125127    {
    126       i = gwalk(i,#);
     128      i = gwalk(i,reduction,#);
    127129    }
    128130    else
    129131    {
    130       i = gwalk(i);
     132      i = gwalk(i,reduction);
    131133    }
    132134  }
     
    135137    if(size(#) == 2)
    136138    {
    137       i = frandwalk(i,radius,#);
     139      i = frandwalk(i,radius,reduction,#);
    138140    }
    139141    else
    140142    {
    141       i = frandwalk(i,radius);
     143      i = frandwalk(i,radius,reduction);
    142144    }
    143145  }
     
    157159    if(size(#) == 2)
    158160    {
    159      i=prwalk(i,radius,pert_deg,pert_deg,#);
     161     i=prwalk(i,radius,pert_deg,pert_deg,reduction,#);
    160162    }
    161163    else
    162164    {
    163       i=prwalk(i,radius,pert_deg,pert_deg);
     165      i=prwalk(i,radius,pert_deg,pert_deg,reduction);
    164166    }
    165167  }
     
    168170    if(size(#) == 2)
    169171    {
    170       i=pwalk(i,pert_deg,pert_deg,#);
     172      i=pwalk(i,pert_deg,pert_deg,reduction,#);
    171173    }
    172174    else
    173175    {
     176<<<<<<< HEAD
     177      i=pwalk(i,pert_deg,pert_deg,reduction);
     178=======
    174179      i=pwalk(i,pert_deg,pert_deg);
    175180    }
     
    189194        kill HomR;
    190195      }
    191     }
    192   }
     196>>>>>>> f533f6f7667328bccb271b19b2f603aaebe41596
     197    }
     198  }
     199
    193200  setring R0;
    194201  return(list(fetch(@r,i),p));
     
    204211  ring ra = 0,x(1..4),(a(a),lp);
    205212  ideal I = std(cyclic(4));
     213  int reduction = 1;
    206214  ring rb = 0,x(1..4),(a(b),lp);
    207215  ideal I = imap(ra,I);
    208   modpWalk(I,p,1,a,b);
     216  modpWalk(I,p,1,reduction,a,b);
    209217  std(I);
    210218}
     
    212220////////////////////////////////////////////////////////////////////////////////
    213221
    214 proc modWalk(def II, int variant, list #)
     222proc modWalk(def II, int variant, int reduction, list #)
    215223"USAGE:  modWalk(II); II ideal or list(ideal,int)
    216224ASSUME:  If variant =
     
    487495  if(n2 > 4)
    488496  {
    489   //  L[5] = prime(random(an,en));
     497    L[5] = prime(random(an,en));
    490498  }
    491499  if(printlevel >= 10)
     
    504512    for(i=1; i<=size(L); i++)
    505513    {
    506       Arguments[i] = list(II,L[i],variant,list(curr_weight,target_weight));
     514      Arguments[i] = list(II,L[i],variant,reduction,list(curr_weight,target_weight));
    507515    }
    508516  }
     
    511519    for(i=1; i<=size(L); i++)
    512520    {
    513       Arguments[i] = list(II,L[i],variant);
     521      Arguments[i] = list(II,L[i],variant,reduction);
    514522    }
    515523  }
     
    528536//-------------------  Now all leading ideals are the same  --------------------
    529537//-------------------  Lift results to basering via farey  ---------------------
    530 
    531538    tt = timer; rt = rtimer;
    532539    N = T2[1];
     
    545552
    546553//----------------  Test if we already have a standard basis of I --------------
    547 
    548554    tt = timer; rt = rtimer;
    549     pTest = pTestSB(I,J,L,variant);
    550     //pTest = primeTestSB(I,J,L,variant);
     555    pTest = primeTest(J, prime(random(1000000000,2134567879)));
    551556    if(printlevel >= 10)
    552557    {
     
    596601    }
    597602//--------------  We do not already have a standard basis of I, therefore do the main computation for more primes  --------------
    598 
    599603    T1 = H;
    600604    T2 = N;
     
    613617      for(i=j; i<=size(L); i++)
    614618      {
    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));
     619        Arguments[size(Arguments)+1] = list(II,L[i],variant,reduction,list(curr_weight,target_weight));
    617620      }
    618621    }
     
    621624      for(i=j; i<=size(L); i++)
    622625      {
    623         //Arguments[i-j+1] = list(II,L[i],variant);
    624         Arguments[size(Arguments)+1] = list(II,L[i],variant);
     626        Arguments[size(Arguments)+1] = list(II,L[i],variant,reduction);
    625627      }
    626628    }
     
    632634    for(i=1; i<=size(PP); i++)
    633635    {
    634       //P[size(P) + 1] = PP[i];
    635636      T1[size(T1) + 1] = PP[i][1];
    636637      T2[size(T2) + 1] = bigint(PP[i][2]);
     
    649650  echo = 2;
    650651  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);
     652  ideal I= y3+xyz+y2z+xz3, 3+xy+x2y+y2z;
     653  int reduction = 0;
     654  ideal J = modWalk(I,1,1);
    654655  J;
    655656}
     
    772773  return(J);
    773774}
    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 }
     775
    974776////////////////////////////////////////////////////////////////////////////////
    975777static proc mixedTest()
  • Singular/LIB/normaliz.lib

    r4083fa rca3864  
    11//// Singular library normaliz.lib
    22
    3 version="version normaliz.lib 4.0.0.0 Jun_2013 "; // $Id$
     3version="version normaliz.lib 4.0.1.0 Jan_2015 "; // $Id$
    44category="Commutative Algebra";
    55info="
    6 LIBRARY: normaliz.lib  Provides an interface for the use of Normaliz 2.7
    7          within SINGULAR.
    8 AUTHORS:  Winfried Bruns, Winfried.Bruns@Uni-Osnabrueck.de
    9           Christof Soeger, Christof.Soeger@Uni-Osnabrueck.de
     6LIBRARY: normaliz.lib  Provides an interface for the use of Normaliz 2.8 or
     7         newer within SINGULAR.
     8AUTHORS: Winfried Bruns, Winfried.Bruns@Uni-Osnabrueck.de
     9         Christof Soeger, Christof.Soeger@Uni-Osnabrueck.de
    1010
    1111OVERVIEW:
    12 The library normaliz.lib provides an interface for the use of Normaliz 2.7
    13 within SINGULAR. The exchange of data is via files.
     12@texinfo
     13The library normaliz.lib provides an interface for the use of Normaliz 2.8 or
     14newer within SINGULAR. The exchange of data is via files.
    1415In addition to the top level
    1516functions that aim at objects of type ideal or ring, several other auxiliary
    1617functions allow the user to apply Normaliz to data of type intmat. Therefore
    1718SINGULAR can be used as a comfortable environment for the work with Normaliz.
    18 @* Please see the @code{Normaliz2.7Documentation.pdf} (included in the Normaliz
     19@* Please see the @code{Normaliz.pdf} (included in the Normaliz
    1920distribution) for a more extensive documentation of Normaliz.
    20 @code{nmz_sing.pdf} describes this library version 2.2, but most points are
    21 still valid.
    22 
    23 @*Singular and Normaliz exchange data via files. These files are automatically
     21
     22Normaliz allows the use of a grading. In the Singular functions that access
     23Normaliz the parameter grading is an intvec that assigns a (not necessarily
     24positive) degree to every variable of the ambient polynomial ring.
     25But it must give positive degrees to the generators given to function.
     26
     27Singular and Normaliz exchange data via files. These files are automatically
    2428created and erased behind the scenes. As long as one wants to use only the
    2529ring-theoretic functions there is no need for file management.
    26 
    2730@*Note that the numerical invariants computed by Normaliz can be
    2831accessed in this \"automatic file mode\".
    29 
    3032@*However, if Singular is used as a frontend for Normaliz or the user
    3133wants to inspect data not automatically returned to Singular, then
     
    3436Deletion of the files is left to the user.
    3537
    36 @* Use of this library requires the program Normaliz to be installed.
     38Use of this library requires the program Normaliz to be installed.
    3739You can download it from
    3840@uref{http://www.mathematik.uni-osnabrueck.de/normaliz/}. Please make sure
    3941that the executables are in the search path or use setNmzExecPath
    4042(@ref{setNmzExecPath}).
    41 
    42 KEYWORDS: integral closure; normalization
     43@end texinfo
     44
     45KEYWORDS: integral closure; normalization; toric ring
    4346
    4447PROCEDURES:
     
    5053                              elements of I
    5154 normalToricRingFromBinomials(ideal I)  computes the normalization of the
    52                               polynomial ring modulo the unique minimal prime
    53                               ideal of the binomial ideal I
    54  ehrhartRing(ideal I)         computes the monomials representing the lattice
    55                               points of the polytop generated leading monomials
    56                               of the elements of I
    57  intclMonIdeal(ideal I)       the exponent vectors of the leading monomials of
    58                               the elements of I are considered as generators of
    59                               a monomial ideal whose Rees algebra is computed
    60 
     55                              polynomial ring modulo the unique minimal binomial
     56                              prime ideal of the binomial ideal I
     57 ehrhartRing(ideal I)         considers the exponent vectors of the elements of I
     58                              as points of a lattice polytope and computes the
     59                              integral cloure of the polytopal algebra
     60 intclMonIdeal(ideal I)       Computes the integral closure of the Rees algebra
     61                              of the ideal generated by the leading monomials of
     62                              the elements of I
    6163 torusInvariants(intmat T)    computes the ring of invariants of a torus action
    6264 finiteDiagInvariants(intmat C)  computes the ring of invariants of a finite
     
    7072 intersectionValRingIdeals(intmat V)       computes ideals of monomial valuations
    7173
    72  showNuminvs()                prints the numerical invariants
    73  exportNuminvs()              exports the numerical invariants
     74 showNuminvs()                prints the numerical invariants found by Normaliz
     75 exportNuminvs()              exports the numerical invariants found by Normaliz
    7476
    7577 setNmzOption(string s, int onoff) sets the option s to onoff
     
    237239    desString("nmz_data_path",nmz_data_path_name);
    238240    nmz_data_path=appendSlash(nmz_data_path);
    239 }example
     241}
     242example
    240243{ "EXAMPLE:";echo = 2;
    241244  setNmzDataPath("examples/");
     
    395398    {
    396399        f=getNmzFile()+"."+suffixes[i];
    397         if (fileExists(f)) { dummy=system("sh","rm "+f+ "&> /dev/null"); }
     400        if (fileExists(f))
     401        {
     402            dummy=system("sh","rm "+f+ "&> /dev/null");
     403        }
    398404    }
    399405}
     
    580586    for (int k=1; k+1<=size(#); k=k+2) {
    581587    //get data from the parameter list
    582       sgr   = #[k];
    583       num_rows = nrows(sgr);
    584       num_cols = ncols(sgr);
    585                 n_mode   = #[k+1];
    586 
    587       write(outf,num_rows);
    588       write(outf,num_cols);
    589 
    590       for(i=1;i<=nrows(sgr);i++)
    591       {
    592         s="";
    593         for(j=1;j<=num_cols;j++)
    594         {
    595            s=s+string(sgr[i,j])+" ";
    596         }
    597         write(outf,s);
    598       }
    599       write(outf,n_mode);
    600       write(outf,"");
     588        n_mode   = #[k+1];
     589        if (n_mode != -1) { //skip -1 mode
     590            sgr = #[k];
     591            num_rows = nrows(sgr);
     592            num_cols = ncols(sgr);
     593
     594            write(outf,num_rows);
     595            write(outf,num_cols);
     596
     597            for(i=1;i<=nrows(sgr);i++)
     598            {
     599                s="";
     600                for(j=1;j<=num_cols;j++)
     601                {
     602                    s=s+string(sgr[i,j])+" ";
     603                }
     604                write(outf,s);
     605            }
     606            if (n_mode == 20) {
     607                write(outf,"grading");
     608            } else {
     609                write(outf,n_mode);
     610            }
     611            write(outf,"");
     612        }
    601613    }
    602614    close(outf);
     615}
     616
     617
     618static proc prepareGrading(list #)
     619{
     620    if (size(#)==0) {
     621        return(0,-1); // mode -1 specifies discard the matrix
     622    }
     623    if (size(#)>1) {
     624        print(#);
     625        ERROR("To many parameters!");
     626    }
     627    intmat g = intmat(#[1],1,size(#[1]));
     628    return (g,20);
    603629}
    604630
     
    611637          mode. See the Normaliz documentation for more information.
    612638
    613                          It is also possible to give more than one pair of matrix and mode. In
    614                          this case all matrices and modes are written. This can be used to
    615                          combine modes 4,5,6.
     639          It is also possible to give more than one pair of matrix and mode. In
     640          this case all matrices and modes are written. This can be used to
     641          combine modes 4,5,6.
     642          Use mode=20 to specify a grading.
    616643NOTE:     Needs an explicit filename set. The filename is created from the
    617644          current filename.
     
    677704    (n_cols,p)=getInt(s,p);
    678705    if (n_rows <= 0 || n_cols <= 0) {
    679              intmat empty;
    680              return(empty);
    681     }
    682          intmat nmz_gen[n_rows][n_cols];
     706         intmat empty;
     707         return(empty);
     708    }
     709    intmat nmz_gen[n_rows][n_cols];
    683710    for(i=1;i<=n_rows;i++)
    684711    {
     
    696723  intmat sgrnormal=normaliz(sgr,0);
    697724  readNmzData("cst");
    698   readNmzData("typ");
    699725}
    700726
     
    714740        list nmz_options=
    715741        list("supp",0,"-s",0),
    716         list("triang",0,"-v",0),
    717         list("volume",0,"-V",0),
     742        list("triang",0,"-tT",0),
     743        list("volume",0,"-v",0),
    718744        list("hvect",0,"-p",0),
    719         list("hvect_l",0,"-P",0),
    720745        list("height1",0,"-1",0),
    721746        list("normal",0,"-n",1),
    722747        list("normal_l",0,"-N",1),
    723748        list("hilb",0,"-h",1),
    724         list("hilb_l",0,"-H",1),
    725749        list("dual",0,"-d",1),
    726750        list("control",0,"-c",2),
     
    739763The Normaliz options are accessible via the following names:
    740764@* @code{-s:  supp}
    741 @* @code{-v:  triang}
    742 @* @code{-V:  volume}
     765@* @code{-t:  triang}
     766@* @code{-v:  volume}
    743767@* @code{-p:  hvect}
    744 @* @code{-P:  hvect_l}
    745768@* @code{-1:  height1}
    746769@* @code{-n:  normal}
    747770@* @code{-N:  normal_l}
    748771@* @code{-h:  hilb}
    749 @* @code{-H:  hilb_l}
    750772@* @code{-d:  dual}
    751773@* @code{-a:  allf}
     
    788810        {
    789811            run_options=run_options+nmz_options[i][3];
    790                                 if (nmz_options[i][1]=="threads") {
    791                                         run_options=run_options+string(nmz_options[i][2]);
    792                                 }
    793                                 run_options=run_options+" ";
     812                if (nmz_options[i][1]=="threads") {
     813                    run_options=run_options+string(nmz_options[i][2]);
     814                }
     815                run_options=run_options+" ";
    794816            if(nmz_options[i][4]!=2)
    795817            {
     
    818840
    819841
    820 static proc runNormaliz(intmat sgr,def nmz_mode, list #)
     842static proc runNormaliz(intmat sgr, int nmz_mode, list #)
    821843{
    822844    if(!queryInt("nmz_files_keep_switch"))
     
    876898
    877899          It is also possible to give more than one pair of matrix and mode. In
    878                          this case all matrices and modes are used. This can be used to
    879                          combine modes 4,5,6.
     900          this case all matrices and modes are used. This can be used to
     901          combine modes 4,5,6.
     902          Use nmz_mode=20 to specify a grading.
    880903NOTE:     You will find procedures for many applications of Normaliz in this
    881904          library, so the explicit call of this procedure may not be necessary.
    882905SEE ALSO: intclToricRing, normalToricRing, ehrhartRing, intclMonIdeal,
    883906          torusInvariants, diagInvariants, finiteDiagInvariants, intersectionValRings,
    884                          intersectionValRingIdeals
     907             intersectionValRingIdeals
    885908EXAMPLE:  example normaliz; shows an example
    886909"
     
    935958                name_inv="h_vector";
    936959            }
    937             if(name_inv!="hilbert_polynomial")
     960            if(name_inv!="hilbert_polynomial"
     961              && name_inv!="hilbert_quasipolynomial")
    938962            {
    939963                for(i=1;i<=v_length;i++)
     
    961985            (sw,p)=nextWord(s,p);
    962986            name_inv=s[sw..p-1];
    963             (dummy_int,p)=getInt(s,p);
    964             num_invs=num_invs+list(list(name_inv,dummy_int,"int"));
     987            if (name_inv!="hilbert_quasipolynomial_denom") {
     988              (dummy_int,p)=getInt(s,p);
     989              num_invs=num_invs+list(list(name_inv,dummy_int,"int"));
     990            }
    965991        }
    966992        if(type_inv=="boolean")
     
    10001026{ "EXAMPLE:"; echo=2;
    10011027  ring R=0,(x,y,z,t),dp;
    1002   ideal I=x^2,y^2,z^3;
     1028  ideal I=x3,x2y,y3;
    10031029  list l=intclMonIdeal(I);
    10041030  showNuminvs();
     
    10291055{ "EXAMPLE:"; echo=2;
    10301056  ring R=0,(x,y,z,t),dp;
    1031   ideal I=x^2,y^2,z^3;
     1057  ideal I=x3,x2y,y3;
    10321058  list l=intclMonIdeal(I);
    10331059  exportNuminvs();
    1034   // now the following variables are set:
     1060  // for example, now the following variables are set:
    10351061  nmz_hilbert_basis_elements;
    10361062  nmz_number_extreme_rays;
     
    10381064  nmz_index;
    10391065  nmz_number_support_hyperplanes;
    1040   nmz_homogeneous;
     1066  nmz_multiplicity;
    10411067  nmz_primary;
    1042   nmz_ideal_multiplicity;
    10431068}
    10441069
     
    11371162        if(expo_vecs[i,ncols(expo_vecs)]==d)
    11381163        {
    1139 
    11401164            m=1;
    11411165            for(j=1;j<=ncols(expo_vecs)-1;j++)
     
    11461170        }
    11471171    }
    1148      mons=simplify(mons,2);    // get rid of starting 0
    1149      return(mons);
     1172    mons=simplify(mons,2);    // get rid of starting 0
     1173    return(mons);
    11501174}
    11511175
     
    11551179RETURN:   Returns the intmat whose rows represent the exponents of the
    11561180          (non-zero) elements of I which have to be binomials.
    1157                          The length of each row is nvars(basering).
     1181          The length of each row is nvars(basering).
    11581182SEE ALSO: mons2intmat, intmat2mons
    11591183EXAMPLE:  example binomials2intmat; shows an example"
    11601184{
    1161   int i,j,k;
    1162   intmat expo_vecs[size(I)][nvars(basering)];
    1163   intvec expo_v;
    1164 
    1165   k=0;
    1166   poly f;
    1167 
    1168   for(i=1; i<=ncols(I); i++)
    1169   {
    1170     if( I[i] != 0 )
    1171     {
    1172       k++;
    1173       f = I[i];
    1174       if (leadcoef(f) != 1) {f = -f};  //works in all characteristics
    1175       if (size(f)!=2 || leadcoef(f)!=1 || leadcoef(f[2])!=-1)
    1176       {
    1177         ERROR(string("normalToricRing: binomial ideal expected: generator ",i,": ",I[i]));
    1178       }
    1179       expo_v = leadexp(f)-leadexp(f[2]);
    1180       for(j=1;j<=nvars(basering);j++)
    1181       {
    1182         expo_vecs[k,j]=expo_v[j];
    1183       }
    1184     }
    1185   }
    1186   return(expo_vecs);
     1185    int i,j,k;
     1186    intmat expo_vecs[size(I)][nvars(basering)];
     1187    intvec expo_v;
     1188
     1189    k=0;
     1190    poly f;
     1191
     1192    for(i=1; i<=ncols(I); i++)
     1193    {
     1194        if( I[i] != 0 )
     1195        {
     1196            k++;
     1197            f = I[i];
     1198            if (leadcoef(f) != 1) {f = -f};  //works in all characteristics
     1199            if (size(f)!=2 || leadcoef(f)!=1 || leadcoef(f[2])!=-1)
     1200            {
     1201                ERROR(string("normalToricRing: binomial ideal expected: generator ",i,": ",I[i]));
     1202            }
     1203
     1204            expo_v = leadexp(f)-leadexp(f[2]);
     1205            for(j=1;j<=nvars(basering);j++)
     1206            {
     1207                expo_vecs[k,j]=expo_v[j];
     1208            }
     1209        }
     1210    }
     1211    return(expo_vecs);
    11871212}
    11881213example
     
    11961221// integral closure of rings and ideals
    11971222
    1198 static proc runIntclToricRing(ideal I, int nmz_mode)
     1223static proc runIntclToricRing(ideal I, int nmz_mode, list #)
    11991224{
    12001225    intmat expo_vecs=mons2intmat(I);
    12011226
    12021227    string dummy=collectNmzOptions(); // only to set GenGen
    1203 
    1204     return( intmat2mons( runNormaliz(expo_vecs,nmz_mode) ) );
    1205 }
    1206 
    1207 proc intclToricRing(ideal I)
     1228    return( intmat2mons( runNormaliz(expo_vecs,nmz_mode, prepareGrading(#)) ) );
     1229}
     1230
     1231proc intclToricRing(ideal I, list #)
    12081232"USAGE:   intclToricRing(ideal I);
    1209 RETURN:   The toric ring S is the subalgebra of the basering generated by the
    1210           leading monomials of the elements of I. The function computes the
    1211           integral closure T of S in the basering and returns an ideal listing
     1233          intclToricRing(ideal I, intvec grading);
     1234RETURN:   The toric ring S is the subalgebra of the basering generated by
     1235          the leading monomials of the elements of I (considered as a list
     1236          of polynomials). The function computes the integral
     1237          closure T of S in the basering and returns an ideal listing
    12121238          the algebra generators of T over the coefficient field.
    12131239@*        The function returns the input ideal I if one of the options
    1214           @code{supp}, @code{triang}, or @code{hvect} has been activated.
     1240          @code{supp}, @code{triang}, @code{volume}, or @code{hseries}
     1241          has been activated.
    12151242          However, in this case some numerical invariants are computed, and
    12161243          some other data may be contained in files that you can read into
     
    12221249"
    12231250{
    1224     return(runIntclToricRing(I,0));
     1251    return(runIntclToricRing(I,0,#));
    12251252}
    12261253example
     
    12291256  ideal I=x3,x2y,y3;
    12301257  intclToricRing(I);
    1231 }
    1232 
    1233 proc normalToricRing(ideal I)
     1258  showNuminvs();
     1259  //now the same example with another grading
     1260  intvec grading = 2,3,1;
     1261  intclToricRing(I,grading);
     1262  showNuminvs();
     1263
     1264}
     1265
     1266proc normalToricRing(ideal I, list #)
    12341267"USAGE:   normalToricRing(ideal I);
     1268          normalToricRing(ideal I, intvec grading);
    12351269RETURN:   The toric ring S is the subalgebra of the basering generated by the
    1236           leading monomials of the elements of I. The function computes the
     1270          leading monomials of the elements of I (considered as a list of
     1271          polynomials). The function computes the
    12371272          normalisation T of S and returns an ideal listing the algebra
    12381273          generators of T over the coefficient field.
    12391274@*        The function returns the input ideal I if one of the options
    1240           @code{supp}, @code{triang}, or @code{hvect} has been activated.
     1275          @code{supp}, @code{triang}, @code{volume}, or @code{hseries}
     1276          has been activated.
    12411277          However, in this case some numerical invariants are computed, and
    12421278          some other data may be contained in files that you can read into
     
    12481284"
    12491285{
    1250     return(runIntclToricRing(I,1));
     1286    return(runIntclToricRing(I,1,#));
    12511287}
    12521288example
     
    12581294
    12591295
    1260 proc normalToricRingFromBinomials(ideal I)
     1296proc normalToricRingFromBinomials(ideal I, list #)
    12611297"USAGE:   normalToricRingFromBinomials(ideal I);
    1262 RETURN:
     1298          normalToricRingFromBinomials(ideal I, intvec grading);
     1299RETURN:   @texinfo
    12631300@tex
    12641301The ideal $I$ is generated by binomials of type $X^a-X^b$ (multiindex notation)
     
    12781315generators of the normalization of $K[N]$.
    12791316@end tex
     1317@end texinfo
    12801318@*        The function returns the input ideal I if one of the options
    1281           @code{supp}, @code{triang}, or @code{hvect} has been activated.
     1319          @code{supp}, @code{triang}, @code{volume}, or @code{hseries}
     1320          has been activated.
    12821321          However, in this case some numerical invariants are computed, and
    12831322          some other data may be contained in files that you can read into
    1284           Singular.
     1323          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
    12851324SEE ALSO: intclToricRing, normalToricRing, ehrhartRing, intclMonIdeal
    12861325EXAMPLE:  example normalToricRing; shows an example
    12871326"
    12881327{
    1289         intmat expo_vecs = binomials2intmat(I);
    1290         string dummy=collectNmzOptions(); // only to set GenGen
    1291         intmat result = runNormaliz(expo_vecs,10);
    1292 
    1293         list baseringlist = ringlist(basering);
    1294         ring S = (baseringlist[1]),(x(1..ncols(result))),dp;
    1295         ideal I = intmat2mons(result);
    1296         export(I);
    1297         return (S);
     1328    intmat expo_vecs = binomials2intmat(I);
     1329    string dummy=collectNmzOptions(); // only to set GenGen
     1330    intmat result = runNormaliz(expo_vecs,10,prepareGrading(#));
     1331
     1332    list baseringlist = ringlist(basering);
     1333    ring S = (baseringlist[1]),(x(1..ncols(result))),dp;
     1334    ideal I = intmat2mons(result);
     1335    export(I);
     1336    return (S);
    12981337}
    12991338example
     
    13061345}
    13071346
    1308 static proc runIntclMonIdeal(ideal I, int nmz_mode)
     1347static proc runIntclMonIdeal(ideal I, int nmz_mode, list #)
    13091348{
    13101349    intmat expo_vecs=mons2intmat(I);
     
    13241363
    13251364    //adjust size of input matrix
    1326          if (!last_comp) { // remove last component
    1327              intmat tmp[nrows(expo_vecs)][ncols(expo_vecs)-1] = expo_vecs[1..nrows(expo_vecs),1..(ncols(expo_vecs)-1)];
    1328                   expo_vecs = tmp;
    1329          }
    1330     intmat nmz_data=runNormaliz(expo_vecs,nmz_mode);
     1365    if (!last_comp) { // remove last component
     1366        intmat tmp[nrows(expo_vecs)][ncols(expo_vecs)-1]
     1367               = expo_vecs[1..nrows(expo_vecs),1..(ncols(expo_vecs)-1)];
     1368        expo_vecs = tmp;
     1369    }
     1370    intmat nmz_data=runNormaliz(expo_vecs,nmz_mode,prepareGrading(#));
    13311371
    13321372    if(last_comp)
     
    13461386"USAGE:    ehrhartRing(ideal I);
    13471387RETURN:    The exponent vectors of the leading monomials of the elements of I
    1348            are considered as vertices of a lattice polytope P.
     1388           are considered as points of a lattice polytope P.
    13491389           The Ehrhart ring of a (lattice) polytope P is the monoid algebra
    13501390           defined by the monoid of lattice points in the cone over the
     
    13551395               treated as the auxiliary variable of the Ehrhart ring. The
    13561396               function returns two ideals, the first containing the monomials
    1357                representing the lattice points of the polytope, the second
     1397               representing all the lattice points of the polytope, the second
    13581398               containing the algebra generators of the Ehrhart ring over the
    1359                     coefficient field.
     1399               coefficient field.
    13601400@*         (ii) If the last ring variable is used by the monomials, the list
    13611401                returned contains only one ideal, namely the monomials
     
    13631403@*
    13641404@*        The function returns the a list containing the input ideal I if one
    1365           of the options @code{supp}, @code{triang}, or @code{hvect} has been
    1366                         activated.
     1405          of the options @code{supp}, @code{triang}, @code{volume}, or
     1406          @code{hseries} has been activated.
    13671407          However, in this case some numerical invariants are computed, and
    13681408          some other data may be contained in files that you can read into
    1369           Singular.
     1409          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
    13701410NOTE:      A mathematical remark: the Ehrhart ring depends on the list of
    13711411           monomials given, and not only on the ideal they generate!
     
    13831423}
    13841424
    1385 proc intclMonIdeal(ideal I)
     1425proc intclMonIdeal(ideal I, list #)
    13861426"USAGE:   intclMonIdeal(ideal I);
     1427          intclMonIdeal(ideal I, intvec grading);
    13871428RETURN:   The exponent vectors of the leading monomials of the elements of I
    13881429          are considered as generators of a monomial ideal for which the
     
    14001441        closure of the ideal.
    14011442@*        The function returns the a list containing the input ideal I if one
    1402           of the options @code{supp}, @code{triang}, or @code{hvect} has been
    1403                         activated.
     1443          of the options @code{supp}, @code{triang}, @code{volume}, or
     1444          @code{hseries} has been activated.
    14041445          However, in this case some numerical invariants are computed, and
    14051446          some other data may be contained in files that you can read into
     
    14091450"
    14101451{
    1411     return(runIntclMonIdeal(I,3));
     1452    return(runIntclMonIdeal(I,3,#));
    14121453}
    14131454example
     
    14221463// torus invariants and valuation rings and ideals
    14231464
    1424 proc torusInvariants(intmat E)
     1465proc torusInvariants(intmat E, list #)
    14251466"USAGE:   torusInvariants(intmat A);
    1426 RETURN:
     1467          torusInvariants(intmat A, intvec grading);
     1468RETURN:   @texinfo
    14271469Returns an ideal representing the list of monomials generating the ring of
    14281470invariants as an algebra over the coefficient field.
     
    14301472$R^T$.
    14311473@end tex
    1432 @*The function returns the ideal given by the input matrix A if one of
    1433 the options @code{supp}, @code{triang}, or @code{hvect} has been
    1434 activated.
    1435 However, in this case some numerical invariants are computed, and
    1436 some other data may be contained in files that you can read into
    1437 Singular.
    1438 BACKGROUND:
     1474@*        The function returns the ideal given by the input matrix A if one of
     1475          the options @code{supp}, @code{triang}, @code{volume}, or
     1476          @code{hseries} has been activated.
     1477          However, in this case some numerical invariants are computed, and
     1478          some other data may be contained in files that you can read into
     1479          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
     1480@end texinfo
     1481BACKGROUND: @texinfo
    14391482@tex
    14401483 Let $T = (K^*)^r$ be the $r$-dimensional torus acting on the polynomial ring
     
    14471490$A=(a_{i,j})$.
    14481491@end tex
     1492@end texinfo
    14491493SEE ALSO: diagInvariants, finiteDiagInvariants, intersectionValRings,
    14501494          intersectionValRingIdeals
     
    14591503    string dummy=collectNmzOptions();  // only to set GenGen
    14601504
    1461     return( intmat2mons( runNormaliz(E,5) ) );
     1505    return( intmat2mons( runNormaliz(E,5,prepareGrading(#)) ) );
    14621506}
    14631507example
     
    14681512}
    14691513
    1470 proc finiteDiagInvariants(intmat C)
     1514proc finiteDiagInvariants(intmat C, list #)
    14711515"USAGE:   finiteDiagInvariants(intmat U);
    1472 RETURN:
     1516          finiteDiagInvariants(intmat U, intvec grading);
     1517RETURN:   @texinfo
    14731518@tex
    14741519This function computes the ring of invariants of a finite abelian group $G$
     
    14851530{$R^G=\{f\in R : g_i f = f$ for all $i=1,\ldots,w\}$}.
    14861531@end tex
    1487 @*The function returns the ideal given by the input matrix C if one of
    1488 the options @code{supp}, @code{triang}, or @code{hvect} has been
    1489 activated.
    1490 However, in this case some numerical invariants are computed, and
    1491 some other data may be contained in files that you can read into
    1492 Singular.
     1532@end texinfo
     1533@*        The function returns the ideal given by the input matrix C if one of
     1534          the options @code{supp}, @code{triang}, @code{volume}, or
     1535          @code{hseries} has been activated.
     1536          However, in this case some numerical invariants are computed, and
     1537          some other data may be contained in files that you can read into
     1538          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
    14931539NOTE:
    14941540SEE ALSO: torusInvariants, diagInvariants, intersectionValRings,
    1495           intersectionValRingIdeals,showNuminvs,exportNuminvs
     1541          intersectionValRingIdeals
    14961542EXAMPLE:  example finiteDiagInvariants; shows an example
    14971543"
     
    15041550    string dummy=collectNmzOptions();  // only to set GenGen
    15051551
    1506     return( intmat2mons( runNormaliz(C,6) ) );
     1552    return( intmat2mons( runNormaliz(C,6,prepareGrading(#)) ) );
    15071553}
    15081554example
     
    15131559}
    15141560
    1515 proc diagInvariants(intmat E, intmat C)
     1561proc diagInvariants(intmat E, intmat C, list #)
    15161562"USAGE:   diagInvariants(intmat A, intmat U);
    1517 RETURN:
     1563          diagInvariants(intmat A, intmat U, intvec grading);
     1564RETURN:   @texinfo
    15181565@tex
    15191566This function computes the ring of invariants of a diagonalizable group
     
    15251572monomial ideal listing the algebra generators of the subalgebra of invariants.
    15261573@end tex
    1527 @*The function returns the ideal given by the input matrix A if one of
    1528 the options @code{supp}, @code{triang}, or @code{hvect} has been
    1529 activated.
    1530 However, in this case some numerical invariants are computed, and
    1531 some other data may be contained in files that you can read into
    1532 Singular.
    1533 SEE ALSO: torusInvariants, finiteDiagInvariants, intersectionValRings, intersectionValRingIdeals,showNuminvs,exportNuminvs
     1574@end texinfo
     1575@*        The function returns the ideal given by the input matrix A if one of
     1576          the options @code{supp}, @code{triang}, @code{volume}, or
     1577          @code{hseries} has been activated.
     1578          However, in this case some numerical invariants are computed, and
     1579          some other data may be contained in files that you can read into
     1580          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
     1581SEE ALSO: torusInvariants, finiteDiagInvariants, intersectionValRings, intersectionValRingIdeals
    15341582EXAMPLE:  example diagInvariants; shows an example
    15351583"
     
    15421590    string dummy=collectNmzOptions();  // only to set GenGen
    15431591
    1544     return( intmat2mons( runNormaliz(E,5,C,6) ) );
     1592    return( intmat2mons( runNormaliz(E,5,C,6,prepareGrading(#)) ) );
    15451593}
    15461594example
     
    15521600}
    15531601
    1554 proc intersectionValRings(intmat V)
    1555 "USAGE:   intersectionValRings(intmat V);
     1602proc intersectionValRings(intmat V, list #)
     1603"USAGE:   intersectionValRings(intmat V, intvec grading);
    15561604RETURN:   The function returns a monomial ideal, to be considered as the list
    15571605          of monomials generating @math{S} as an algebra over the coefficient
    15581606          field.
    1559 BACKGROUND:
     1607BACKGROUND: @texinfo
    15601608@tex
    15611609A discrete monomial valuation $v$ on $R = K[X_1 ,\ldots,X_n]$ is determined by
     
    15651613its input.
    15661614@end tex
    1567 @*The function returns the ideal given by the input matrix V if one of
    1568 the options @code{supp}, @code{triang}, or @code{hvect} has been
    1569 activated.
    1570 However, in this case some numerical invariants are computed, and
    1571 some other data may be contained in files that you can read into
    1572 Singular.
    1573 SEE ALSO: torusInvariants, diagInvariants, finiteDiagInvariants, intersectionValRingIdeals,showNuminvs,exportNuminvs
     1615@end texinfo
     1616@*        The function returns the ideal given by the input matrix V if one of
     1617          the options @code{supp}, @code{triang}, @code{volume}, or
     1618          @code{hseries} has been activated.
     1619          However, in this case some numerical invariants are computed, and
     1620          some other data may be contained in files that you can read into
     1621          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
     1622SEE ALSO: torusInvariants, diagInvariants, finiteDiagInvariants, intersectionValRingIdeals
    15741623EXAMPLE:  example intersectionValRings; shows an example
    15751624"
     
    16011650/*    if(!GenGen) // return V
    16021651    {
    1603         runNormaliz(V1,4);
     1652        runNormaliz(V1,4,prepareGrading(#));
    16041653        return(V);
    16051654    }
    16061655*/
    1607     return(intmat2mons(runNormaliz(V1,4)));
     1656    return(intmat2mons(runNormaliz(V1,4,prepareGrading(#))));
    16081657}
    16091658example
     
    16141663}
    16151664
    1616 proc intersectionValRingIdeals(intmat V)
     1665proc intersectionValRingIdeals(intmat V, list #)
    16171666"USAGE:   intersectionValRingIdeals(intmat V);
     1667          intersectionValRingIdeals(intmat V, intvec grading);
    16181668RETURN:   The function returns two ideals, both to be considered as lists of
    1619           monomials which generate an algebra over the coefficient field. The
     1669          monomials. The
    16201670          first is the system of monomial generators of @math{S}, the second
    16211671          the system of generators of @math{M}.
     
    16261676          some other data may be contained in files that you can read into
    16271677          Singular (see @ref{showNuminvs}, @ref{exportNuminvs}).
    1628 BACKGROUND:
     1678BACKGROUND: @texinfo
    16291679@tex
    16301680A discrete monomial valuation $v$ on $R = K[X_1 ,\ldots,X_n]$ is determined by
     
    16391689The numbers $w_i$ form the $(n+1)$th column of the input matrix.
    16401690@end tex
     1691@end texinfo
    16411692NOTE:   The function also gives an error message if the matrix V has the
    16421693        wrong number of columns.
     
    16711722    string dummy=collectNmzOptions();  // only to set GenGen
    16721723
    1673     intmat nmz_data=runNormaliz(V1,4);
     1724    intmat nmz_data=runNormaliz(V1,4,prepareGrading(#));
    16741725
    16751726    ideal I1=intmat2monsSel(nmz_data,0);
  • Singular/LIB/primdec.lib

    r4083fa rca3864  
    11971197        for(@n=1;@n<=size(lres0) div 2;@n++)
    11981198        {
    1199           if(specialIdealsEqual(lres0[2*@n-1],lres0[2*@n])==1)
    1200           {
    1201             lres0[2*@n-1]=groebner(lres0[2*@n-1]);
    1202             lres0[2*@n]=lres0[2*@n-1];
    1203             attrib(lres0[2*@n],"isSB",1);
    1204           }
    1205           else
    1206           {
    1207             lres0[2*@n-1]=groebner(lres0[2*@n-1]);
    1208             lres0[2*@n]=groebner(lres0[2*@n]);
    1209           }
     1199          lres0[2*@n-1]=groebner(lres0[2*@n-1]);
     1200          lres0[2*@n]=groebner(lres0[2*@n]);
    12101201        }
    12111202      }
     
    18891880    rl[1]=list(p,
    18901881            list(rl2[nnp+1..nvars(basering)]),
    1891             list(list("lp",1:(nvars(basering)-nnp))),
    1892             ideal(0));
     1882            list(list("lp",1:(nvars(basering)-nnp))),
     1883            ideal(0));
    18931884    rl[2]=list(rl2[1..nnp]);
    18941885    rl[3]=list(list(order,1:nnp),list("C",0));
     
    18971888  {
    18981889    if (typeof(rl[1])=="list")
    1899     list rl1=rl[1];
    1900     list rl2=rl[2];
    1901     rl1[1]=list(rl1[1][1],
    1902             rl[1][2]+list(rl2[nnp+1..nvars(basering)]),
    1903             list(list("lp",1:(size(rl[1][2])+nvars(basering)-nnp))),
    1904             ideal(0));
    1905     rl[1]=rl1;
    1906     rl[2]=list(rl2[1..nnp]);
    1907     rl[3]=list(list(order,1:nnp),list("C",0));
    1908   }
     1890    {
     1891        list rl1=rl[1];
     1892        list rl2=rl[2];
     1893        rl1=list(rl1[1][1],
     1894                rl[1][2]+list(rl2[nnp+1..nvars(basering)]),
     1895                list(list("lp",1:(size(rl[1][2])+nvars(basering)-nnp))),
     1896                ideal(0));
     1897        rl[1]=rl1;
     1898        rl[2]=list(rl2[1..nnp]);
     1899        rl[3]=list(list(order,1:nnp),list("C",0));
     1900    }
     1901    else
     1902    {
     1903        ERROR("Unexpected case in prepareQuotientring. Please inform the authors");
     1904    }
     1905  }
     1906
    19091907  def quotring=ring(rl);
    19101908  return(quotring);
     
    19531951   i=qr[1];
    19541952
    1955    execute ("ring gnir = ("+charstr(basering)+"),("+varstr(basering)+"),("
    1956              +ordstr(basering)+");");
    1957 
     1953   def gnir=ring(ringlist(@P));
     1954   setring gnir;
    19581955
    19591956   ideal i=fetch(@P,i);
     
    24252422                                &&(find(ordstr(basering),"s")==0))
    24262423  {
    2427      execute("ring gnir = ("+charstr(basering)+"),("+varstr(basering)+"),("
    2428                               +ordstr(basering)+");");
     2424     def gnir=ring(ringlist(basering));
     2425     setring gnir;
    24292426     ideal i=imap(P,i);
    24302427     ideal j=i;
     
    25302527                                &&(find(ordstr(basering),"s")==0))
    25312528  {
    2532      execute("ring gnir = ("+charstr(basering)+"),("+varstr(basering)+"),("
    2533                               +ordstr(basering)+");");
     2529     def gnir=ring(ringlist(basering));
     2530     setring gnir;
    25342531     ideal i=imap(P,i);
    25352532     ideal j=i;
     
    26442641   ASSUME(0, not isQuotientRing(basering) ) ;
    26452642   ASSUME(0, hasGlobalOrdering(basering) ) ;
     2643
     2644// the really needed things:
     2645   ASSUME(1, typeof(ringlist(basering)[1])=="list"); // in alg. extension
    26462646
    26472647//reduces primery decomposition over algebraic extensions to
     
    26882688   }
    26892689//---Ende Provisorium
    2690    string mp="poly @p="+string(minpoly)+";";
    2691    string gnir="ring RH="+string(char(R))+",("+varstr(R)+","+string(par(1))
    2692                 +"),dp;";
    2693    execute(gnir);
    2694    execute(mp);
     2690   list R_l=ringlist(R);
     2691   ideal @p=R_l[1][4]; // minpoly
     2692   R_l[2]=R_l[2]+R_l[1][2]; // vars
     2693   R_l[1]=R_l[1][1];  // char
     2694   R_l[3]=list(list("dp",1:size(R_l[2])),list("C",0)); // ord
     2695   def RH=ring(R_l); kill R_l;setring RH;
     2696   ideal @pp=imap(R,@p); poly @p=@pp[1];
    26952697   ideal i=imap(R,i);
    26962698   ideal I=subst(i,var(nvars(basering)),0);
     
    27042706     setring R;
    27052707     kill RH;
    2706      kill gnir;
    2707      string gnir="ring RH="+string(char(R))+",("+varstr(R)+"),dp;";
    2708      execute(gnir);
     2708     // remove extension, set order to dp:
     2709     list R_l=ringlist(R);
     2710     R_l[1]=R_l[1][1]; // char
     2711     R_l[3]=list(list("dp",1:nvars(R)),list("C",0)); // ord
     2712     def RH=ring(R_l); kill R_l; setring RH;
    27092713     ideal i=imap(R,i);
    27102714     ideal J;
     
    27322736   if(n<nvars(basering))
    27332737   {
    2734       gnir="ring RS="+string(char(R))+",("+varstr(RH)
    2735                 +"),(dp("+string(n)+"),lp);";
    2736       execute(gnir);
     2738      // remove extension, set order to dp(n),lp:
     2739      list R_l=ringlist(basering);
     2740      if (typeof(R_l[1])=="list") { R_l[1]=R_l[1][1]; }
     2741      R_l[3]=list(list("dp",1:n),list("lp",1:(nvars(basering)-n)),list("C",0));
     2742      def RS=ring(R_l); kill R_l; setring RS;
    27372743      list pr=imap(RH,pr);
    27382744      ideal K;
     
    31363142  if(ordstr(@P)[1]=="w")
    31373143  {
    3138     execute("ring @Phelp=("+charstr(gnir)+"),("+varstr(gnir)+"),("+ordstr(@P)+");");
     3144    list gnir_l=ringlist(gnir);
     3145    list @P_l=ringlist(@P);
     3146    gnir_l[3]=@P_l[3]; // ord
     3147    def @Phelp=ring(gnir_l);
     3148    setring @Phelp;
     3149    kill gnir_l,@P_l;
    31393150  }
    31403151  else
     
    31773188    //change the ring
    31783189    {
    3179       execute("ring gnir1 = ("+charstr(basering)+"),("+varstr(basering)+"),("
    3180                               +ordstr(basering)+");");
     3190      def gnir1=ring(ringlist(basering));
     3191      setring gnir1;
    31813192      ideal @j=fetch(gnir,@j);
    31823193      attrib(@j,"isSB",1);
     
    34923503           //change the ring
    34933504        {
    3494           execute("ring gnir1 = ("+charstr(basering)+"),("+
    3495                varstr(basering)+"),("+ordstr(basering)+");");
     3505          def gnir1=ring(ringlist(basering));
     3506          setring gnir1;
    34963507          ideal @j=fetch(gnir,jkeep);
    34973508          attrib(@j,"isSB",1);
     
    38513862
    38523863///////////////////////////////////////////////////////////////////////////////
    3853  proc zeroRad(ideal I,list #)
     3864proc zeroRad(ideal I,list #)
    38543865"USAGE:  zeroRad(I) , I a zero-dimensional ideal
    3855  RETURN: the radical of I
    3856  NOTE:  Algorithm of Kemper
    3857  EXAMPLE: example zeroRad; shows an example
     3866RETURN: the radical of I
     3867NOTE:  Algorithm of Kemper
     3868EXAMPLE: example zeroRad; shows an example"
    38583869{
    38593870   ASSUME(0, hasFieldCoefficient(basering) );
     
    38913902   for(i=1;i<=n;i++)
    38923903   {
    3893       l[i]=sep(F[i],i);
    3894       F[i]=l[i][1];
    3895       if(l[i][2]>k){k=l[i][2];}  //computation of the maximal k
     3904     l[i]=sep(F[i],i);
     3905     F[i]=l[i][1];
     3906     if(l[i][2]>k){k=l[i][2];}  //computation of the maximal k
    38963907   }
    38973908
    38983909   if((k==0)||(m==0)) //the separable case
    38993910   {
    3900     intvec save=option(get);option(redSB);
    3901     I=interred(I+F);option(set,save);return(I);
     3911     intvec save=option(get);
     3912     option(redSB);
     3913     I=interred(I+F);
     3914     option(set,save);
     3915     return(I);
    39023916   }
    39033917   //I=simplify(I,1);
     
    39123926   ideal F=imap(R,F);
    39133927
    3914    string nR1="ring @S1="+string(p)+",("+varstr(R)+","+parstr(R)+",@y(1..m)),dp;";
    3915    execute(nR1);
    3916    list lR=ringlist(@S1)[2];
    3917    lR=lR[(size(lR)-m+1)..(size(lR))];
    3918 
    3919    string nR="ring @S="+string(p)+",("+string(lR)+","+varstr(R)+","+parstr(R)+"),dp;";
     3928   string nR="ring @S="+string(p)+",(@y(1..m),"+varstr(R)+","+parstr(R)+"),dp;";
    39203929   execute(nR);
    39213930
     
    39283937   for(i=1;i<=m;i++)
    39293938   {
    3930       J=J,var(i)^k-var(m+n+i);
    3931       el=el*var(i);
     3939     J=J,var(i)^k-var(m+n+i);
     3940     el=el*var(i);
    39323941   }
    39333942
     
    41174126
    41184127  if(n < 0)
    4119     {
    4120       ideal ann = ideal(1);
    4121       return(ann);
    4122     }
     4128  {
     4129    return(ideal(1));
     4130  }
    41234131  int l = size(re);
    41244132
    41254133  if(n < l)
    4126     {
    4127       matrix f = transpose(re[n+1]);
    4128       if(n == 0)
    4129         {
    4130           matrix g = 0*gen(ncols(f));
    4131         }
    4132       else
    4133         {
    4134           matrix g = transpose(re[n]);
    4135         }
    4136       module k = syz(f);
    4137       ideal ann = quotient1(g,k);
    4138       return(ann);
    4139     }
     4134  {
     4135    matrix f = transpose(re[n+1]);
     4136    if(n == 0)
     4137    {
     4138      matrix g = matrix(0,1,ncols(f));
     4139    }
     4140    else
     4141    {
     4142      matrix g = transpose(re[n]);
     4143    }
     4144    module k = syz(f);
     4145    return(quotient1(g,k));
     4146  }
    41404147
    41414148  if(n == l)
    4142     {
    4143       ideal ann = Ann(transpose(re[n]));
    4144       return(ann);
    4145     }
    4146 
    4147   ideal ann = ideal(1);
    4148   return(ann);
     4149  {
     4150    return(Ann(transpose(re[n])));
     4151  }
     4152
     4153  return(ideal(1));
    41494154}
    41504155///////////////////////////////////////////////////////////////////////////////
     
    62786283    //change the ring
    62796284    {
    6280       execute("ring gnir1 = ("+charstr(basering)+"),("+varstr(basering)+"),("
    6281                               +ordstr(basering)+");");
     6285      def gnir1=ring(ringlist(basering));
     6286      setring gnir1;
    62826287      ideal @j = fetch(@P, I);
    62836288      attrib(@j, "isSB", 1);
     
    68246829  matrix n=imap(R,n);
    68256830  time = timer;
    6826   poly charpol=det(n-T*freemodule(d));
     6831  poly charpol=det(n-var(1)*freemodule(d));
    68276832  dbprint(printlevel-voice+2,"// time for computing char poly: "+
    68286833         string(timer-time));
     
    68566861    option(redSB);
    68576862    list re1;
    6858     ideal new = T-imap(R,p),imap(R,J);
     6863    ideal new = var(1)-imap(R,p),imap(R,J);
    68596864    attrib(new, "isSB",1);    //we know that new is a standard basis
    68606865    for(j=1;j<=f;j++)
     
    70407045
    70417046  op@P = option(get);
    7042   execute("ring gnir = ("+charstr(basering)+"),("+varstr(basering)+"),(C,lp);");
     7047  def gnir=changeordTo(basering,"lp");
     7048  setring gnir;
    70437049
    70447050  op=option(get);
     
    71427148      if (intersectOption == "intersect")
    71437149      {
    7144        list pr = result[1];
    7145        ideal intersection = result[2];
     7150        list pr = result[1];
     7151        ideal intersection = result[2];
    71467152      }
    71477153      else
     
    73387344  if(ordstr(@P)[1]=="w")
    73397345  {
    7340     execute("ring @Phelp=("+charstr(gnir)+"),("+varstr(gnir)+"),("+ordstr(@P)+");");
     7346    def @Phelp=ring(ringlist(gnir));
     7347    setring @Phelp;
    73417348  }
    73427349  else
    73437350  {
    7344     execute( "ring @Phelp=("+charstr(gnir)+"),("+varstr(gnir)+"),(C,dp);");
     7351    def @Phelp=changeordTo(gnir,"dp");
     7352    setring @Phelp;
    73457353  }
    73467354
     
    75177525           //change the ring
    75187526           {
    7519               execute("ring gnir1 = ("+charstr(basering)+"),("+
    7520                 varstr(basering)+"),("+ordstr(basering)+");");
     7527              def gnir1=ring(ringlist(basering));
     7528              setring gnir1;
    75217529              ideal @j=fetch(gnir,jkeep);
    75227530              attrib(@j,"isSB",1);
     
    78567864   //change the ring
    78577865   {
    7858      execute("ring gnir1 = ("+charstr(basering)+"),("+varstr(basering)+"),("
    7859                               +ordstr(basering)+");");
     7866     def gnir1=ring(ringlist(basering));
     7867     setring gnir1;
    78607868     ideal @j = fetch(gnir, @j);
    78617869     attrib(@j,"isSB",1);
  • Singular/LIB/ring.lib

    r4083fa rca3864  
    3333 isQuotientRing(rng)      ring is a qotient ring
    3434 isSubModule(I,J)         check if I is in J as submodule
     35
     36 changeordTo(r,o)         change the ordering of a ring to a simple one
     37 addvarsTo(r,vars,i)      add variables to a ring
     38 addNvarsTo(r,N,name,i)   add N variables to a ring
    3539";
    3640
     
    11131117
    11141118proc changeordTo(def r,string o)
     1119"USAGE:  changeordTo(ring, string s);
     1120RETURN:  a ring with the oderinging changed to the (simple) ordering s
     1121EXAMPLE: example changeordTo(); shows an example
     1122"
    11151123{
    11161124  list rl=ringlist(r);
     
    11211129example
    11221130{
     1131  "EXAMPLE:"; echo = 2;
    11231132  ring r=0,(x,y),lp;
    1124   def rr=changeordToCdp(r,"dp");
     1133  def rr=changeordTo(r,"dp");
    11251134  rr;
    11261135}
    11271136
     1137proc addvarsTo(def r,list vars,int blockorder)
     1138"USAGE:  addvarsTo(ring,list_of_strings, int);
     1139         int may be: 0:ordering: dp
     1140                     1:ordering dp,dp
     1141                     2:oring.ordering,dp
     1142RETURN:  a ring with the addtional variables
     1143EXAMPLE: example addvarsTo(); shows an example
     1144"
     1145{
     1146  list rl=ringlist(r);
     1147  int n=nvars(r);
     1148  rl[2]=rl[2]+vars;
     1149  if (blockorder==0)
     1150  {
     1151    rl[3]=list(list("C",0),list("dp",1:(nvars(r)+size(vars))));
     1152  }
     1153  else
     1154  {
     1155    if (blockorder==2)
     1156    {
     1157      rl[3]=rl[3]+list(list("dp",1:size(vars)));
     1158    }
     1159    else
     1160    {
     1161      rl[3]=list(list("C",0),list("dp",1:nvars(r)),list("dp",1:size(vars)));
     1162    }
     1163  }
     1164  def rr=ring(rl);
     1165  return(rr);
     1166}
     1167example
     1168{
     1169  "EXAMPLE:"; echo = 2;
     1170  ring r=0,(x,y),lp;
     1171  def rr=addvarsTo(r,list("a","b"),0);
     1172  rr; kill rr;
     1173  def rr=addvarsTo(r,list("a","b"),1);
     1174  rr; kill rr;
     1175  def rr=addvarsTo(r,list("a","b"),2);
     1176  rr;
     1177}
     1178proc addNvarsTo(def r,int N,string n,int blockorder)
     1179"USAGE:  addNvarsTo(ring,int N, string name, int b);
     1180         b may be: 0:ordering: dp
     1181                   1:ordering dp,dp
     1182                   2:oring.ordering,dp
     1183RETURN:  a ring with N addtional variables
     1184EXAMPLE: example addNvarsTo(); shows an example
     1185"
     1186{
     1187  list v;
     1188  for(int i=N;i>0;i--) { v[i]=n+"("+string(i)+")"; }
     1189  return(addvarsTo(r,v,blockorder));
     1190}
     1191example
     1192{
     1193  "EXAMPLE:"; echo = 2;
     1194  ring r=0,(x,y),lp;
     1195  def rr=addNvarsTo(r,2,"@",0);
     1196  rr; kill rr;
     1197  def rr=addNvarsTo(r,2,"@",1);
     1198  rr; kill rr;
     1199  def rr=addNvarsTo(r,2,"@",2);
     1200  rr;
     1201}
  • Singular/LIB/rinvar.lib

    r4083fa rca3864  
    3434LIB "elim.lib";
    3535LIB "zeroset.lib";
     36LIB "ring.lib";
    3637
    3738///////////////////////////////////////////////////////////////////////////////
     
    286287  int i, dbPrt, nrNewVars;
    287288  intvec wt, wth, hs1;
    288   string ringSTR1, ringSTR2, order;
    289 
    290289  def RARB = basering;
    291   nrNewVars = size(F);
     290  nrNewVars = ncols(F);
    292291
    293292  dbPrt = printlevel-voice+2;
     
    299298
    300299  string @mPoly = string(minpoly);
    301   order = "(dp(" + string(nvars(basering)) + "), dp);";
    302   ringSTR1 = "ring RAR1 = (" + charstr(basering) + "), (" + varstr(basering) + ", Y(1.." + string(nrNewVars) + ")), " + order;
    303   ringSTR2 = "ring RAR2 = (" + charstr(basering) + "), Y(1.." + string(nrNewVars) + "), dp;";
    304   execute(ringSTR1);
    305   execute("minpoly = number(" + @mPoly + ");");
     300  def RAR1=addNvarsTo(basering,nrNewVars,"Y",1); setring RAR1;
     301  string ringSTR2 = "ring RAR2 = (" + charstr(basering) + "), Y(1.." + string(nrNewVars) + "), dp;";
    306302
    307303  ideal I, J1, J2, Fm;
  • Singular/LIB/rwalk.lib

    • Property mode changed from 100644 to 100755
    r4e3305 rca3864  
    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/sagbi.lib

    r4083fa rca3864  
    3131LIB "toric.lib";
    3232LIB "algebra.lib";
     33LIB "ring.lib";
    3334//////////////////////////////////////////////////////////////////////////////
    3435
     
    11111112
    11121113    //------------- change the basering bsr to bsr[@(0),...,@(z)] ----------
    1113     execute("ring s=("+charstr(basering)+"),("+varstr(basering)+",@(0..z)),dp;");
     1114    def s=addNvarsTo(basering,z+1,,"@",0); setring s;
    11141115    // Ev hier die Reihenfolge der Vars aendern. Dazu muss unten aber entsprechend
    11151116    // geaendert werden:
  • Singular/LIB/schreyer.lib

    r4083fa rca3864  
    600600  }
    601601
    602   int @IS_A_SB = attrib(M, "isSB"); // ??? only if all weights were zero?!
    603 
    604   if( !@IS_A_SB )
    605   {
    606     def opts = option(get);
    607     option(redSB); option(redTail);
    608     M = std(M);
    609     option(set, opts);
    610     kill opts;
    611   }
    612 
    613   M = simplify(M, 1 + 2 + 4 + 32);
     602  def opts = option(get);
     603  option(redSB); option(redTail);
     604    M = simplify(interred(groebner(M)), 1 + 2 + 4 + 32); // NOTE: we require interreduced GB for input
     605  option(set, opts); kill opts;
     606 
     607//  int @IS_A_SB = attrib(M, "isSB");  if( !@IS_A_SB )  {  } else  {  }
     608// attrib(M, "isSB", 1);
    614609
    615610  if( @IGNORETAILS )
     
    786781    attrib(S, "HYBRIDNF", 0);
    787782  }
     783
     784  if( typeof( attrib(SSinit, "NOCACHING") ) == "int" )
     785  {
     786    attrib(S, "NOCACHING", attrib(SSinit, "NOCACHING") );
     787  } else
     788  {
     789    attrib(S, "NOCACHING", 0);
     790  }
     791 
    788792
    789793  // maybe resetting existing ring attributes!
     
    27482752  if(size(#) > 0) { DEBUG = #[1]; }
    27492753
     2754  def TREE = 0;
     2755  if(size(#) > 1) { TREE = #[2]; }
     2756
    27502757  system("--min-time", "0.01");
    27512758  system("--ticks-per-sec", 100);
     
    27582765  attrib(SSinit, "KERCHECK", (DEBUG > 0) );
    27592766
    2760   attrib(SSinit, "TREEOUTPUT", 0);
     2767  attrib(SSinit, "TREEOUTPUT", TREE);
    27612768  attrib(SSinit, "PROFILE", 0);
    27622769  attrib(SSinit, "IGNORETAILS", 0); // not only frame
     2770 
     2771  attrib(SSinit, "NOCACHING", 0);
    27632772
    27642773  int @treeout = attrib(SSinit, "TREEOUTPUT");
     
    28072816  M = a*b+7*a*c-16*b*c-27*a*d+37*b*d-2*c*d, d^3, c*d^2, b*d^2, a*d^2, c^2*d, b*c*d, a*c*d, b^2*d, a^2*d, c^3, b*c^2, a*c^2, b^2*c, a^2*c, b^3, a^3;
    28082817  TestSSresAttribs(M, "medium: AGR@101n3d004s009%1");
     2818
     2819  kill AGR;
     2820
     2821
     2822  string Name = "bordiga"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp;
     2823  ideal I = -x2y+26/17xy2+70/17y3+96/121x2z+63/82xyz+115/11y2z-8114xz2-40/79yz2+16/125z3+3023x2u-123/70xyu+3395y2u-81/119xzu-23/66yzu+3626z2u+18/53xu2+111/58yu2-34/39zu2+53/40u3-94/17x2v-10/19xyv+81/88y2v-91/33xzv-9967yzv-103/4z2v-26/109xuv+69/97yuv+92/17zuv-19/96u2v+10/21xv2+6147yv2+32/113zv2-79/82uv2-77/51v3,4347x2y-9017xy2+11327y3+18/79x2z-93/43xyz-35/47y2z+14704xz2+10727yz2-1764z3-612x2u+20/107xyu-103/89y2u-39/2xzu+2345yzu+10251z2u-9984xu2-10299yu2+113/118zu2+37/91u3+2/31x2v+9552xyv-47/100y2v-3242xzv+113/27yzv-11271z2v-13/79xuv+15917yuv+5/114zuv+103/119u2v-21/55xv2-59/19yv2+101/68zv2-7817uv2-112/29v3,7228x2y-111/113xy2+5913y3+6/43x2z-11251xyz+27/121y2z+97/96xz2-7398yz2-97/114z3+38/15x2u+5005xyu-41/126y2u-61/116xzu+89/9yzu-4087z2u+26/15xu2-92/103yu2+21/68zu2-4027u3+97/91x2v+5150xyv-4/47y2v-2310xzv+7307yzv-77/86z2v+30/83xuv+413yuv-50zuv-103/106u2v+105/73xv2-109/98yv2+59/63zv2+715uv2+963v3,x3+3487x2y-9744xy2-13276y3-15213x2z-118/51xyz+101/104y2z+2754xz2+9111yz2-17/94z3+11136x2u-43/82xyu-9/41y2u-7306xzu-6839yzu+5692z2u-14682xu2+37/80yu2-85/97zu2-6186u3+34/15x2v+84/109xyv+5086y2v+27/112xzv-3/40yzv+19/120z2v+11222xuv+38/55yuv-24/83zuv+15814u2v-111/61xv2+49/44yv2+125/81zv2+1933uv2-19/71v3;
     2824  TestSSresAttribs(I, Name);
     2825  kill @p, Name, R; 
     2826
     2827  string Name = "rat.d8.g6"; int @p=31991; ring R = (@p),(x,y,z,u,v), dp;
     2828  ideal I = -19/125x2y2-87/119xy3-97/21y4+36/53x2yz+2069xy2z-59/50y3z-65/33x2z2-14322xyz2+79/60y2z2-9035xz3-14890yz3+87/47z4-23/48x2yu+45/44xy2u+1972y3u+79/118x2zu-5173xyzu+115/121y2zu+1239xz2u-115/17yz2u-15900z3u-78/95x2u2+67/101xyu2-12757y2u2+12752xzu2+68/21yzu2+103/90z2u2-12917xu3+97/92yu3-24/49zu3-13/79u4-51/61x2yv-3103xy2v+77/117y3v+73/115x2zv-79/33xyzv+123/110y2zv+11969xz2v-31/95yz2v-123/95z3v-105/124x2uv+12624xyuv+2/63y2uv+6579xzuv+13/62yzuv+4388z2uv-12747xu2v-26/105yu2v-78/61zu2v-125/53u3v-5/71xyv2+62/77y2v2+21/44xzv2-9806yzv2+3/91z2v2+361xuv2+568yuv2+2926zuv2+53/38u2v2-14523yv3+2082zv3+113/115uv3,108/73x2y2+4028xy3+38/43y4-1944x2yz+39/80xy2z+8/109y3z+52/27x2z2+103/45xyz2+5834y2z2+63/101xz3+107/80yz3+1178z4-1/6x2yu+78/25xy2u-21/43y3u+50/71x2zu-14693xyzu+15074y2zu+9/103xz2u-7396yz2u-14493z3u+93/25x2u2+61/4xyu2-11306y2u2-79/81xzu2+59/82yzu2-5/106z2u2+89/71xu3-34/11yu3+15/103zu3-115/52u4-54/65x2yv+67/16xy2v-7/68y3v-10/13x2zv+32/85xyzv+1/91y2zv+107/118xz2v+7594yz2v-98/103z3v+9919x2uv-965xyuv+53/34y2uv+119/11xzuv-3400yzuv-8329z2uv+75/98xu2v-24yu2v+55/87zu2v-82/71u3v-73/115x2v2+85/19xyv2-213y2v2-7704xzv2-15347yzv2+14960z2v2+15065xuv2-125/17yuv2+32/83zuv2-14/73u2v2-21/44xv3+79/2yv3-61/32zv3+46/119uv3-2082v4,9/20x2y2+113/71xy3-88/65y4+9983x2yz-6722xy2z+87/68y3z+1893x2z2+65/32xyz2+51/55y2z2-102/53xz3+58/5yz3-7187z4-96/7x2yu-14/87xy2u-3532y3u+95/54x2zu+19/65xyzu-6728y2zu+31/121xz2u+73/106yz2u-91/5z3u-12928x2u2+707xyu2-55/48y2u2-96/25xzu2+15869yzu2-20/107z2u2-10030xu3-13786yu3-122/9zu3+19/59u4-7/52x2yv+101/74xy2v+83/6y3v-91/55x2zv-5266xyzv+85/61y2zv+126/95xz2v+56/51yz2v+13073z3v-50/21x2uv-13553xyuv-116/53y2uv+68/71xzuv-111/98yzuv-11037z2uv+68/121xu2v-124/53yu2v+54/55zu2v+5862u3v+12318x2v2-119/29xyv2+101/17y2v2-51/40xzv2-82/33yzv2-30/41z2v2-29/52xuv2+7817yuv2+8121zuv2-28/99u2v2+1125xv3-73/55yv3-14141zv3+8742uv3-1203v4,x2y2+11357xy3+295y4+144x2yz-31/54xy2z+89/119y3z+1/46x2z2+29/26xyz2+1384y2z2+1461xz3+113/91yz3+9494z4-7/32x2yu+12850xy2u-3626y3u-33/106x2zu-7/60xyzu-5935y2zu-8597xz2u+5527yz2u+1708z3u+6182x2u2-15780xyu2+4669y2u2-38/69xzu2+8412yzu2+9265z2u2-5679xu3-67/18yu3-34/67zu3-7178u4+113/56x2yv-3669xy2v+17/113y3v-87/35x2zv-4871xyzv-111/11y2zv-1131xz2v-72/13yz2v+838z3v-115/4x2uv+3395xyuv-43/68y2uv-82/13xzuv+7042yzuv-88/119z2uv+100/19xu2v+24/11yu2v+89/3zu2v+7395u3v-119/109x2v2+1/104xyv2+18/25y2v2+700xzv2-59/9yzv2-92/87z2v2+2486xuv2-67/103yuv2+1469zuv2-101/91u2v2-79/33xv3+10838yv3+81/4zv3-11843uv3+7204v4,19/125x3-15698x2y-22/117xy2-95/107y3+2027x2z-7750xyz+85/104y2z-15326xz2+31/101yz2+67/81z3-7879x2u-112/115xyu+124/81y2u+99/61xzu-7458yzu+40/33z2u-1502xu2+6591yu2-7/73zu2-42/95u3+93/83x2v-15/112xyv-84/95y2v+35/36xzv+5/24yzv-12768z2v+13232xuv-76/103yuv-79/52zuv-7217u2v+75/92xv2-49/64yv2+17/14zv2-6109uv2+1695v3;
     2829  TestSSresAttribs(I, Name);
     2830  kill R, Name, @p;
     2831
    28092832
    28102833  if( @treeout)
  • Singular/LIB/solve.lib

    r4083fa rca3864  
    2323
    2424LIB "triang.lib";    // needed for triang_solve
     25LIB "ring.lib";      // needed for changeordTo
    2526
    2627///////////////////////////////////////////////////////////////////////////////
     
    692693    if (sb==0)
    693694    {
    694       execute("ring dphom=("+charstr(rin)+"),("+
    695       varstr(rin)+"),dp;");
     695      def dphom=changeordTo(rin,"dp"); setring dphom;
    696696      ideal G = std(imap(rin,G));
    697697      if (dim(G)!=0){ERROR("ideal not zero-dimensional");}
     
    736736    if (sb==0)
    737737    {
    738       execute("ring dphilb=("+charstr(rin)+"),("+ varstr(rin)+"),dp;");
     738      def dphilb=changeordTo(rin,"dp"); setring dphilb;
    739739      ideal G = imap(rin,G);
    740740      G = std(G);
     
    747747      attrib(G,"isSB",1);
    748748    }
    749     execute("ring lexhilb=("+charstr(rin)+"),("+ varstr(rin)+"),lp;");
     749    def lexhilb=changeordTo(rin,"lp"); setring lexhilb;
    750750    option(redTail);
    751751    ideal H = fglm(dphilb,G);
     
    755755    else
    756756    {
    757       execute("ring lplex=("+charstr(rin)+"),("+varstr(rin)+"),lp;");
     757      def lplex=changeordTo(rin,"lp"); setring lplex;
    758758    }
    759759    ideal H = imap(lexhilb,H);
  • Singular/LIB/swalk.lib

    • Property mode changed from 100644 to 100755
  • Singular/LIB/tropical.lib

    r4083fa rca3864  
    208208LIB "absfact.lib";
    209209LIB "hnoether.lib";
     210LIB "ring.lib";
    210211//////////////////////////////////////////////////////////////////////////////
    211212
     
    10191020  {
    10201021    def GLOBALRING=basering;
    1021     number mp=minpoly;
    1022     execute("ring LOCALRING=("+charstr(basering)+"),("+varstr(basering)+"),ds;");
     1022    def LOCALRING=changeordTo(GLOBALRING,"ds");
     1023    setring LOCALRING;
    10231024    poly f=imap(GLOBALRING,f);
    1024     minpoly=imap(GLOBALRING,mp);
    10251025  }
    10261026  // check if a substitution is necessary
     
    71547154NOTE:        the procedure is called by texDrawTropical"
    71557155{
    7156   execute("ring REALRING=(real,50,100),x,lp;");
     7156  ring REALRING=(real,50,100),x,lp;
    71577157  execute("number aa,bb,cc="+AA[1]+","+AA[2]+","+AA[3]+";");
    71587158  number ascale,bscale=1,1;
     
    71877187NOTE:        the procedure is called by texDrawTropical"
    71887188{
    7189   execute("ring REALRING=(real,50,100),x,lp;");
     7189  ring REALRING=(real,50,100),x,lp;
    71907190  execute("poly aa,bb="+a+","+b+";");
    71917191  if (aa<bb)
  • Singular/dyn_modules/Order/nforder_elt.cc

    r4083fa rca3864  
    143143}
    144144   /// convertion to int, 0 if impossible
    145 static int EltInt(number &n, const coeffs r)
     145static long EltInt(number &n, const coeffs r)
    146146
    147147{
  • Singular/dyn_modules/syzextra/mod_main.cc

    r4083fa rca3864  
    315315    const ring save = currRing;
    316316    const ring r = syzstr->syRing;
    317     const ring rr = (r != NULL) ? r: save;
     317//    const ring rr = (r != NULL) ? r: save;
    318318
    319319
  • Singular/dyn_modules/syzextra/syzextra.cc

    r4083fa rca3864  
    17931793  if( UNLIKELY( !(  (!OPT__TAILREDSYZ)   ||   m_lcm.Check(multiplier)     )) )
    17941794  {
    1795     if( UNLIKELY(OPT__TAILREDSYZ && OPT__PROT) ) ++ m_stat[5]; // PrintS("%"); // check LCM !
    1796 
     1795    if( UNLIKELY(OPT__TAILREDSYZ && OPT__PROT) )
     1796    {
     1797      ++ m_stat[5]; // PrintS("%"); // check LCM !
     1798#ifndef SING_NDEBUG
     1799      if( OPT__DEBUG ) 
     1800      {
     1801        PrintS("\nTT,%:"); dPrint(multiplier, r, r, 0);
     1802        PrintS(",  *  :"); dPrint(tail, r, r, 0);
     1803        PrintLn();
     1804      }
     1805#endif
     1806    }
    17971807    return NULL;
    17981808  }
     
    19561966  if( s == NULL ) // No Reducer?
    19571967  {
    1958     if( UNLIKELY(OPT__TAILREDSYZ && OPT__PROT) ) ++ m_stat[5]; // PrintS("%"); // check LCM !
     1968    if( UNLIKELY( OPT__TAILREDSYZ && OPT__PROT) )
     1969    {
     1970      ++ m_stat[5]; // PrintS("%"); // check LCM !
     1971#ifndef SING_NDEBUG
     1972      if( OPT__DEBUG ) 
     1973      {
     1974        PrintS("\n%: RedTail("); dPrint(multiplier, r, r, 0); 
     1975        PrintS(" * : "); dPrint(term4reduction, r,r,0 );
     1976        PrintS(", {  "); dPrint(syztermCheck,r,r,0 );
     1977        PrintS("  }) ");  PrintLn();
     1978      }
     1979#endif
     1980    }
    19591981    return NULL;
    19601982  }
     
    20162038    OPT__TREEOUTPUT( atGetInt(rootRingHdl, "TREEOUTPUT", 0) ),
    20172039    OPT__SYZCHECK( atGetInt(rootRingHdl, "SYZCHECK", 0) ),
     2040    OPT__PROT(TEST_OPT_PROT),
    20182041    OPT__NOCACHING( atGetInt(rootRingHdl, "NOCACHING", 0) ),
    2019     OPT__PROT(TEST_OPT_PROT),
    20202042    m_rBaseRing( rootRingHdl->data.uring )
    20212043{
  • Singular/dyn_modules/syzextra/test.sh

    r4083fa rca3864  
    44#"$SINGULAR_EXECUTABLE" -teq "$srcdir/ederc.tst" || exit 1
    55#"$SINGULAR_EXECUTABLE" -teq "$srcdir/syzextra.tst" || exit 1
    6 "$SINGULAR_EXECUTABLE" -tec 'LIB "schreyer.lib"; listvar(Top); proc T(){ Schreyer::testSimple(1); /* Schreyer::testAGR(0); Schreyer::testAGRhard(0); */ } T(); $' || exit 1
     6"$SINGULAR_EXECUTABLE" -tec 'LIB "schreyer.lib"; listvar(Top); proc T(){ Schreyer::testSimple(1, 0); /* Schreyer::testAGR(0); Schreyer::testAGRhard(0); */ } T(); $' || exit 1
  • Singular/emacs.cc

    r4083fa rca3864  
    99
    1010
     11#include <kernel/mod2.h>
     12#include <omalloc/omalloc.h>
     13#include <resources/feResource.h>
     14#include <Singular/feOpt.h>
     15
    1116#ifdef __CYGWIN__
    1217#define BOOLEAN boolean
    1318#endif
    14 #include <kernel/mod2.h>
    15 
    1619
    1720#include <stdio.h>
     
    3033#endif
    3134
    32 #include <omalloc/omalloc.h>
    33 #include <resources/feResource.h>
    34 #include <Singular/feOpt.h>
    3535
    3636#if !defined(TSINGULAR) && !defined(ESINGULAR)
     
    6363}
    6464#else
    65 void error(char* fmt, ...)
     65void error(const char* fmt, ...)
    6666{
    6767   char buf[4096];
  • Singular/extra.cc

    r4083fa rca3864  
    712712      {
    713713        WerrorS("field required");
    714         return TRUE;
     714        return TRUE;
    715715      }
    716716      matrix pMat  = (matrix)h->Data();
     
    37363736    else
    37373737  #endif
     3738/*==================== test64 =================*/
     3739  #if 0
     3740    if(strcmp(sys_cmd,"test64")==0)
     3741    {
     3742      long l=8;int i;
     3743      for(i=1;i<62;i++)
     3744      {
     3745        l=l<<1;
     3746        number n=n_Init(l,coeffs_BIGINT);
     3747        Print("%ld= ",l);n_Print(n,coeffs_BIGINT);
     3748        CanonicalForm nn=n_convSingNFactoryN(n,TRUE,coeffs_BIGINT);
     3749        n_Delete(&n,coeffs_BIGINT);
     3750        n=n_convFactoryNSingN(nn,coeffs_BIGINT);
     3751        PrintS(" F:");
     3752        n_Print(n,coeffs_BIGINT);
     3753        PrintLn();
     3754        n_Delete(&n,coeffs_BIGINT);
     3755      }
     3756      Print("SIZEOF_LONG=%d\n",SIZEOF_LONG);
     3757      return FALSE;
     3758    }
     3759    else
     3760   #endif
    37383761/*==================== Error =================*/
    37393762      Werror( "(extended) system(\"%s\",...) %s", sys_cmd, feNotImplemented );
  • Singular/iparith.cc

    r4083fa rca3864  
    239239
    240240/*=================== simple helpers =================*/
     241static int iin_Int(number &n,coeffs cf)
     242{
     243  long l=n_Int(n,cf);
     244  int i=(int)l;
     245  if ((long)i==l) return l;
     246  return 0;
     247}
    241248poly pHeadProc(poly p)
    242249{
     
    47084715    return TRUE;
    47094716  }
    4710   res->data = (char *)(long)n_Int(pGetCoeff(p),currRing->cf);
     4717  res->data = (char *)(long)iin_Int(pGetCoeff(p),currRing->cf);
    47114718  return FALSE;
    47124719}
     
    54055412{
    54065413  number n=(number)u->CopyD(); // n_Int may call n_Normalize
    5407   res->data=(char *)(long)n_Int(n,currRing->cf);
     5414  res->data=(char *)(long)iin_Int(n,currRing->cf);
    54085415  n_Delete(&n,currRing->cf);
    54095416  return FALSE;
     
    54125419{
    54135420  number n=(number)u->Data();
    5414   res->data=(char *)(long)n_Int(n,coeffs_BIGINT );
     5421  res->data=(char *)(long)iin_Int(n,coeffs_BIGINT );
    54155422  return FALSE;
    54165423}
  • Singular/ipshell.cc

    r4083fa rca3864  
    12191219    //Print("branchTo: %s\n",h->Name());
    12201220    iiCurrProc=(idhdl)h->data;
    1221     err=iiAllStart(IDPROC(iiCurrProc),IDPROC(iiCurrProc)->data.s.body,BT_proc,IDPROC(iiCurrProc)->data.s.body_lineno-(iiCurrArgs==NULL));
     1221    procinfo * pi=IDPROC(iiCurrProc);
     1222    if( pi->data.s.body==NULL )
     1223    {
     1224      iiGetLibProcBuffer(pi);
     1225      if (pi->data.s.body==NULL) return TRUE;
     1226    }
     1227    if ((pi->pack!=NULL)&&(currPack!=pi->pack))
     1228    {
     1229      currPack=pi->pack;
     1230      iiCheckPack(currPack);
     1231      currPackHdl=packFindHdl(currPack);
     1232      //Print("set pack=%s\n",IDID(currPackHdl));
     1233    }
     1234    err=iiAllStart(pi,pi->data.s.body,BT_proc,pi->data.s.body_lineno-(iiCurrArgs==NULL));
    12221235    exitBuffer(BT_proc);
    12231236    if (iiCurrArgs!=NULL)
     
    53185331        //ringtype = 1;       // Use Z/2^ch
    53195332        cf=nInitChar(n_Z2m,(void*)(long)modExponent);
    5320         mpz_clear(modBase);
     5333        mpz_clear(modBase);
    53215334        omFreeSize (modBase, sizeof (mpz_t));
    53225335      }
  • Singular/test.cc

    r4083fa rca3864  
    376376     errorreported = 0; // reset error handling
    377377  else
    378      printf("typeof returned type %d, >>%s<<\n",r1.Typ(),r1.Data());
     378     printf("typeof returned type %d, >>%s<<\n",r1.Typ(),(char*)r1.Data());
    379379
    380380  // clean up r1:
  • Singular/walk.cc

    • Property mode changed from 100644 to 100755
    r4e3305 rca3864  
    429429#endif
    430430
    431 #ifdef CHECK_IDEAL_MWALK
     431//#ifdef CHECK_IDEAL_MWALK
    432432static void idString(ideal L, const char* st)
    433433{
     
    441441  Print(" %s;", pString(L->m[nL-1]));
    442442}
    443 #endif
     443//#endif
    444444
    445445#if defined(CHECK_IDEAL_MWALK) || defined(ENDWALKS)
     
    558558  }
    559559  return p0;
     560}
     561
     562/*****************************************************************************
     563 * compute the gcd of the entries of the vectors curr_weight and diff_weight *
     564 *****************************************************************************/
     565static int simplify_gcd(intvec* curr_weight, intvec* diff_weight)
     566{
     567  int j;
     568  int nRing = currRing->N;
     569  int gcd_tmp = (*curr_weight)[0];
     570  for (j=1; j<nRing; j++)
     571  {
     572    gcd_tmp = gcd(gcd_tmp, (*curr_weight)[j]);
     573    if(gcd_tmp == 1)
     574    {
     575      break;
     576    }
     577  }
     578  if(gcd_tmp != 1)
     579  {
     580    for (j=0; j<nRing; j++)
     581    {
     582    gcd_tmp = gcd(gcd_tmp, (*diff_weight)[j]);
     583    if(gcd_tmp == 1)
     584      {
     585        break;
     586      }
     587    }
     588  }
     589  return gcd_tmp;
    560590}
    561591
     
    953983}
    954984
    955 /*****************************************************************************
    956 * create a weight matrix order as intvec of an extra weight vector (a(iv),lp)*
    957 ******************************************************************************/
     985/*********************************************************************************
     986* create a weight matrix order as intvec of an extra weight vector (a(iv),M(iw)) *
     987**********************************************************************************/
    958988intvec* MivMatrixOrderRefine(intvec* iv, intvec* iw)
    959989{
     990<<<<<<< HEAD
     991  assume((iv->length())*(iv->length()) == iw->length());
     992  int i,j, nR = iv->length();
     993 
     994=======
    960995  assume(iv->length() == iw->length());
    961996  int i, nR = iv->length();
    962997
     998>>>>>>> f533f6f7667328bccb271b19b2f603aaebe41596
    963999  intvec* ivm = new intvec(nR*nR);
    9641000
     
    9661002  {
    9671003    (*ivm)[i] = (*iv)[i];
    968     (*ivm)[i+nR] = (*iw)[i];
    969   }
    970   for(i=2; i<nR; i++)
    971   {
    972     (*ivm)[i*nR+i-2] = 1;
     1004  }
     1005  for(i=1; i<nR; i++)
     1006  {
     1007    for(j=0; j<nR; j++)
     1008    {
     1009      (*ivm)[j+i*nR] = (*iw)[j+i*nR];
     1010    }
    9731011  }
    9741012  return ivm;
     
    18591897}
    18601898
     1899
     1900/**************************************************************
     1901 * Look for the position of the smallest absolut value in vec *
     1902 **************************************************************/
     1903static int MivAbsMaxArg(intvec* vec)
     1904{
     1905  int k = MivAbsMax(vec);
     1906  int i=0;
     1907  while(1)
     1908  {
     1909    if((*vec)[i] == k || (*vec)[i] == -k)
     1910    {
     1911      break;
     1912    }
     1913    i++;
     1914  }
     1915  return i;
     1916}
     1917
     1918
    18611919/**********************************************************************
    18621920 * Compute a next weight vector between curr_weight and target_weight *
     
    18731931
    18741932  int nRing = currRing->N;
    1875   int checkRed, j, kkk, nG = IDELEMS(G);
     1933  int checkRed, j, nG = IDELEMS(G);
    18761934  intvec* ivtemp;
    18771935
     
    19111969  mpz_init(dcw);
    19121970
    1913   //int tn0, tn1, tz1, ncmp, gcd_tmp, ntmp;
    19141971  int gcd_tmp;
    19151972  intvec* diff_weight = MivSub(target_weight, curr_weight);
     
    19171974  intvec* diff_weight1 = MivSub(target_weight, curr_weight);
    19181975  poly g;
    1919   //poly g, gw;
     1976
    19201977  for (j=0; j<nG; j++)
    19211978  {
     
    19792036    }
    19802037  }
    1981 //Print("\n// Alloc Size = %d \n", nRing*sizeof(mpz_t));
     2038  //Print("\n// Alloc Size = %d \n", nRing*sizeof(mpz_t));
    19822039  mpz_t *vec=(mpz_t*)omAlloc(nRing*sizeof(mpz_t));
    19832040
    19842041
    1985   // there is no 0<t<1 and define the next weight vector that is equal to the current weight vector
     2042  // there is no 0<t<1 and define the next weight vector that is equal
     2043  // to the current weight vector
    19862044  if(mpz_cmp(t_nenner, t_null) == 0)
    19872045  {
     
    20542112#endif
    20552113
    2056   //  BOOLEAN isdwpos;
    2057 
    2058   // construct a new weight vector
     2114// construct a new weight vector and check whether vec[j] is overflow,
     2115// i.e. vec[j] > 2^31.
     2116// If vec[j] doesn't overflow, define a weight vector. Otherwise,
     2117// report that overflow appears. In the second case, test whether the
     2118// the correctness of the new vector plays an important role
     2119
    20592120  for (j=0; j<nRing; j++)
    20602121  {
     
    21002161    }
    21012162  }
    2102 
     2163  // reduce the vector with the gcd
     2164  if(mpz_cmp_si(ggt,1) != 0)
     2165  {
     2166    for (j=0; j<nRing; j++)
     2167    {
     2168      mpz_divexact(vec[j], vec[j], ggt);
     2169    }
     2170  }
    21032171#ifdef  NEXT_VECTORS_CC
    21042172  PrintS("\n// gcd of elements of the vector: ");
     
    21062174#endif
    21072175
    2108 /**********************************************************************
    2109 * construct a new weight vector and check whether vec[j] is overflow, *
    2110 * i.e. vec[j] > 2^31.                                                 *
    2111 * If vec[j] doesn't overflow, define a weight vector. Otherwise,      *
    2112 * report that overflow appears. In the second case, test whether the  *
    2113 * the correctness of the new vector plays an important role           *
    2114 **********************************************************************/
    2115   kkk=0;
    21162176  for(j=0; j<nRing; j++)
    21172177    {
     
    21292189
    21302190  REDUCTION:
     2191  checkRed = 1;
    21312192  for (j=0; j<nRing; j++)
    21322193  {
    2133     (*diff_weight)[j] = mpz_get_si(vec[j]);
    2134   }
    2135   while(MivAbsMax(diff_weight) >= 5)
    2136   {
    2137     for (j=0; j<nRing; j++)
    2138     {
    2139       if(mpz_cmp_si(ggt,1)==0)
    2140       {
    2141         (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5);
    2142         // Print("\n//  vector[%d] = %d \n",j+1, (*diff_weight1)[j]);
    2143       }
    2144       else
    2145       {
    2146         mpz_divexact(vec[j], vec[j], ggt);
    2147         (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5);
    2148         // Print("\n//  vector[%d] = %d \n",j+1, (*diff_weight1)[j]);
    2149       }
    2150 /*
    2151       if((*diff_weight1)[j] == 0)
    2152       {
    2153         kkk = kkk + 1;
    2154       }
    2155 */
    2156     }
    2157 
    2158 
    2159 /*
    2160     if(kkk > nRing - 1)
    2161     {
    2162       // diff_weight was reduced to zero
    2163       // Print("\n // MwalkNextWeightCC: geaenderter Vector gleich Null! \n");
    2164       goto TEST_OVERFLOW;
    2165     }
    2166 */
    2167 
    2168     if(test_w_in_ConeCC(G,diff_weight1) != 0)
    2169     {
    2170       Print("\n// MwalkNextWeightCC: geaenderter vector liegt in Groebnerkegel! \n");
    2171       for (j=0; j<nRing; j++)
    2172       {
    2173         (*diff_weight)[j] = (*diff_weight1)[j];
    2174       }
    2175       if(MivAbsMax(diff_weight) < 5)
    2176       {
    2177         checkRed = 1;
    2178         goto SIMPLIFY_GCD;
    2179       }
    2180     }
    2181     else
    2182     {
    2183       // Print("\n// MwalkNextWeightCC: geaenderter vector liegt nicht in Groebnerkegel! \n");
    2184       break;
    2185     }
     2194    (*diff_weight1)[j] = mpz_get_si(vec[j]);
     2195  }
     2196  while(test_w_in_ConeCC(G,diff_weight1))
     2197  {
     2198    for(j=0; j<nRing; j++)
     2199    {
     2200      (*diff_weight)[j] = (*diff_weight1)[j];
     2201      mpz_set_si(vec[j], (*diff_weight)[j]);     
     2202    }
     2203    for(j=0; j<nRing; j++)
     2204    {
     2205      (*diff_weight1)[j] = floor(0.1*(*diff_weight)[j] + 0.5);
     2206    }
     2207  }
     2208  if(MivAbsMax(diff_weight)>10000)
     2209  {
     2210    for(j=0; j<nRing; j++)
     2211    {
     2212      (*diff_weight1)[j] = (*diff_weight)[j];
     2213    }
     2214    j = 0;
     2215    while(test_w_in_ConeCC(G,diff_weight1))
     2216    {
     2217      (*diff_weight)[j] = (*diff_weight1)[j];
     2218      mpz_set_si(vec[j], (*diff_weight)[j]);
     2219      j = MivAbsMaxArg(diff_weight1);
     2220      (*diff_weight1)[j] = floor(0.1*(*diff_weight1)[j] + 0.5);
     2221    }
     2222    goto SIMPLIFY_GCD;
    21862223  }
    21872224
     
    22222259   mpz_clear(t_null);
    22232260
    2224 
    2225 
    22262261  if(Overflow_Error == FALSE)
    22272262  {
    22282263    Overflow_Error = nError;
    22292264  }
    2230  rComplete(currRing);
    2231   for(kkk=0; kkk<IDELEMS(G);kkk++)
    2232   {
    2233     poly p=G->m[kkk];
     2265  rComplete(currRing);
     2266  for(j=0; j<IDELEMS(G); j++)
     2267  {
     2268    poly p=G->m[j];
    22342269    while(p!=NULL)
    22352270    {
     
    22712306}
    22722307
    2273 /**************************************************************
     2308/********************************************************************
    22742309 * define and execute a new ring which order is (a(vb),a(va),lp,C)  *
    2275  * ************************************************************/
     2310 * ******************************************************************/
    22762311static void VMrHomogeneous(intvec* va, intvec* vb)
    22772312{
     
    24252460  //rChangeCurrRing(r);
    24262461}
    2427 
     2462//unused
     2463#if 0
    24282464static ring VMrDefault1(intvec* va)
    24292465{
     
    24962532  return r;
    24972533}
    2498 
     2534#endif
    24992535/****************************************************************
    25002536 * define and execute a new ring with ordering (a(va),Wp(vb),C) *
     
    31263162    else
    31273163    {
    3128       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung
     3164      rChangeCurrRing(VMrDefault(curr_weight));
    31293165    }
    31303166    newRing = currRing;
     
    38823918    else
    38833919    {
    3884       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung
     3920      rChangeCurrRing(VMrDefault(curr_weight));
    38853921    }
    38863922    newRing = currRing;
     
    41434179    else
    41444180    {
    4145       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung
     4181      rChangeCurrRing(VMrDefault(curr_weight));
    41464182    }
    41474183    newRing = currRing;
     
    42854321intvec* Xivlp;
    42864322
    4287 #if 0
    4288 /********************************
    4289  * compute a next weight vector *
    4290  ********************************/
    4291 static intvec* MWalkRandomNextWeight(ideal G, intvec* curr_weight, intvec* target_weight, int weight_rad, int pert_deg)
    4292 {
    4293   int i, weight_norm;
    4294   int nV = currRing->N;
    4295   intvec* next_weight2;
    4296   intvec* next_weight22 = new intvec(nV);
    4297   intvec* next_weight = MwalkNextWeightCC(curr_weight,target_weight, G);
    4298   if(MivComp(next_weight, target_weight) == 1)
    4299   {
    4300     return(next_weight);
    4301   }
    4302   else
    4303   {
    4304     //compute a perturbed next weight vector "next_weight1"
    4305     intvec* next_weight1 = MkInterRedNextWeight(MPertVectors(G, MivMatrixOrder(curr_weight), pert_deg), target_weight, G);
    4306     //Print("\n // size of next_weight1 = %d", sizeof((*next_weight1)));
    4307 
    4308     //compute a random next weight vector "next_weight2"
    4309     while(1)
    4310     {
    4311       weight_norm = 0;
    4312       while(weight_norm == 0)
    4313       {
    4314         for(i=0; i<nV; i++)
    4315         {
    4316           //Print("\n//  next_weight[%d]  = %d", i, (*next_weight)[i]);
    4317           (*next_weight22)[i] = rand() % 60000 - 30000;
    4318           weight_norm = weight_norm + (*next_weight22)[i]*(*next_weight22)[i];
    4319         }
    4320         weight_norm = 1 + floor(sqrt(weight_norm));
    4321       }
    4322 
    4323       for(i=nV-1; i>=0; i--)
    4324       {
    4325         if((*next_weight22)[i] < 0)
    4326         {
    4327           (*next_weight22)[i] = 1 + (*curr_weight)[i] + floor(weight_rad*(*next_weight22)[i]/weight_norm);
    4328         }
    4329         else
    4330         {
    4331           (*next_weight22)[i] = (*curr_weight)[i] + floor(weight_rad*(*next_weight22)[i]/weight_norm);
    4332         }
    4333       //Print("\n//  next_weight22[%d]  = %d", i, (*next_weight22)[i]);
    4334       }
    4335 
    4336       if(test_w_in_ConeCC(G, next_weight22) == 1)
    4337       {
    4338         //Print("\n//MWalkRandomNextWeight: next_weight2 im Kegel\n");
    4339         next_weight2 = MkInterRedNextWeight(next_weight22, target_weight, G);
    4340         delete next_weight22;
    4341         break;
    4342       }
    4343     }
    4344     intvec* result = new intvec(nV);
    4345     ideal G_test = MwalkInitialForm(G, next_weight);
    4346     ideal G_test1 = MwalkInitialForm(G, next_weight1);
    4347     ideal G_test2 = MwalkInitialForm(G, next_weight2);
    4348 
    4349     // compare next_weights
    4350     if(IDELEMS(G_test1) < IDELEMS(G_test))
    4351     {
    4352       if(IDELEMS(G_test2) <= IDELEMS(G_test1)) // |G_test2| <= |G_test1| < |G_test|
    4353       {
    4354         for(i=0; i<nV; i++)
    4355         {
    4356           (*result)[i] = (*next_weight2)[i];
    4357         }
    4358       }
    4359       else // |G_test1| < |G_test|, |G_test1| < |G_test2|
    4360       {
    4361         for(i=0; i<nV; i++)
    4362         {
    4363           (*result)[i] = (*next_weight1)[i];
    4364         }
    4365       }
    4366     }
    4367     else
    4368     {
    4369       if(IDELEMS(G_test2) <= IDELEMS(G_test)) // |G_test2| <= |G_test| <= |G_test1|
    4370       {
    4371         for(i=0; i<nV; i++)
    4372         {
    4373           (*result)[i] = (*next_weight2)[i];
    4374         }
    4375       }
    4376       else // |G_test| <= |G_test1|, |G_test| < |G_test2|
    4377       {
    4378         for(i=0; i<nV; i++)
    4379         {
    4380           (*result)[i] = (*next_weight)[i];
    4381         }
    4382       }
    4383     }
    4384     delete next_weight;
    4385     delete next_weight1;
    4386     idDelete(&G_test);
    4387     idDelete(&G_test1);
    4388     idDelete(&G_test2);
    4389     if(test_w_in_ConeCC(G, result) == 1)
    4390     {
    4391       delete next_weight2;
    4392       return result;
    4393     }
    4394     else
    4395     {
    4396       delete result;
    4397       return next_weight2;
    4398     }
    4399   }
    4400 }
    4401 #endif
    44024323
    44034324/********************************
     
    44144335
    44154336  //compute a perturbed next weight vector "next_weight1"
    4416   //intvec* next_weight1 = MkInterRedNextWeight(MPertVectors(G,MivMatrixOrderRefine(curr_weight,target_weight),pert_deg),target_weight,G);
    44174337  intvec* next_weight1 =MkInterRedNextWeight(curr_weight,target_weight,G);
    44184338  //compute a random next weight vector "next_weight2"
     
    44434363    {
    44444364      next_weight2 = MkInterRedNextWeight(next_weight22,target_weight,G);
     4365      if(MivAbsMax(next_weight2)>1147483647)
     4366      {
     4367        for(i=0; i<nV; i++)
     4368        {
     4369          (*next_weight22)[i] = (*next_weight2)[i];
     4370        }
     4371        i = 0;
     4372        while(test_w_in_ConeCC(G,next_weight22))
     4373        {
     4374          (*next_weight2)[i] = (*next_weight22)[i];
     4375          i = MivAbsMaxArg(next_weight22);
     4376          (*next_weight22)[i] = floor(0.1*(*next_weight22)[i] + 0.5);
     4377        }
     4378      }
    44454379      delete next_weight22;
    44464380      break;
     
    45734507    else
    45744508    {
    4575       rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung
     4509      rChangeCurrRing(VMrDefault(orig_target_weight));
    45764510    }
    45774511    TargetRing = currRing;
     
    46444578    else
    46454579    {
    4646       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung
     4580      rChangeCurrRing(VMrDefault(curr_weight));
    46474581    }
    46484582    newRing = currRing;
     
    47534687    else
    47544688    {
    4755       rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung
     4689      rChangeCurrRing(VMrDefault(orig_target_weight));
    47564690    }
    47574691    F1 = idrMoveR(G, newRing,currRing);
     
    47844718      else
    47854719      {
    4786         rChangeCurrRing(VMrDefault(orig_target_weight)); // Aenderung
     4720        rChangeCurrRing(VMrDefault(orig_target_weight));
    47874721      }
    47884722    KSTD_Finish:
     
    48824816      tim = clock();
    48834817      /*
    4884         Print("\n// **** Grᅵbnerwalk took %d steps and ", nwalk);
     4818        Print("\n// **** Groebnerwalk took %d steps and ", nwalk);
    48854819        PrintS("\n// **** call the rec. Pert. Walk to compute a red GB of:");
    48864820        idElements(Gomega, "G_omega");
     
    49124846      oldRing = currRing;
    49134847
    4914       /* create a new ring newRing */
     4848      // create a new ring newRing
    49154849       if (rParameter(currRing) != NULL)
    49164850       {
     
    49194853       else
    49204854       {
    4921          rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung
     4855         rChangeCurrRing(VMrDefault(curr_weight));
    49224856       }
    49234857      newRing = currRing;
     
    49454879      else
    49464880      {
    4947         rChangeCurrRing(VMrDefault(curr_weight));  //Aenderung
     4881        rChangeCurrRing(VMrDefault(curr_weight));
    49484882      }
    49494883      newRing = currRing;
     
    49574891      M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
    49584892      delete hilb_func;
    4959 #endif // BUCHBERGER_ALG
     4893#endif
    49604894      tstd = tstd + clock() - to;
    49614895
     
    49664900
    49674901      to = clock();
    4968       // 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.
     4902      // compute a representation of the generators of submod (M) with respect
     4903      // to those of mod (Gomega).
     4904      // Gomega is a reduced Groebner basis w.r.t. the current ring.
    49694905      F = MLifttwoIdeal(Gomega2, M1, G);
    49704906      tlift = tlift + clock() - to;
     
    50164952      else
    50174953      {
    5018         rChangeCurrRing(VMrDefault(target_weight)); // Aenderung
     4954        rChangeCurrRing(VMrDefault(target_weight));
    50194955      }
    50204956      F1 = idrMoveR(G, newRing,currRing);
     
    50634999 * THE GROEBNER WALK ALGORITHM *
    50645000 *******************************/
    5065 ideal Mwalk(ideal Go, intvec* orig_M, intvec* target_M, ring baseRing)
     5001ideal Mwalk(ideal Go, intvec* orig_M, intvec* target_M,
     5002            ring baseRing, int reduction, int printout)
    50665003{
    5067   BITSET save1 = si_opt_1; // save current options
    5068   //si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
    5069   //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
    5070   //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
     5004  // save current options
     5005  BITSET save1 = si_opt_1;
     5006  if(reduction == 0)
     5007  {
     5008    // no reduced Groebner basis
     5009    si_opt_1 &= (~Sy_bit(OPT_REDSB));
     5010    // not tail reductions
     5011    //si_opt_1 &= (~Sy_bit(OPT_REDTAIL));
     5012  }
    50715013  Set_Error(FALSE);
    50725014  Overflow_Error = FALSE;
     
    51095051#endif
    51105052  rComplete(currRing);
    5111 #ifdef CHECK_IDEAL_MWALK
    5112     idString(Go,"Go");
    5113 #endif
     5053//#ifdef CHECK_IDEAL_MWALK
     5054  if(printout > 2)
     5055  {
     5056    idString(Go,"//** Mwalk: Go");
     5057  }
     5058//#endif
    51145059#ifdef TIME_TEST
    51155060  to = clock();
    51165061#endif
    5117      if(orig_M->length() == nV)
    5118       {
    5119         newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
    5120       }
    5121       else
    5122       {
    5123         newRing = VMatrDefault(orig_M);
    5124       }
     5062  if(orig_M->length() == nV)
     5063  {
     5064    // define a new ring with ordering "(a(curr_weight),lp)
     5065    newRing = VMrDefault(curr_weight);
     5066  }
     5067  else
     5068  {
     5069    newRing = VMatrDefault(orig_M);
     5070  }
    51255071  rChangeCurrRing(newRing);
    51265072  ideal G = MstdCC(idrMoveR(Go,baseRing,currRing));
     
    51385084    to = clock();
    51395085#endif
    5140 #ifdef CHECK_IDEAL_MWALK
    5141     idString(G,"G");
    5142 #endif
    5143     Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
     5086//#ifdef CHECK_IDEAL_MWALK
     5087    if(printout > 2)
     5088    {
     5089      idString(G,"//** Mwalk: G");
     5090    }
     5091//#endif
     5092    // compute an initial form ideal of <G> w.r.t. "curr_vector"
     5093    Gomega = MwalkInitialForm(G, curr_weight);
    51445094#ifdef TIME_TEST
    5145     tif = tif + clock()-to; //time for computing initial form ideal
    5146 #endif
    5147 #ifdef CHECK_IDEAL_MWALK
    5148     idString(Gomega,"Gomega");
    5149 #endif
     5095    //time for computing initial form ideal
     5096    tif = tif + clock()-to;
     5097#endif
     5098//#ifdef CHECK_IDEAL_MWALK
     5099    if(printout > 1)
     5100    {
     5101      idString(Gomega,"//** Mwalk: Gomega");
     5102    }
     5103//#endif
    51505104#ifndef  BUCHBERGER_ALG
    51515105    if(isNolVector(curr_weight) == 0)
     
    51625116      if(orig_M->length() == nV)
    51635117      {
    5164         newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
     5118        // define a new ring with ordering "(a(curr_weight),lp)
     5119        newRing = VMrDefault(curr_weight);
    51655120      }
    51665121      else
     
    51735128     if(target_M->length() == nV)
    51745129     {
    5175        newRing = VMrRefine(curr_weight,target_weight); //define a new ring with ordering "(a(curr_weight),Wp(target_weight))"
     5130       //define a new ring with ordering "(a(curr_weight),Wp(target_weight))"
     5131       newRing = VMrRefine(curr_weight,target_weight);
    51765132     }
    51775133     else
    51785134     {
     5135       //define a new ring with matrix ordering
    51795136       newRing = VMatrRefine(target_M,curr_weight);
    51805137     }
     
    51975154#endif
    51985155    idSkipZeroes(M);
    5199 #ifdef CHECK_IDEAL_MWALK
    5200     PrintS("\n//** Mwalk: computed M.\n");
    5201     idString(M, "M");
    5202 #endif
     5156//#ifdef CHECK_IDEAL_MWALK
     5157    if(printout > 2)
     5158    {
     5159      idString(M, "//** Mwalk: M");
     5160    }
     5161//#endif
    52035162    //change the ring to baseRing
    52045163    rChangeCurrRing(baseRing);
     
    52105169    to = clock();
    52115170#endif
    5212     // 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
     5171    // compute a representation of the generators of submod (M) with respect to those of mod (Gomega),
     5172    // where Gomega is a reduced Groebner basis w.r.t. the current ring
    52135173    F = MLifttwoIdeal(Gomega2, M1, G);
    52145174#ifdef TIME_TEST
    52155175    tlift = tlift + clock() - to;
    52165176#endif
    5217 #ifdef CHECK_IDEAL_MWALK
    5218     idString(F, "F");
    5219 #endif
     5177//#ifdef CHECK_IDEAL_MWALK
     5178    if(printout > 2)
     5179    {
     5180      idString(F, "//** Mwalk: F");
     5181    }
     5182//#endif
    52205183    idDelete(&Gomega2);
    52215184    idDelete(&M1);
     
    52275190    to = clock();
    52285191#endif
    5229     //G = kStd(F1,NULL,testHomog,NULL,NULL,0,0,NULL);
     5192
    52305193#ifdef TIME_TEST
    52315194    tstd = tstd + clock() - to;
    52325195#endif
    52335196    idSkipZeroes(G);
    5234 #ifdef CHECK_IDEAL_MWALK
    5235     idString(G, "G");
    5236 #endif
     5197//#ifdef CHECK_IDEAL_MWALK
     5198    if(printout > 2)
     5199    {
     5200      idString(G, "//** Mwalk: G");
     5201    }
     5202//#endif
    52375203#ifdef TIME_TEST
    52385204    to = clock();
     
    52425208    tnw = tnw + clock() - to;
    52435209#endif
    5244 #ifdef PRINT_VECTORS
    5245     MivString(curr_weight, target_weight, next_weight);
    5246 #endif
    5247     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)
    5248     {
    5249 #ifdef CHECK_IDEAL_MWALK
    5250       PrintS("\n//** Mwalk: entering last cone.\n");
    5251 #endif
     5210//#ifdef PRINT_VECTORS
     5211    if(printout > 0)
     5212    {
     5213      MivString(curr_weight, target_weight, next_weight);
     5214    }
     5215//#endif
     5216    if(MivComp(next_weight, ivNull) == 1 || MivComp(target_weight,curr_weight) == 1 || test_w_in_ConeCC(G, target_weight) == 1)
     5217    {
     5218//#ifdef CHECK_IDEAL_MWALK
     5219      if(printout > 0)
     5220      {
     5221        PrintS("\n//** Mwalk: entering last cone.\n");
     5222      }
     5223//#endif
    52525224      Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
    52535225      if(target_M->length() == nV)
     
    52625234      Gomega1 = idrMoveR(Gomega, baseRing,currRing);
    52635235      idDelete(&Gomega);
    5264 #ifdef CHECK_IDEAL_MWALK
    5265       idString(Gomega1, "Gomega");
    5266 #endif
     5236//#ifdef CHECK_IDEAL_MWALK
     5237      if(printout > 1)
     5238      {
     5239        idString(Gomega1, "//** Mwalk: Gomega");
     5240      }
     5241//#endif
    52675242      M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
    5268 #ifdef CHECK_IDEAL_MWALK
    5269       idString(M,"M");
    5270 #endif
     5243//#ifdef CHECK_IDEAL_MWALK
     5244      if(printout > 1)
     5245      {
     5246        idString(M,"//** Mwalk: M");
     5247      }
     5248//#endif
    52715249      rChangeCurrRing(baseRing);
    52725250      M1 =  idrMoveR(M, newRing,currRing);
     
    52755253      idDelete(&Gomega1);
    52765254      F = MLifttwoIdeal(Gomega2, M1, G);
    5277 #ifdef CHECK_IDEAL_MWALK
    5278       idString(F,"F");
    5279 #endif
     5255//#ifdef CHECK_IDEAL_MWALK
     5256    if(printout > 2)
     5257    {
     5258      idString(F,"//** Mwalk: F");
     5259    }
     5260//#endif
    52805261      idDelete(&Gomega2);
    52815262      idDelete(&M1);
     
    52895270      to = clock();
    52905271#endif
    5291  //     if(si_opt_1 == (Sy_bit(OPT_REDSB)))
    5292   //    {
    5293         G = kInterRedCC(G,NULL); //reduce the Groebner basis <G> w.r.t. currRing, if option(redSB) is set
    5294   //    }
     5272      //interreduce the Groebner basis <G> w.r.t. currRing
     5273      G = kInterRedCC(G,NULL);
    52955274#ifdef TIME_TEST
    52965275      tred = tred + clock() - to;
     
    52995278      delete next_weight;
    53005279      break;
    5301 #ifdef CHECK_IDEAL_MWALK
    5302       PrintS("\n//** Mwalk: last cone.\n");
    5303 #endif
    5304     }
    5305 #ifdef CHECK_IDEAL_MWALK
    5306     PrintS("\n//** Mwalk: update weight vectors.\n");
    5307 #endif
     5280    }
    53085281    for(i=nV-1; i>=0; i--)
    53095282    {
     
    53165289  ideal result = idrMoveR(G,baseRing,currRing);
    53175290  idDelete(&G);
    5318 /*#ifdef CHECK_IDEAL_MWALK
    5319   pDelete(&p);
    5320 #endif*/
    53215291  delete tmp_weight;
    53225292  delete ivNull;
     
    53265296#endif
    53275297#ifdef TIME_TEST
    5328   Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep);
    53295298  TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep);
    5330   Print("\n//** Mwalk: Ergebnis.\n");
    53315299  //Print("\n// pSetm_Error = (%d)", ErrorCheck());
    53325300  //Print("\n// Overflow_Error? (%d)\n", Overflow_Error);
    53335301#endif
     5302  Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep);
    53345303  return(result);
    53355304}
    53365305
    5337 // 07.11.2012
    5338 // THE RANDOM WALK ALGORITHM  ideal Go, intvec* orig_M, intvec* target_M, ring baseRing
    5339 ideal Mrwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, int pert_deg, ring baseRing)
     5306// THE RANDOM WALK ALGORITHM
     5307ideal Mrwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad, int pert_deg,
     5308             int reduction, int printout)
    53405309{
    53415310  BITSET save1 = si_opt_1; // save current options
    5342   //si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
    5343   //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
    5344   //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
     5311  if(reduction == 0)
     5312  {
     5313    si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
     5314    //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
     5315    //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
     5316  }
    53455317  Set_Error(FALSE);
    53465318  Overflow_Error = FALSE;
     
    53525324#endif
    53535325  nstep=0;
    5354   int i,nwalk,endwalks = 0;
    5355   int nV = baseRing->N;
     5326  int i,polylength,nwalk,endwalks = 0;
     5327  int nV = currRing->N;
    53565328
    53575329  ideal Gomega, M, F, Gomega1, Gomega2, M1; //, F1;
    53585330  ring newRing;
    5359   ring XXRing = baseRing;
     5331  ring baseRing = currRing;
     5332  ring XXRing = currRing;
    53605333  intvec* ivNull = new intvec(nV);
    53615334  intvec* curr_weight = new intvec(nV);
     
    53635336  intvec* exivlp = Mivlp(nV);
    53645337  intvec* tmp_weight = new intvec(nV);
     5338  intvec* next_weight= new intvec(nV);
    53655339  for(i=0; i<nV; i++)
    53665340  {
     
    53835357#endif
    53845358  rComplete(currRing);
    5385 #ifdef CHECK_IDEAL_MWALK
    5386     idString(Go,"Go");
    5387 #endif
    53885359#ifdef TIME_TEST
    53895360  to = clock();
    53905361#endif
    5391      if(orig_M->length() == nV)
    5392       {
    5393         newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
    5394       }
    5395       else
    5396       {
    5397         newRing = VMatrDefault(orig_M);
    5398       }
     5362  if(orig_M->length() == nV)
     5363  {
     5364    newRing = VMrDefault(curr_weight); // define a new ring with ordering "(a(curr_weight),lp)
     5365  }
     5366  else
     5367  {
     5368    newRing = VMatrDefault(orig_M);
     5369  }
    53995370  rChangeCurrRing(newRing);
    54005371  ideal G = MstdCC(idrMoveR(Go,baseRing,currRing));
     
    54125383    to = clock();
    54135384#endif
    5414 #ifdef CHECK_IDEAL_MWALK
    5415     idString(G,"G");
    5416 #endif
     5385//#ifdef CHECK_IDEAL_MWALK
     5386    if(printout > 2)
     5387    {
     5388      idString(G,"//** Mrwalk: G");
     5389    }
     5390//#endif
    54175391    Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
     5392    //polylength = 1 if there is a polynomial in Gomega with at least 3 monomials and 0 otherwise
     5393    polylength = lengthpoly(Gomega);
    54185394#ifdef TIME_TEST
    54195395    tif = tif + clock()-to; //time for computing initial form ideal
    54205396#endif
    5421 #ifdef CHECK_IDEAL_MWALK
    5422     idString(Gomega,"Gomega");
    5423 #endif
     5397//#ifdef CHECK_IDEAL_MWALK
     5398    if(printout > 1)
     5399    {
     5400      idString(Gomega,"//** Mrwalk: Gomega");
     5401    }
     5402//#endif
    54245403#ifndef  BUCHBERGER_ALG
    54255404    if(isNolVector(curr_weight) == 0)
     
    54715450#endif
    54725451    idSkipZeroes(M);
    5473 #ifdef CHECK_IDEAL_MWALK
    5474     PrintS("\n//** Mwalk: computed M.\n");
    5475     idString(M, "M");
    5476 #endif
     5452//#ifdef CHECK_IDEAL_MWALK
     5453    if(printout > 2)
     5454    {
     5455      idString(M, "//** Mrwalk: M");
     5456    }
     5457//#endif
    54775458    //change the ring to baseRing
    54785459    rChangeCurrRing(baseRing);
     
    54845465    to = clock();
    54855466#endif
    5486     // 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
     5467    // compute a representation of the generators of submod (M) with respect to those of mod (Gomega),
     5468    // where Gomega is a reduced Groebner basis w.r.t. the current ring
    54875469    F = MLifttwoIdeal(Gomega2, M1, G);
    54885470#ifdef TIME_TEST
    54895471    tlift = tlift + clock() - to;
    54905472#endif
    5491 #ifdef CHECK_IDEAL_MWALK
    5492     idString(F, "F");
    5493 #endif
     5473//#ifdef CHECK_IDEAL_MWALK
     5474    if(printout > 2)
     5475    {
     5476      idString(F, "//** Mrwalk: F");
     5477    }
     5478//#endif
    54945479    idDelete(&Gomega2);
    54955480    idDelete(&M1);
     
    55005485#ifdef TIME_TEST
    55015486    to = clock();
    5502 #endif
    5503     //G = kStd(F1,NULL,testHomog,NULL,NULL,0,0,NULL);
    5504 #ifdef TIME_TEST
    55055487    tstd = tstd + clock() - to;
    55065488#endif
    55075489    idSkipZeroes(G);
    5508 #ifdef CHECK_IDEAL_MWALK
    5509     idString(G, "G");
    5510 #endif
     5490//#ifdef CHECK_IDEAL_MWALK
     5491    if(printout > 2)
     5492    {
     5493      idString(G, "//** Mrwalk: G");
     5494    }
     5495//#endif
    55115496#ifdef TIME_TEST
    55125497    to = clock();
    55135498#endif
    5514     intvec* next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, pert_deg);//next_weight = MwalkNextWeightCC(curr_weight,target_weight,G);
     5499    next_weight = MwalkNextWeightCC(curr_weight,target_weight,G);
     5500    if(polylength > 0)
     5501    {
     5502      //there is a polynomial in Gomega with at least 3 monomials,
     5503      //low-dimensional facet of the cone
     5504      delete next_weight;
     5505      next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, pert_deg);
     5506    }
    55155507#ifdef TIME_TEST
    55165508    tnw = tnw + clock() - to;
    55175509#endif
    5518 #ifdef PRINT_VECTORS
    5519     MivString(curr_weight, target_weight, next_weight);
    5520 #endif
     5510//#ifdef PRINT_VECTORS
     5511    if(printout > 0)
     5512    {
     5513      MivString(curr_weight, target_weight, next_weight);
     5514    }
     5515//#endif
    55215516    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)
    55225517    {
     
    55255520#endif
    55265521      Gomega = MwalkInitialForm(G, curr_weight); // compute an initial form ideal of <G> w.r.t. "curr_vector"
     5522//#ifdef CHECK_IDEAL_MWALK
     5523      if(printout > 1)
     5524      {
     5525        idString(Gomega, "//** Mrwalk: Gomega");
     5526      }
     5527//#endif
    55275528      if(target_M->length() == nV)
    55285529      {
     
    55365537      Gomega1 = idrMoveR(Gomega, baseRing,currRing);
    55375538      idDelete(&Gomega);
    5538 #ifdef CHECK_IDEAL_MWALK
    5539       idString(Gomega1, "Gomega");
    5540 #endif
    55415539      M = kStd(Gomega1,NULL,testHomog,NULL,NULL,0,0,NULL);
    5542 #ifdef CHECK_IDEAL_MWALK
    5543       idString(M,"M");
    5544 #endif
     5540//#ifdef CHECK_IDEAL_MWALK
     5541      if(printout > 2)
     5542      {
     5543        idString(M,"//** Mrwalk: M");
     5544      }
     5545//#endif
    55455546      rChangeCurrRing(baseRing);
    55465547      M1 =  idrMoveR(M, newRing,currRing);
     
    55495550      idDelete(&Gomega1);
    55505551      F = MLifttwoIdeal(Gomega2, M1, G);
    5551 #ifdef CHECK_IDEAL_MWALK
    5552       idString(F,"F");
    5553 #endif
    55545552      idDelete(&Gomega2);
    55555553      idDelete(&M1);
     
    55585556      idDelete(&F);
    55595557      baseRing = currRing;
    5560       si_opt_1 = save1; //set original options, e. g. option(RedSB)
    55615558      idSkipZeroes(G);
    55625559#ifdef TIME_TEST
    55635560      to = clock();
    55645561#endif
    5565  //     if(si_opt_1 == (Sy_bit(OPT_REDSB)))
    5566   //    {
    5567         //G = kInterRedCC(G,NULL); //reduce the Groebner basis <G> w.r.t. currRing, if option(redSB) is set
    5568   //    }
     5562//#ifdef CHECK_IDEAL_MWALK
     5563      if(printout > 2)
     5564      {
     5565        idString(G,"//** Mrwalk: G");
     5566      }
     5567/*#endif
     5568      if(si_opt_1 == (Sy_bit(OPT_REDSB)))
     5569      {*/
     5570        G = kInterRedCC(G,NULL); //interreduce the Groebner basis <G> w.r.t. currRing
     5571//      }
    55695572#ifdef TIME_TEST
    55705573      tred = tred + clock() - to;
     
    55735576      delete next_weight;
    55745577      break;
    5575 #ifdef CHECK_IDEAL_MWALK
    5576       PrintS("\n//** Mwalk: last cone.\n");
    5577 #endif
    5578     }
    5579 #ifdef CHECK_IDEAL_MWALK
    5580     PrintS("\n//** Mwalk: update weight vectors.\n");
    5581 #endif
     5578    }
    55825579    for(i=nV-1; i>=0; i--)
    55835580    {
     
    55875584    delete next_weight;
    55885585  }
     5586  baseRing = currRing;
    55895587  rChangeCurrRing(XXRing);
    55905588  ideal result = idrMoveR(G,baseRing,currRing);
    55915589  idDelete(&G);
    5592 /*#ifdef CHECK_IDEAL_MWALK
    5593   pDelete(&p);
    5594 #endif*/
     5590  si_opt_1 = save1; //set original options, e. g. option(RedSB)
    55955591  delete tmp_weight;
    55965592  delete ivNull;
     
    55995595  delete last_omega;
    56005596#endif
     5597  Print("\n//** Mrwalk: Groebner Walk took %d steps.\n", nstep);
    56015598#ifdef TIME_TEST
    5602   Print("\n//** Mwalk: Groebner Walk took %d steps.\n", nstep);
    56035599  TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep);
    5604   Print("\n//** Mwalk: Ergebnis.\n");
    56055600  //Print("\n// pSetm_Error = (%d)", ErrorCheck());
    56065601  //Print("\n// Overflow_Error? (%d)\n", Overflow_Error);
     
    57495744// use kStd, if nP = 0, else call LastGB
    57505745ideal Mpwalk(ideal Go, int op_deg, int tp_deg,intvec* curr_weight,
    5751              intvec* target_weight, int nP)
     5746             intvec* target_weight, int nP, int reduction, int printout)
    57525747{
     5748  BITSET save1 = si_opt_1; // save current options
     5749  if(reduction == 0)
     5750  {
     5751    si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
     5752    //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
     5753    //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
     5754  }
    57535755  Set_Error(FALSE  );
    57545756  Overflow_Error = FALSE;
     
    57885790  ring XXRing = currRing;
    57895791
    5790 
    57915792  to = clock();
    5792   /* perturbs the original vector */
     5793  // perturbs the original vector
    57935794  if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) := "dp"
    57945795  {
     
    58075808      DefRingPar(curr_weight);
    58085809    else
    5809       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 1
     5810      rChangeCurrRing(VMrDefault(curr_weight));
    58105811
    58115812    G = idrMoveR(Go, XXRing,currRing);
     
    58225823  ring HelpRing = currRing;
    58235824
    5824   /* perturbs the target weight vector */
     5825  // perturbs the target weight vector
    58255826  if(tp_deg > 1 && tp_deg <= nV)
    58265827  {
     
    58285829      DefRingPar(target_weight);
    58295830    else
    5830       rChangeCurrRing(VMrDefault(target_weight)); // Aenderung 2
     5831      rChangeCurrRing(VMrDefault(target_weight));
    58315832
    58325833    TargetRing = currRing;
     
    58505851    G = idrMoveR(ssG, TargetRing,currRing);
    58515852  }
    5852   /*
    5853     Print("\n// Perturbationwalkalg. vom Gradpaar (%d,%d):",op_deg,tp_deg);
    5854     ivString(curr_weight, "new sigma");
    5855     ivString(target_weight, "new tau");
    5856   */
     5853    if(printout > 0)
     5854    {
     5855      Print("\n//** Mpwalk: Perturbation Walk of degree (%d,%d):",op_deg,tp_deg);
     5856      ivString(curr_weight, "//** Mpwalk: new current weight");
     5857      ivString(target_weight, "//** Mpwalk: new target weight");
     5858    }
    58575859  while(1)
    58585860  {
     
    58625864       "curr_weight" */
    58635865    Gomega = MwalkInitialForm(G, curr_weight);
    5864 
     5866//#ifdef CHECK_IDEAL_MWALK
     5867      if(printout > 1)
     5868      {
     5869        idString(Gomega,"//** Mpwalk: Gomega");
     5870      }
     5871//#endif
    58655872
    58665873#ifdef ENDWALKS
    5867     if(endwalks == 1){
     5874    if(endwalks == 1)
     5875    {
    58685876      Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
    58695877      idElements(G, "G");
    5870       // idElements(Gomega, "Gw");
    58715878      headidString(G, "G");
    5872       //headidString(Gomega, "Gw");
    58735879    }
    58745880#endif
     
    58895895      DefRingPar(curr_weight);
    58905896    else
    5891       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 3
     5897      rChangeCurrRing(VMrDefault(curr_weight));
    58925898
    58935899    newRing = currRing;
     
    59165922    M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
    59175923    delete hilb_func;
    5918 #endif // BUCHBERGER_ALG
     5924#endif
     5925//#ifdef CHECK_IDEAL_MWALK
     5926      if(printout > 2)
     5927      {
     5928        idString(M,"//** Mpwalk: M");
     5929      }
     5930//#endif
    59195931
    59205932    if(endwalks == 1){
     
    59325944    M1 =  idrMoveR(M, newRing,currRing);
    59335945    Gomega2 =  idrMoveR(Gomega1, newRing,currRing);
    5934 
    5935     //if(endwalks==1)  PrintS("\n// Lifting is working:..");
    59365946
    59375947    to=clock();
     
    59455955      xtlift=clock()-to;
    59465956
     5957//#ifdef CHECK_IDEAL_MWALK
     5958    if(printout > 2)
     5959    {
     5960      idString(F,"//** Mpwalk: F");
     5961    }
     5962//#endif
     5963
    59475964    idDelete(&M1);
    59485965    idDelete(&Gomega2);
     
    59525969    rChangeCurrRing(newRing);
    59535970    F1 = idrMoveR(F, oldRing,currRing);
    5954 
    5955     //if(endwalks==1)PrintS("\n// InterRed is working now:");
    59565971
    59575972    to=clock();
     
    59695984
    59705985    to=clock();
    5971     /* compute a next weight vector */
     5986    // compute a next weight vector
    59725987    next_weight = MkInterRedNextWeight(curr_weight,target_weight, G);
    59735988    tnw=tnw+clock()-to;
    5974 #ifdef PRINT_VECTORS
    5975     MivString(curr_weight, target_weight, next_weight);
    5976 #endif
     5989//#ifdef PRINT_VECTORS
     5990    if(printout > 2)
     5991    {
     5992      MivString(curr_weight, target_weight, next_weight);
     5993    }
     5994//#endif
    59775995
    59785996    if(Overflow_Error == TRUE)
     
    60126030        DefRingPar(orig_target);
    60136031      else
    6014         rChangeCurrRing(VMrDefault(orig_target)); //Aenderung
     6032        rChangeCurrRing(VMrDefault(orig_target));
    60156033
    60166034    TargetRing=currRing;
     
    60666084    Eresult = idrMoveR(G, newRing,currRing);
    60676085  }
     6086  si_opt_1 = save1; //set original options, e. g. option(RedSB)
    60686087  delete ivNull;
    60696088  if(tp_deg != 1)
     
    60806099             tnw+xtnw);
    60816100
    6082   Print("\n// pSetm_Error = (%d)", ErrorCheck());
    6083   Print("\n// It took %d steps and Overflow_Error? (%d)\n", nstep,  Overflow_Error);
    6084 #endif
     6101  //Print("\n// pSetm_Error = (%d)", ErrorCheck());
     6102  //Print("\n// It took %d steps and Overflow_Error? (%d)\n", nstep,  Overflow_Error);
     6103#endif
     6104  Print("\n//** Mpwalk: Perturbation Walk took %d steps.\n", nstep);
     6105  return(Eresult);
     6106}
     6107
     6108/*******************************************************
     6109 * THE PERTURBATION WALK ALGORITHM WITH RANDOM ELEMENT *
     6110 *******************************************************/
     6111ideal Mprwalk(ideal Go, intvec* orig_M, intvec* target_M, int weight_rad,
     6112              int op_deg, int tp_deg, int nP, int reduction, int printout)
     6113{
     6114  BITSET save1 = si_opt_1; // save current options
     6115  if(reduction == 0)
     6116  {
     6117    si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
     6118    //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
     6119    //si_opt_1|=(Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
     6120  }
     6121  Set_Error(FALSE);
     6122  Overflow_Error = FALSE;
     6123  //Print("// pSetm_Error = (%d)", ErrorCheck());
     6124
     6125  clock_t  tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0;
     6126  xtextra=0;
     6127  xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;
     6128  tinput = clock();
     6129
     6130  clock_t tim;
     6131
     6132  nstep = 0;
     6133  int i, ntwC=1, ntestw=1, polylength, nV = currRing->N;
     6134  int endwalks=0;
     6135
     6136  ideal Gomega, M, F, G, Gomega1, Gomega2, M1,F1,Eresult,ssG;
     6137  ring newRing, oldRing, TargetRing;
     6138  intvec* iv_M_dp;
     6139  intvec* iv_M_lp;
     6140  intvec* exivlp = Mivlp(nV);
     6141  intvec* curr_weight = new intvec(nV);
     6142  intvec* target_weight = new intvec(nV);
     6143  for(i=0; i<nV; i++)
     6144  {
     6145    (*curr_weight)[i] = (*orig_M)[i];
     6146    (*target_weight)[i] = (*target_M)[i];
     6147  }
     6148  intvec* orig_target = target_weight;
     6149  intvec* pert_target_vector = target_weight;
     6150  intvec* ivNull = new intvec(nV);
     6151  intvec* iv_dp = MivUnit(nV);// define (1,1,...,1)
     6152#ifndef BUCHBERGER_ALG
     6153  intvec* hilb_func;
     6154#endif
     6155  intvec* next_weight;
     6156
     6157  // to avoid (1,0,...,0) as the target vector
     6158  intvec* last_omega = new intvec(nV);
     6159  for(i=nV-1; i>0; i--)
     6160    (*last_omega)[i] = 1;
     6161  (*last_omega)[0] = 10000;
     6162
     6163  ring XXRing = currRing;
     6164
     6165  to = clock();
     6166  // perturbs the original vector
     6167  if(orig_M->length() == nV)
     6168  {
     6169    if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) := "dp"
     6170    {
     6171      G = MstdCC(Go);
     6172      tostd = clock()-to;
     6173      if(op_deg != 1)
     6174      {
     6175        iv_M_dp = MivMatrixOrderdp(nV);
     6176        //ivString(iv_M_dp, "iv_M_dp");
     6177        curr_weight = MPertVectors(G, iv_M_dp, op_deg);
     6178      }
     6179    }
     6180    else
     6181    {
     6182      //define ring order := (a(curr_weight),lp);
     6183      if (rParameter(currRing) != NULL)
     6184        DefRingPar(curr_weight);
     6185      else
     6186        rChangeCurrRing(VMrDefault(curr_weight));
     6187
     6188      G = idrMoveR(Go, XXRing,currRing);
     6189      G = MstdCC(G);
     6190      tostd = clock()-to;
     6191      if(op_deg != 1)
     6192      {
     6193        iv_M_dp = MivMatrixOrder(curr_weight);
     6194        curr_weight = MPertVectors(G, iv_M_dp, op_deg);
     6195      }
     6196    }
     6197  }
     6198  else
     6199  {
     6200    rChangeCurrRing(VMatrDefault(orig_M));
     6201    G = idrMoveR(Go, XXRing,currRing);
     6202    G = MstdCC(G);
     6203    tostd = clock()-to;
     6204    if(op_deg != 1)
     6205    {
     6206      curr_weight = MPertVectors(G, orig_M, op_deg);
     6207    }
     6208  }
     6209
     6210  delete iv_dp;
     6211  if(op_deg != 1) delete iv_M_dp;
     6212
     6213  ring HelpRing = currRing;
     6214
     6215  // perturbs the target weight vector
     6216  if(target_M->length() == nV)
     6217  {
     6218    if(tp_deg > 1 && tp_deg <= nV)
     6219    {
     6220      if (rParameter(currRing) != NULL)
     6221        DefRingPar(target_weight);
     6222      else
     6223        rChangeCurrRing(VMrDefault(target_weight));
     6224
     6225      TargetRing = currRing;
     6226      ssG = idrMoveR(G,HelpRing,currRing);
     6227      if(MivSame(target_weight, exivlp) == 1)
     6228      {
     6229        iv_M_lp = MivMatrixOrderlp(nV);
     6230        //ivString(iv_M_lp, "iv_M_lp");
     6231        //target_weight = MPertVectorslp(ssG, iv_M_lp, tp_deg);
     6232        target_weight = MPertVectors(ssG, iv_M_lp, tp_deg);
     6233      }
     6234      else
     6235      {
     6236        iv_M_lp = MivMatrixOrder(target_weight);
     6237        //target_weight = MPertVectorslp(ssG, iv_M_lp, tp_deg);
     6238        target_weight = MPertVectors(ssG, iv_M_lp, tp_deg);
     6239      }
     6240      delete iv_M_lp;
     6241      pert_target_vector = target_weight;
     6242      rChangeCurrRing(HelpRing);
     6243      G = idrMoveR(ssG, TargetRing,currRing);
     6244    }
     6245  }
     6246  else
     6247  {
     6248    if(tp_deg > 1 && tp_deg <= nV)
     6249    {
     6250      rChangeCurrRing(VMatrDefault(target_M));
     6251      TargetRing = currRing;
     6252      ssG = idrMoveR(G,HelpRing,currRing);
     6253      target_weight = MPertVectors(ssG, target_M, tp_deg);
     6254    }
     6255  }
     6256  if(printout > 0)
     6257  {
     6258    Print("\n//** Mprwalk: Random Perturbation Walk of degree (%d,%d):",op_deg,tp_deg);
     6259    ivString(curr_weight, "//** Mprwalk: new current weight");
     6260    ivString(target_weight, "//** Mprwalk: new target weight");
     6261  }
     6262  while(1)
     6263  {
     6264    nstep ++;
     6265    to = clock();
     6266    /* compute an initial form ideal of <G> w.r.t. the weight vector
     6267       "curr_weight" */
     6268    Gomega = MwalkInitialForm(G, curr_weight);
     6269//#ifdef CHECK_IDEAL_MWALK
     6270    if(printout > 1)
     6271    {
     6272      idString(Gomega,"//** Mprwalk: Gomega");
     6273    }
     6274//#endif
     6275    polylength = lengthpoly(Gomega);
     6276#ifdef ENDWALKS
     6277    if(endwalks == 1)
     6278    {
     6279      Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
     6280      idElements(G, "G");
     6281      headidString(G, "G");
     6282    }
     6283#endif
     6284
     6285    tif = tif + clock()-to;
     6286
     6287#ifndef  BUCHBERGER_ALG
     6288    if(isNolVector(curr_weight) == 0)
     6289      hilb_func = hFirstSeries(Gomega,NULL,NULL,curr_weight,currRing);
     6290    else
     6291      hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
     6292#endif // BUCHBERGER_ALG
     6293
     6294    oldRing = currRing;
     6295
     6296    if(target_M->length() == nV)
     6297    {
     6298      // define a new ring with ordering "(a(curr_weight),lp)
     6299      if (rParameter(currRing) != NULL)
     6300        DefRingPar(curr_weight);
     6301      else
     6302        rChangeCurrRing(VMrDefault(curr_weight));
     6303    }
     6304    else
     6305    {
     6306      rChangeCurrRing(VMatrRefine(target_M,curr_weight));
     6307    }
     6308    newRing = currRing;
     6309    Gomega1 = idrMoveR(Gomega, oldRing,currRing);
     6310
     6311#ifdef ENDWALKS
     6312    if(endwalks==1)
     6313    {
     6314      Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
     6315      idElements(Gomega1, "Gw");
     6316      headidString(Gomega1, "headGw");
     6317      PrintS("\n// compute a rGB of Gw:\n");
     6318
     6319#ifndef  BUCHBERGER_ALG
     6320      ivString(hilb_func, "w");
     6321#endif
     6322    }
     6323#endif
     6324
     6325    tim = clock();
     6326    to = clock();
     6327    /* compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" */
     6328#ifdef  BUCHBERGER_ALG
     6329    M = MstdhomCC(Gomega1);
     6330#else
     6331    M=kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,curr_weight);
     6332    delete hilb_func;
     6333#endif
     6334//#ifdef CHECK_IDEAL_MWALK
     6335    if(printout > 2)
     6336    {
     6337      idString(M,"//** Mprwalk: M");
     6338    }
     6339//#endif
     6340
     6341    if(endwalks == 1)
     6342    {
     6343      xtstd = xtstd+clock()-to;
     6344#ifdef ENDWALKS
     6345      Print("\n// time for the last std(Gw)  = %.2f sec\n",
     6346            ((double) clock())/1000000 -((double)tim) /1000000);
     6347#endif
     6348    }
     6349    else
     6350      tstd=tstd+clock()-to;
     6351
     6352    /* change the ring to oldRing */
     6353    rChangeCurrRing(oldRing);
     6354    M1 =  idrMoveR(M, newRing,currRing);
     6355    Gomega2 =  idrMoveR(Gomega1, newRing,currRing);
     6356
     6357    to=clock();
     6358    /* compute a representation of the generators of submod (M)
     6359       with respect to those of mod (Gomega).
     6360       Gomega is a reduced Groebner basis w.r.t. the current ring */
     6361    F = MLifttwoIdeal(Gomega2, M1, G);
     6362    if(endwalks != 1)
     6363      tlift = tlift+clock()-to;
     6364    else
     6365      xtlift=clock()-to;
     6366
     6367//#ifdef CHECK_IDEAL_MWALK
     6368    if(printout > 2)
     6369    {
     6370      idString(F,"//** Mprwalk: F");
     6371    }
     6372//#endif
     6373
     6374    idDelete(&M1);
     6375    idDelete(&Gomega2);
     6376    idDelete(&G);
     6377
     6378    /* change the ring to newRing */
     6379    rChangeCurrRing(newRing);
     6380    F1 = idrMoveR(F, oldRing,currRing);
     6381
     6382    to=clock();
     6383    /* reduce the Groebner basis <G> w.r.t. new ring */
     6384    G = kInterRedCC(F1, NULL);
     6385    if(endwalks != 1)
     6386      tred = tred+clock()-to;
     6387    else
     6388      xtred=clock()-to;
     6389
     6390    idDelete(&F1);
     6391
     6392    if(endwalks == 1)
     6393      break;
     6394
     6395    to=clock();
     6396    // compute a next weight vector
     6397    next_weight = MkInterRedNextWeight(curr_weight,target_weight, G);
     6398    if(polylength > 0)
     6399    {
     6400      //there is a polynomial in Gomega with at least 3 monomials,
     6401      //low-dimensional facet of the cone
     6402      delete next_weight;
     6403      next_weight = MWalkRandomNextWeight(G, curr_weight, target_weight, weight_rad, op_deg);
     6404    }
     6405    tnw=tnw+clock()-to;
     6406//#ifdef PRINT_VECTORS
     6407    if(printout > 2)
     6408    {
     6409      MivString(curr_weight, target_weight, next_weight);
     6410    }
     6411//#endif
     6412
     6413    if(Overflow_Error == TRUE)
     6414    {
     6415      ntwC = 0;
     6416      //ntestomega = 1;
     6417      //Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
     6418      //idElements(G, "G");
     6419      delete next_weight;
     6420      goto FINISH_160302;
     6421    }
     6422    if(MivComp(next_weight, ivNull) == 1){
     6423      newRing = currRing;
     6424      delete next_weight;
     6425      //Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
     6426      break;
     6427    }
     6428    if(MivComp(next_weight, target_weight) == 1)
     6429      endwalks = 1;
     6430
     6431    for(i=nV-1; i>=0; i--)
     6432      (*curr_weight)[i] = (*next_weight)[i];
     6433
     6434    delete next_weight;
     6435  }//while
     6436
     6437  if(tp_deg != 1)
     6438  {
     6439    FINISH_160302:
     6440    if(target_M->length() == nV)
     6441    {
     6442      if(MivSame(orig_target, exivlp) == 1)
     6443        if (rParameter(currRing) != NULL)
     6444          DefRingParlp();
     6445        else
     6446          VMrDefaultlp();
     6447      else
     6448        if (rParameter(currRing) != NULL)
     6449          DefRingPar(orig_target);
     6450        else
     6451          rChangeCurrRing(VMrDefault(orig_target));
     6452    }
     6453    else
     6454    {
     6455      rChangeCurrRing(VMatrDefault(target_M));
     6456    }
     6457    TargetRing=currRing;
     6458    F1 = idrMoveR(G, newRing,currRing);
     6459#ifdef CHECK_IDEAL
     6460      headidString(G, "G");
     6461#endif
     6462
     6463    // check whether the pertubed target vector stays in the correct cone
     6464    if(ntwC != 0){
     6465      ntestw = test_w_in_ConeCC(F1, pert_target_vector);
     6466    }
     6467
     6468    if( ntestw != 1 || ntwC == 0)
     6469    {
     6470      /*
     6471      if(ntestw != 1){
     6472        ivString(pert_target_vector, "tau");
     6473        PrintS("\n// ** perturbed target vector doesn't stay in cone!!");
     6474        Print("\n// ring r%d = %s;\n", nstep, rString(currRing));
     6475        idElements(F1, "G");
     6476      }
     6477      */
     6478      // LastGB is "better" than the kStd subroutine
     6479      to=clock();
     6480      ideal eF1;
     6481      if(nP == 0 || tp_deg == 1 || MivSame(orig_target, exivlp) != 1 || target_M->length() != nV){
     6482        // PrintS("\n// ** calls \"std\" to compute a GB");
     6483        eF1 = MstdCC(F1);
     6484        idDelete(&F1);
     6485      }
     6486      else {
     6487        // PrintS("\n// ** calls \"LastGB\" to compute a GB");
     6488        rChangeCurrRing(newRing);
     6489        ideal F2 = idrMoveR(F1, TargetRing,currRing);
     6490        eF1 = LastGB(F2, curr_weight, tp_deg-1);
     6491        F2=NULL;
     6492      }
     6493      xtextra=clock()-to;
     6494      ring exTargetRing = currRing;
     6495
     6496      rChangeCurrRing(XXRing);
     6497      Eresult = idrMoveR(eF1, exTargetRing,currRing);
     6498    }
     6499    else{
     6500      rChangeCurrRing(XXRing);
     6501      Eresult = idrMoveR(F1, TargetRing,currRing);
     6502    }
     6503  }
     6504  else {
     6505    rChangeCurrRing(XXRing);
     6506    Eresult = idrMoveR(G, newRing,currRing);
     6507  }
     6508  si_opt_1 = save1; //set original options, e. g. option(RedSB)
     6509  delete ivNull;
     6510  if(tp_deg != 1)
     6511    delete target_weight;
     6512
     6513  if(op_deg != 1 )
     6514    delete curr_weight;
     6515
     6516  delete exivlp;
     6517  delete last_omega;
     6518
     6519#ifdef TIME_TEST
     6520  TimeStringFractal(tinput, tostd, tif+xtif, tstd+xtstd,0, tlift+xtlift, tred+xtred,
     6521             tnw+xtnw);
     6522
     6523  //Print("\n// pSetm_Error = (%d)", ErrorCheck());
     6524  //Print("\n// It took %d steps and Overflow_Error? (%d)\n", nstep,  Overflow_Error);
     6525#endif
     6526  Print("\n//** Mprwalk: Perturbation Walk took %d steps.\n", nstep);
    60856527  return(Eresult);
    60866528}
     
    61086550 * Perturb the start weight vector at the top level, i.e. nlev = 1     *
    61096551 ***********************************************************************/
    6110 static ideal rec_fractal_call(ideal G, int nlev, intvec* omtmp)
     6552static ideal rec_fractal_call(ideal G, int nlev, intvec* ivtarget, int printout)
    61116553{
    61126554  Overflow_Error =  FALSE;
     
    61256567  intvec* next_vect;
    61266568  intvec* omega2 = new intvec(nV);
     6569  intvec* omtmp = new intvec(nV);
    61276570  intvec* altomega = new intvec(nV);
    61286571
     6572  for(i = nV -1; i>0; i--)
     6573  {
     6574    (*omtmp)[i] = (*ivtarget)[i];
     6575  }
    61296576  //BOOLEAN isnewtarget = FALSE;
    61306577
     
    61676614    NEXT_VECTOR_FRACTAL:
    61686615    to=clock();
    6169     /* determine the next border */
     6616    // determine the next border
    61706617    next_vect = MkInterRedNextWeight(omega,omega2,G);
    61716618    xtnw=xtnw+clock()-to;
    6172 #ifdef PRINT_VECTORS
    6173     MivString(omega, omega2, next_vect);
    6174 #endif
     6619
    61756620    oRing = currRing;
    61766621
    6177     /* We only perturb the current target vector at the recursion  level 1 */
     6622    // We only perturb the current target vector at the recursion  level 1
    61786623    if(Xngleich == 0 && nlev == 1) //(ngleich == 0) important, e.g. ex2, ex3
    61796624      if (MivComp(next_vect, omega2) == 1)
    61806625      {
    6181         /* to dispense with taking initial (and lifting/interreducing
    6182            after the call of recursion */
    6183         //Print("\n\n// ** Perturb the both vectors with degree %d with",nlev);
    6184         //idElements(G, "G");
     6626        // to dispense with taking initial (and lifting/interreducing
     6627        // after the call of recursion
     6628        if(printout > 0)
     6629        {
     6630          Print("\n//** rec_fractal_call: Perturb the both vectors with degree %d.",nlev);
     6631          //idElements(G, "G");
     6632        }
    61856633
    61866634        Xngleich = 1;
    61876635        nlev +=1;
    61886636
    6189         if (rParameter(currRing) != NULL)
    6190           DefRingPar(omtmp);
     6637        if(ivtarget->length() == nV)
     6638        {
     6639          if (rParameter(currRing) != NULL)
     6640            DefRingPar(omtmp);
     6641          else
     6642            rChangeCurrRing(VMrDefault(omtmp));
     6643        }
    61916644        else
    6192           rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung3
    6193 
     6645        {
     6646          rChangeCurrRing(VMatrDefault(ivtarget));
     6647        }
    61946648        testring = currRing;
    61956649        Gt = idrMoveR(G, oRing,currRing);
    61966650
    6197         /* perturb the original target vector w.r.t. the current GB */
    6198         delete Xtau;
    6199         Xtau = NewVectorlp(Gt);
     6651        // perturb the original target vector w.r.t. the current GB
     6652        if(ivtarget->length() == nV)
     6653        {
     6654          delete Xtau;
     6655          Xtau = NewVectorlp(Gt);
     6656        }
     6657        else
     6658        {
     6659          delete Xtau;
     6660          Xtau = Mfpertvector(Gt,ivtarget);
     6661        }
    62006662
    62016663        rChangeCurrRing(oRing);
    62026664        G = idrMoveR(Gt, testring,currRing);
    62036665
    6204         /* perturb the current vector w.r.t. the current GB */
     6666        // perturb the current vector w.r.t. the current GB
    62056667        Mwlp = MivWeightOrderlp(omega);
    62066668        Xsigma = Mfpertvector(G, Mwlp);
     
    62206682        next_vect = MkInterRedNextWeight(omega,omega2,G);
    62216683        xtnw=xtnw+clock()-to;
    6222 
    6223 #ifdef PRINT_VECTORS
     6684      }
     6685//#ifdef PRINT_VECTORS
     6686      if(printout > 0)
     6687      {
    62246688        MivString(omega, omega2, next_vect);
    6225 #endif
    6226       }
    6227 
     6689      }
     6690//#endif
    62286691
    62296692    /* check whether the the computed vector is in the correct cone */
     
    62346697    {
    62356698      delete next_vect;
    6236       if (rParameter(currRing) != NULL)
    6237       {
    6238         DefRingPar(omtmp);
     6699      if(ivtarget->length() == nV)
     6700      {
     6701        if (rParameter(currRing) != NULL)
     6702          DefRingPar(omtmp);
     6703        else
     6704          rChangeCurrRing(VMrDefault(omtmp));
    62396705      }
    62406706      else
    62416707      {
    6242         rChangeCurrRing(VMrDefault1(omtmp)); // Aenderung4
     6708        rChangeCurrRing(VMatrDefault(ivtarget));
    62436709      }
    62446710#ifdef TEST_OVERFLOW
     
    62466712      Gt = NULL; return(Gt);
    62476713#endif
    6248 
    6249       //Print("\n\n// apply BB's alg. in ring r = %s;", rString(currRing));
     6714      if(printout > 0)
     6715      {
     6716        Print("\n//** rec_fractal_call: applying Buchberger's algorithm in ring r = %s;",
     6717              rString(currRing));
     6718      }
    62506719      to=clock();
    62516720      Gt = idrMoveR(G, oRing,currRing);
     
    62566725      delete omega2;
    62576726      delete altomega;
    6258 
    6259       //Print("\n// Leaving the %d-th recursion with %d steps", nlev, nwalks);
    6260       //Print("  ** Overflow_Error? (%d)", Overflow_Error);
     6727      if(printout > 0)
     6728      {
     6729        Print("\n//** rec_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     6730              nlev, nwalks);
     6731        //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     6732      }
     6733
    62616734      nnflow ++;
    62626735
     
    62756748    if (MivComp(next_vect, XivNull) == 1)
    62766749    {
    6277       if (rParameter(currRing) != NULL)
    6278         DefRingPar(omtmp);
     6750      if(ivtarget->length() == nV)
     6751      {
     6752        if (rParameter(currRing) != NULL)
     6753          DefRingPar(omtmp);
     6754        else
     6755          rChangeCurrRing(VMrDefault(omtmp));
     6756      }
    62796757      else
    6280         rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung5
     6758      {
     6759        rChangeCurrRing(VMatrDefault(ivtarget));
     6760      }
    62816761
    62826762      testring = currRing;
     
    62876767        delete next_vect;
    62886768        delete altomega;
    6289         //Print("\n// Leaving the %d-th recursion with %d steps ",nlev, nwalks);
    6290         //Print(" ** Overflow_Error? (%d)", Overflow_Error);
    6291 
     6769        if(printout > 0)
     6770        {
     6771          Print("\n//** rec_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     6772              nlev, nwalks);
     6773          //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     6774        }
    62926775        return (Gt);
    62936776      }
     
    63006783        //07.08.03
    63016784        //ivString(Xtau, "old Xtau");
    6302         intvec* Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp));
     6785        intvec* Xtautmp;
     6786        if(ivtarget->length() == nV)
     6787        {
     6788          Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp));
     6789        }
     6790        else
     6791        {
     6792          Xtautmp = Mfpertvector(Gt, ivtarget);
     6793        }
    63036794#ifdef TEST_OVERFLOW
    63046795      if(Overflow_Error == TRUE)
     
    63286819
    63296820      FRACTAL_MSTDCC:
    6330         //Print("\n//  apply BB-Alg in ring = %s;", rString(currRing));
     6821        if(printout > 0)
     6822        {
     6823          Print("\n//** rec_fractal_call: apply Buchberger's algorithm in ring = %s.\n",
     6824                rString(currRing));
     6825        }
    63316826        to=clock();
    63326827        G = MstdCC(Gt);
     
    63366831
    63376832        // update the original target vector w.r.t. the current GB
    6338         if(MivSame(Xivinput, Xivlp) == 1)
    6339           if (rParameter(currRing) != NULL)
    6340             DefRingParlp();
     6833        if(ivtarget->length() == nV)
     6834        {
     6835          if(MivSame(Xivinput, Xivlp) == 1)
     6836            if (rParameter(currRing) != NULL)
     6837              DefRingParlp();
     6838            else
     6839              VMrDefaultlp();
    63416840          else
    6342             VMrDefaultlp();
     6841            if (rParameter(currRing) != NULL)
     6842              DefRingPar(Xivinput);
     6843            else
     6844              rChangeCurrRing(VMrDefault(Xivinput));
     6845        }
    63436846        else
    6344           if (rParameter(currRing) != NULL)
    6345             DefRingPar(Xivinput);
    6346           else
    6347             rChangeCurrRing(VMrDefault1(Xivinput)); //Aenderung6
    6348 
     6847        {
     6848          rChangeCurrRing(VMatrRefine(ivtarget,Xivinput));
     6849        }
    63496850        testring = currRing;
    63506851        Gt = idrMoveR(G, oRing,currRing);
     
    63596860        delete next_vect;
    63606861        delete altomega;
    6361         /*
    6362           Print("\n// Leaving the %d-th recursion with %d steps,", nlev,nwalks);
    6363           Print(" ** Overflow_Error? (%d)", Overflow_Error);
    6364         */
     6862        if(printout > 0)
     6863        {
     6864          Print("\n//** rec_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     6865              nlev, nwalks);
     6866          //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     6867        }
    63656868        if(Overflow_Error == TRUE)
    63666869          nnflow ++;
     
    63816884    Gomega = MwalkInitialForm(G, omega);
    63826885    xtif=xtif+clock()-to;
    6383 
     6886    if(printout > 1)
     6887    {
     6888      idString(Gomega,"//** rec_fractal_call: Gomega");
     6889    }
    63846890#ifndef  BUCHBERGER_ALG
    63856891    if(isNolVector(omega) == 0)
     
    63886894      hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
    63896895#endif // BUCHBERGER_ALG
    6390 
    6391     if (rParameter(currRing) != NULL)
    6392       DefRingPar(omega);
     6896    if(ivtarget->length() == nV)
     6897    {
     6898      if (rParameter(currRing) != NULL)
     6899        DefRingPar(omega);
     6900      else
     6901        rChangeCurrRing(VMrDefault(omega));
     6902    }
    63936903    else
    6394       rChangeCurrRing(VMrDefault1(omega)); //Aenderung7
    6395 
     6904    {
     6905      rChangeCurrRing(VMatrRefine(ivtarget,omega));
     6906    }
    63966907    Gomega1 = idrMoveR(Gomega, oRing,currRing);
    63976908
    6398     /* Maximal recursion depth, to compute a red. GB */
    6399     /* Fractal walk with the alternative recursion */
    6400     /* alternative recursion */
     6909    // Maximal recursion depth, to compute a red. GB
     6910    // Fractal walk with the alternative recursion
     6911    // alternative recursion
    64016912    // if(nlev == nV || lengthpoly(Gomega1) == 0)
    64026913    if(nlev == Xnlev || lengthpoly(Gomega1) == 0)
    64036914      //if(nlev == nV) // blind recursion
    64046915    {
    6405       /*
    6406       if(Xnlev != nV)
    6407       {
    6408         Print("\n// ** Xnlev = %d", Xnlev);
    6409         ivString(Xtau, "Xtau");
    6410       }
    6411       */
    64126916      to=clock();
    64136917#ifdef  BUCHBERGER_ALG
     
    64196923      xtstd=xtstd+clock()-to;
    64206924    }
    6421     else {
     6925    else
     6926    {
    64226927      rChangeCurrRing(oRing);
    64236928      Gomega1 = idrMoveR(Gomega1, oRing,currRing);
    6424       Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega);
    6425     }
    6426 
    6427     //convert a Groebner basis from a ring to another ring,
     6929      Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega,printout);
     6930    }
     6931    if(printout > 2)
     6932    {
     6933      idString(Gresult,"//** rec_fractal_call: M");
     6934    }
     6935    //convert a Groebner basis from a ring to another ring
    64286936    new_ring = currRing;
    64296937
     
    64336941
    64346942    to=clock();
    6435     /* Lifting process */
     6943    // Lifting process
    64366944    F = MLifttwoIdeal(Gomega2, Gresult1, G);
    64376945    xtlift=xtlift+clock()-to;
     6946    if(printout > 2)
     6947    {
     6948      idString(F,"//** rec_fractal_call: F");
     6949    }
    64386950    idDelete(&Gresult1);
    64396951    idDelete(&Gomega2);
     
    64546966 * Perturb the start weight vector at the top level with random element *
    64556967 ************************************************************************/
    6456 static ideal rec_r_fractal_call(ideal G, int nlev, intvec* omtmp, int weight_rad)
     6968static ideal rec_r_fractal_call(ideal G, int nlev, intvec* ivtarget,
     6969                int weight_rad, int printout)
    64576970{
    64586971  Overflow_Error =  FALSE;
    64596972  //Print("\n\n// Entering the %d-th recursion:", nlev);
    64606973
    6461   int i, nV = currRing->N;
     6974  int i, polylength, nV = currRing->N;
    64626975  ring new_ring, testring;
    64636976  //ring extoRing;
     
    64716984  intvec* next_vect;
    64726985  intvec* omega2 = new intvec(nV);
     6986  intvec* omtmp = new intvec(nV);
    64736987  intvec* altomega = new intvec(nV);
    64746988
    64756989  //BOOLEAN isnewtarget = FALSE;
    64766990
     6991  for(i = nV -1; i>0; i--)
     6992  {
     6993    (*omtmp)[i] = (*ivtarget)[i];
     6994  }
    64776995  // to avoid (1,0,...,0) as the target vector (Hans)
    64786996  intvec* last_omega = new intvec(nV);
     
    65147032    to=clock();
    65157033    /* determine the next border */
    6516     next_vect = MWalkRandomNextWeight(G, omega,omega2, weight_rad, 1+nlev);
    6517     //next_vect = MkInterRedNextWeight(omega,omega2,G);
     7034    next_vect = MkInterRedNextWeight(omega,omega2,G);
     7035    if(polylength > 0)
     7036    {
     7037      //there is a polynomial in Gomega with at least 3 monomials,
     7038      //low-dimensional facet of the cone
     7039      delete next_vect;
     7040      next_vect = MWalkRandomNextWeight(G,omega,omega2,weight_rad,1+nlev);
     7041      if(isNolVector(next_vect))
     7042      {
     7043        delete next_vect;
     7044        next_vect = MkInterRedNextWeight(omega,omega2,G);
     7045      }
     7046    }
    65187047    xtnw=xtnw+clock()-to;
    6519 #ifdef PRINT_VECTORS
    6520     MivString(omega, omega2, next_vect);
    6521 #endif
     7048
    65227049    oRing = currRing;
    65237050
    6524     /* We only perturb the current target vector at the recursion  level 1 */
     7051    // We only perturb the current target vector at the recursion  level 1
    65257052    if(Xngleich == 0 && nlev == 1) //(ngleich == 0) important, e.g. ex2, ex3
    65267053      if (MivComp(next_vect, omega2) == 1)
    65277054      {
    6528         /* to dispense with taking initial (and lifting/interreducing
    6529            after the call of recursion */
    6530         //Print("\n\n// ** Perturb the both vectors with degree %d with",nlev);
    6531         //idElements(G, "G");
    6532 
     7055        // to dispense with taking initials and lifting/interreducing
     7056        // after the call of recursion.
     7057        if(printout > 0)
     7058        {
     7059          Print("\n//** rec_r_fractal_call: Perturb the both vectors with degree %d.",nlev);
     7060          //idElements(G, "G");
     7061        }
    65337062        Xngleich = 1;
    65347063        nlev +=1;
    6535 
    6536         if (rParameter(currRing) != NULL)
    6537           DefRingPar(omtmp);
     7064        if(ivtarget->length() == nV)
     7065        {
     7066          if (rParameter(currRing) != NULL)
     7067            DefRingPar(omtmp);
     7068          else
     7069            rChangeCurrRing(VMrDefault(omtmp));
     7070        }
    65387071        else
    6539           rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung3
    6540 
     7072        {
     7073          rChangeCurrRing(VMatrDefault(ivtarget));
     7074        }
    65417075        testring = currRing;
    65427076        Gt = idrMoveR(G, oRing,currRing);
    65437077
    6544         /* perturb the original target vector w.r.t. the current GB */
    6545         delete Xtau;
    6546         Xtau = NewVectorlp(Gt);
     7078        // perturb the original target vector w.r.t. the current GB
     7079        if(ivtarget->length() == nV)
     7080        {
     7081          delete Xtau;
     7082          Xtau = NewVectorlp(Gt);
     7083        }
     7084        else
     7085        {
     7086          delete Xtau;
     7087          Xtau = Mfpertvector(Gt,ivtarget);
     7088        }
    65477089
    65487090        rChangeCurrRing(oRing);
    6549         G = idrMoveR(Gt, testring,currRing);
    6550 
    6551         /* perturb the current vector w.r.t. the current GB */
     7091        G = idrMoveR(Gt,testring,currRing);
     7092
     7093        // perturb the current vector w.r.t. the current GB
    65527094        Mwlp = MivWeightOrderlp(omega);
     7095        if(ivtarget->length() > nV)
     7096        {
     7097          delete Mwlp;
     7098          Mwlp = MivMatrixOrderRefine(omega,ivtarget);
     7099        }
    65537100        Xsigma = Mfpertvector(G, Mwlp);
    65547101        delete Mwlp;
     
    65667113
    65677114        next_vect = MkInterRedNextWeight(omega,omega2,G);
     7115        if(polylength > 0)
     7116        {
     7117          //there is a polynomial in Gomega with at least 3 monomials,
     7118          //low-dimensional facet of the cone
     7119          delete next_vect;
     7120          next_vect = MWalkRandomNextWeight(G,omega,omega2,weight_rad,1+nlev);
     7121          if(isNolVector(next_vect))
     7122          {
     7123            delete next_vect;
     7124            next_vect = MkInterRedNextWeight(omega,omega2,G);
     7125          }
     7126        }
    65687127        xtnw=xtnw+clock()-to;
    6569 
    6570 #ifdef PRINT_VECTORS
     7128      }
     7129//#ifdef PRINT_VECTORS
     7130      if(printout > 0)
     7131      {
    65717132        MivString(omega, omega2, next_vect);
    6572 #endif
    6573       }
    6574 
    6575 
    6576     /* check whether the the computed vector is in the correct cone */
    6577     /* If no, the reduced GB of an omega-homogeneous ideal will be
     7133      }
     7134//#endif
     7135
     7136    /* check whether the the computed vector is in the correct cone
     7137       If no, the reduced GB of an omega-homogeneous ideal will be
    65787138       computed by Buchberger algorithm and stop this recursion step*/
    65797139    //if(test_w_in_ConeCC(G, next_vect) != 1) //e.g. Example s7, cyc6
     
    65817141    {
    65827142      delete next_vect;
    6583       if (rParameter(currRing) != NULL)
    6584       {
    6585         DefRingPar(omtmp);
     7143      if(ivtarget->length() == nV)
     7144      {
     7145        if (rParameter(currRing) != NULL)
     7146        {
     7147          DefRingPar(omtmp);
     7148        }
     7149        else
     7150        {
     7151          rChangeCurrRing(VMrDefault(omtmp));
     7152        }
    65867153      }
    65877154      else
    65887155      {
    6589         rChangeCurrRing(VMrDefault1(omtmp)); // Aenderung4
     7156        rChangeCurrRing(VMatrDefault(ivtarget));
    65907157      }
    65917158#ifdef TEST_OVERFLOW
    65927159      Gt = idrMoveR(G, oRing,currRing);
    6593       Gt = NULL; return(Gt);
    6594 #endif
    6595 
    6596       //Print("\n\n// apply BB's alg. in ring r = %s;", rString(currRing));
     7160      Gt = NULL;
     7161      return(Gt);
     7162#endif
     7163      if(printout > 0)
     7164      {
     7165        Print("\n//** rec_r_fractal_call: applying Buchberger's algorithm in ring r = %s;",
     7166              rString(currRing));
     7167      }
    65977168      to=clock();
    65987169      Gt = idrMoveR(G, oRing,currRing);
     
    66037174      delete omega2;
    66047175      delete altomega;
    6605 
    6606       //Print("\n// Leaving the %d-th recursion with %d steps", nlev, nwalks);
    6607       //Print("  ** Overflow_Error? (%d)", Overflow_Error);
     7176      if(printout > 0)
     7177      {
     7178        Print("\n//** rec_r_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     7179              nlev, nwalks);
     7180        //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     7181      }
    66087182      nnflow ++;
    6609 
    66107183      Overflow_Error = FALSE;
    66117184      return (G1);
    66127185    }
    6613 
    6614 
    6615     /* If the perturbed target vector stays in the correct cone,
    6616        return the current GB,
    6617        otherwise, return the computed  GB by the Buchberger-algorithm.
    6618        Then we update the perturbed target vectors w.r.t. this GB. */
    6619 
    6620     /* the computed vector is equal to the origin vector, since
    6621        t is not defined */
     7186    /*
     7187       If the perturbed target vector stays in the correct cone,
     7188       return the current Groebner basis.
     7189       Otherwise, return the Groebner basis computed with Buchberger's
     7190       algorithm.
     7191       Then we update the perturbed target vectors w.r.t. this GB.
     7192    */
    66227193    if (MivComp(next_vect, XivNull) == 1)
    66237194    {
    6624       if (rParameter(currRing) != NULL)
    6625         DefRingPar(omtmp);
     7195      // The computed vector is equal to the origin vector,
     7196      // because t is not defined
     7197      if(ivtarget->length() == nV)
     7198      {
     7199        if (rParameter(currRing) != NULL)
     7200          DefRingPar(omtmp);
     7201        else
     7202          rChangeCurrRing(VMrDefault(omtmp));
     7203      }
    66267204      else
    6627         rChangeCurrRing(VMrDefault1(omtmp)); //Aenderung5
    6628 
     7205      {
     7206        rChangeCurrRing(VMatrDefault(ivtarget));
     7207      }
    66297208      testring = currRing;
    66307209      Gt = idrMoveR(G, oRing,currRing);
    66317210
    6632       if(test_w_in_ConeCC(Gt, omega2) == 1) {
     7211      if(test_w_in_ConeCC(Gt, omega2) == 1)
     7212      {
    66337213        delete omega2;
    66347214        delete next_vect;
    66357215        delete altomega;
    6636         //Print("\n// Leaving the %d-th recursion with %d steps ",nlev, nwalks);
    6637         //Print(" ** Overflow_Error? (%d)", Overflow_Error);
    6638 
     7216        if(printout > 0)
     7217        {
     7218          Print("\n//** rec_r_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     7219                nlev, nwalks);
     7220          //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     7221        }
    66397222        return (Gt);
    66407223      }
    66417224      else
    6642       {
    6643         //ivString(omega2, "tau'");
    6644         //Print("\n//  tau' doesn't stay in the correct cone!!");
    6645 
     7225      {
     7226        if(printout > 0)
     7227        {
     7228          Print("\n//** rec_r_fractal_call: target weight doesn't stay in the correct cone.\n");
     7229        }
    66467230#ifndef  MSTDCC_FRACTAL
    6647         //07.08.03
    66487231        //ivString(Xtau, "old Xtau");
    6649         intvec* Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp));
     7232        intvec* Xtautmp;
     7233        if(ivtarget->length() == nV)
     7234        {
     7235          Xtautmp = Mfpertvector(Gt, MivMatrixOrder(omtmp));
     7236        }
     7237        else
     7238        {
     7239          Xtautmp = Mfpertvector(Gt, ivtarget);
     7240        }
    66507241#ifdef TEST_OVERFLOW
    66517242      if(Overflow_Error == TRUE)
     
    66757266
    66767267      FRACTAL_MSTDCC:
    6677         //Print("\n//  apply BB-Alg in ring = %s;", rString(currRing));
     7268        if(printout > 0)
     7269        {
     7270          Print("\n//** rec_r_fractal_call: apply Buchberge's algorithm in ring = %s.\n",
     7271                rString(currRing));
     7272        }
    66787273        to=clock();
    66797274        G = MstdCC(Gt);
     
    66837278
    66847279        // update the original target vector w.r.t. the current GB
    6685         if(MivSame(Xivinput, Xivlp) == 1)
    6686           if (rParameter(currRing) != NULL)
    6687             DefRingParlp();
     7280        if(ivtarget->length() == nV)
     7281        {
     7282          if(MivSame(Xivinput, Xivlp) == 1)
     7283            if (rParameter(currRing) != NULL)
     7284              DefRingParlp();
     7285            else
     7286              VMrDefaultlp();
    66887287          else
    6689             VMrDefaultlp();
     7288            if (rParameter(currRing) != NULL)
     7289              DefRingPar(Xivinput);
     7290            else
     7291              rChangeCurrRing(VMrDefault(Xivinput));
     7292        }
    66907293        else
    6691           if (rParameter(currRing) != NULL)
    6692             DefRingPar(Xivinput);
    6693           else
    6694             rChangeCurrRing(VMrDefault1(Xivinput)); //Aenderung6
    6695 
     7294        {
     7295          rChangeCurrRing(VMatrRefine(ivtarget,Xivinput));
     7296        }
    66967297        testring = currRing;
    66977298        Gt = idrMoveR(G, oRing,currRing);
     
    67067307        delete next_vect;
    67077308        delete altomega;
    6708         /*
    6709           Print("\n// Leaving the %d-th recursion with %d steps,", nlev,nwalks);
    6710           Print(" ** Overflow_Error? (%d)", Overflow_Error);
    6711         */
     7309        if(printout > 0)
     7310        {
     7311          Print("\n//** rec_r_fractal_call: Leaving the %d-th recursion with %d steps.\n",
     7312                nlev,nwalks);
     7313          //Print(" ** Overflow_Error? (%d)", Overflow_Error);
     7314        }
    67127315        if(Overflow_Error == TRUE)
    67137316          nnflow ++;
     
    67257328
    67267329    to=clock();
    6727     /* Take the initial form of <G> w.r.t. omega */
     7330    // Take the initial form of <G> w.r.t. omega
    67287331    Gomega = MwalkInitialForm(G, omega);
    67297332    xtif=xtif+clock()-to;
    6730 
     7333    //polylength = 1 if there is a polynomial in Gomega with at least 3 monomials and 0 otherwise
     7334    polylength = lengthpoly(Gomega);
     7335    if(printout > 1)
     7336    {
     7337      idString(Gomega,"//** rec_r_fractal_call: Gomega");
     7338    }
    67317339#ifndef  BUCHBERGER_ALG
    67327340    if(isNolVector(omega) == 0)
     
    67347342    else
    67357343      hilb_func = hFirstSeries(Gomega,NULL,NULL,last_omega,currRing);
    6736 #endif // BUCHBERGER_ALG
    6737 
    6738     if (rParameter(currRing) != NULL)
    6739       DefRingPar(omega);
     7344#endif
     7345    if(ivtarget->length() == nV)
     7346    {
     7347      if (rParameter(currRing) != NULL)
     7348        DefRingPar(omega);
     7349      else
     7350        rChangeCurrRing(VMrDefault(omega));
     7351    }
    67407352    else
    6741       rChangeCurrRing(VMrDefault1(omega)); //Aenderung7
    6742 
     7353    {
     7354      rChangeCurrRing(VMatrRefine(ivtarget,omega));
     7355    }
    67437356    Gomega1 = idrMoveR(Gomega, oRing,currRing);
    67447357
    6745     /* Maximal recursion depth, to compute a red. GB */
    6746     /* Fractal walk with the alternative recursion */
    6747     /* alternative recursion */
    6748     // if(nlev == nV || lengthpoly(Gomega1) == 0)
     7358    // Maximal recursion depth, to compute a red. GB
     7359    // Fractal walk with the alternative recursion
     7360    // alternative recursion
    67497361    if(nlev == Xnlev || lengthpoly(Gomega1) == 0)
    6750       //if(nlev == nV) // blind recursion
    6751     {
    6752       /*
    6753       if(Xnlev != nV)
    6754       {
    6755         Print("\n// ** Xnlev = %d", Xnlev);
    6756         ivString(Xtau, "Xtau");
    6757       }
    6758       */
     7362    {
    67597363      to=clock();
    67607364#ifdef  BUCHBERGER_ALG
     
    67637367      Gresult =kStd(Gomega1,NULL,isHomog,NULL,hilb_func,0,NULL,omega);
    67647368      delete hilb_func;
    6765 #endif // BUCHBERGER_ALG
     7369#endif
    67667370      xtstd=xtstd+clock()-to;
    67677371    }
    6768     else {
     7372    else
     7373    {
    67697374      rChangeCurrRing(oRing);
    67707375      Gomega1 = idrMoveR(Gomega1, oRing,currRing);
    6771       Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega);
    6772     }
    6773 
    6774     //convert a Groebner basis from a ring to another ring,
     7376      Gresult = rec_fractal_call(idCopy(Gomega1),nlev+1,omega,printout);
     7377    }
     7378    if(printout > 2)
     7379    {
     7380      idString(Gresult,"//** rec_r_fractal_call: M");
     7381    }
     7382    //convert a Groebner basis from a ring to another ring
    67757383    new_ring = currRing;
    67767384
     
    67807388
    67817389    to=clock();
    6782     /* Lifting process */
     7390    // Lifting process
    67837391    F = MLifttwoIdeal(Gomega2, Gresult1, G);
    67847392    xtlift=xtlift+clock()-to;
     7393
     7394    if(printout > 2)
     7395    {
     7396      idString(F,"//** rec_r_fractal_call: F");
     7397    }
     7398
    67857399    idDelete(&Gresult1);
    67867400    idDelete(&Gomega2);
     
    67917405
    67927406    to=clock();
    6793     /* Interreduce G */
     7407    // Interreduce G
    67947408    G = kInterRedCC(F1, NULL);
    67957409    xtred=xtred+clock()-to;
     
    67977411  }
    67987412}
    6799 
    6800 
    68017413
    68027414
     
    68057417 *                                                                             *
    68067418 * The main procedur Mfwalk calls the recursive Subroutine                     *
    6807  * rec_fractal_call to compute the wanted Grᅵbner basis.                       *
    6808  * At the main procedur we compute the reduced Grᅵbner basis w.r.t. a "fast"   *
     7419 * rec_fractal_call to compute the wanted Groebner basis.                      *
     7420 * At the main procedur we compute the reduced Groebner basis w.r.t. a "fast"  *
    68097421 * order, e.g. "dp" and a sequence of weight vectors which are row vectors     *
    68107422 * of a matrix. This matrix defines the given monomial order, e.g. "lp"        *
    68117423 *******************************************************************************/
    6812 ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget)
     7424ideal Mfwalk(ideal G, intvec* ivstart, intvec* ivtarget,
     7425             int reduction, int printout)
    68137426{
     7427  BITSET save1 = si_opt_1; // save current options
     7428  if(reduction == 0)
     7429  {
     7430    si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
     7431    //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
     7432  }
    68147433  Set_Error(FALSE);
    68157434  Overflow_Error = FALSE;
     
    68467465      intvec* iv_dp = MivUnit(nV); // define (1,1,...,1)
    68477466      intvec* Mdp;
    6848 
    6849       if(MivSame(ivstart, iv_dp) != 1)
    6850         Mdp = MivWeightOrderdp(ivstart);
     7467      if(ivstart->length() == nV)
     7468      {
     7469        if(MivSame(ivstart, iv_dp) != 1)
     7470          Mdp = MivWeightOrderdp(ivstart);
     7471        else
     7472          Mdp = MivMatrixOrderdp(nV);
     7473      }
    68517474      else
    6852         Mdp = MivMatrixOrderdp(nV);
     7475      {
     7476        Mdp = ivstart;
     7477      }
    68537478
    68547479      Xsigma = Mfpertvector(I, Mdp);
     
    68677492  Xivlp = Mivlp(nV);
    68687493
    6869   if(MivComp(ivtarget, Xivlp)  != 1)
    6870   {
    6871     if (rParameter(currRing) != NULL)
    6872       DefRingPar(ivtarget);
     7494  if(ivtarget->length() == nV)
     7495  {
     7496    if(MivComp(ivtarget, Xivlp)  != 1)
     7497    {
     7498      if (rParameter(currRing) != NULL)
     7499        DefRingPar(ivtarget);
     7500      else
     7501        rChangeCurrRing(VMrDefault(ivtarget));
     7502
     7503      I1 = idrMoveR(I, oldRing,currRing);
     7504      Mlp = MivWeightOrderlp(ivtarget);
     7505      Xtau = Mfpertvector(I1, Mlp);
     7506    }
    68737507    else
    6874       rChangeCurrRing(VMrDefault1(ivtarget)); //Aenderung1
    6875 
    6876     I1 = idrMoveR(I, oldRing,currRing);
    6877     Mlp = MivWeightOrderlp(ivtarget);
    6878     Xtau = Mfpertvector(I1, Mlp);
     7508    {
     7509      if (rParameter(currRing) != NULL)
     7510        DefRingParlp();
     7511      else
     7512        VMrDefaultlp();
     7513
     7514      I1 = idrMoveR(I, oldRing,currRing);
     7515      Mlp =  MivMatrixOrderlp(nV);
     7516      Xtau = Mfpertvector(I1, Mlp);
     7517    }
    68797518  }
    68807519  else
    68817520  {
    6882     if (rParameter(currRing) != NULL)
    6883       DefRingParlp();
    6884     else
    6885       VMrDefaultlp();
    6886 
    6887     I1 = idrMoveR(I, oldRing,currRing);
    6888     Mlp =  MivMatrixOrderlp(nV);
     7521    rChangeCurrRing(VMatrDefault(ivtarget));
     7522    I1 = idrMoveR(I,oldRing,currRing);
     7523    Mlp =  ivtarget;
    68897524    Xtau = Mfpertvector(I1, Mlp);
    68907525  }
     
    68977532  id_Delete(&I, oldRing);
    68987533  ring tRing = currRing;
    6899 
    6900   if (rParameter(currRing) != NULL)
    6901     DefRingPar(ivstart);
     7534  if(ivtarget->length() == nV)
     7535  {
     7536    if (rParameter(currRing) != NULL)
     7537      DefRingPar(ivstart);
     7538    else
     7539      rChangeCurrRing(VMrDefault(ivstart));
     7540  }
    69027541  else
    6903     rChangeCurrRing(VMrDefault1(ivstart)); //Aenderung2
     7542  {
     7543    rChangeCurrRing(VMatrDefault(ivstart));
     7544  }
    69047545
    69057546  I = idrMoveR(I1,tRing,currRing);
     
    69127553  ring helpRing = currRing;
    69137554
    6914   J = rec_fractal_call(J, 1, ivtarget);
     7555  J = rec_fractal_call(J,1,ivtarget,printout);
    69157556
    69167557  rChangeCurrRing(oldRing);
     
    69187559  idSkipZeroes(resF);
    69197560
     7561  si_opt_1 = save1; //set original options, e. g. option(RedSB)
    69207562  delete Xivlp;
    69217563  delete Xsigma;
     
    69367578}
    69377579
    6938 ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget,int weight_rad)
     7580/*******************************************************************************
     7581 * The implementation of the fractal walk algorithm with random element        *
     7582 *                                                                             *
     7583 * The main procedur Mfwalk calls the recursive Subroutine                     *
     7584 * rec_r_fractal_call to compute the wanted Groebner basis.                    *
     7585 * At the main procedure we compute the reduced Groebner basis w.r.t. a "fast" *
     7586 * order, e.g. "dp" and a sequence of weight vectors which are row vectors     *
     7587 * of a matrix. This matrix defines the given monomial order, e.g. "lp"        *
     7588 *******************************************************************************/
     7589ideal Mfrwalk(ideal G, intvec* ivstart, intvec* ivtarget,
     7590              int weight_rad, int reduction, int printout)
    69397591{
     7592  BITSET save1 = si_opt_1; // save current options
     7593  if(reduction == 0)
     7594  {
     7595    si_opt_1 &= (~Sy_bit(OPT_REDSB)); // no reduced Groebner basis
     7596    //si_opt_1 &= (~Sy_bit(OPT_REDTAIL)); // not tail reductions
     7597  }
    69407598  Set_Error(FALSE);
    69417599  Overflow_Error = FALSE;
     
    69727630      intvec* iv_dp = MivUnit(nV); // define (1,1,...,1)
    69737631      intvec* Mdp;
    6974 
    6975       if(MivSame(ivstart, iv_dp) != 1)
    6976         Mdp = MivWeightOrderdp(ivstart);
     7632      if(ivstart->length() == nV)
     7633      {
     7634        if(MivSame(ivstart, iv_dp) != 1)
     7635          Mdp = MivWeightOrderdp(ivstart);
     7636        else
     7637          Mdp = MivMatrixOrderdp(nV);
     7638      }
    69777639      else
    6978         Mdp = MivMatrixOrderdp(nV);
     7640      {
     7641        Mdp = ivstart;
     7642      }
    69797643
    69807644      Xsigma = Mfpertvector(I, Mdp);
     
    69937657  Xivlp = Mivlp(nV);
    69947658
    6995   if(MivComp(ivtarget, Xivlp)  != 1)
    6996   {
    6997     if (rParameter(currRing) != NULL)
    6998       DefRingPar(ivtarget);
     7659  if(ivtarget->length() == nV)
     7660  {
     7661    if(MivComp(ivtarget, Xivlp)  != 1)
     7662    {
     7663      if (rParameter(currRing) != NULL)
     7664        DefRingPar(ivtarget);
     7665      else
     7666        rChangeCurrRing(VMrDefault(ivtarget));
     7667
     7668      I1 = idrMoveR(I, oldRing,currRing);
     7669      Mlp = MivWeightOrderlp(ivtarget);
     7670      Xtau = Mfpertvector(I1, Mlp);
     7671    }
    69997672    else
    7000       rChangeCurrRing(VMrDefault1(ivtarget)); //Aenderung1
    7001 
    7002     I1 = idrMoveR(I, oldRing,currRing);
    7003     Mlp = MivWeightOrderlp(ivtarget);
    7004     Xtau = Mfpertvector(I1, Mlp);
     7673    {
     7674      if (rParameter(currRing) != NULL)
     7675        DefRingParlp();
     7676      else
     7677        VMrDefaultlp();
     7678
     7679      I1 = idrMoveR(I, oldRing,currRing);
     7680      Mlp =  MivMatrixOrderlp(nV);
     7681      Xtau = Mfpertvector(I1, Mlp);
     7682    }
    70057683  }
    70067684  else
    70077685  {
    7008     if (rParameter(currRing) != NULL)
    7009       DefRingParlp();
    7010     else
    7011       VMrDefaultlp();
    7012 
    7013     I1 = idrMoveR(I, oldRing,currRing);
    7014     Mlp =  MivMatrixOrderlp(nV);
     7686    rChangeCurrRing(VMatrDefault(ivtarget));
     7687    I1 = idrMoveR(I,oldRing,currRing);
     7688    Mlp =  ivtarget;
    70157689    Xtau = Mfpertvector(I1, Mlp);
    70167690  }
     
    70237697  id_Delete(&I, oldRing);
    70247698  ring tRing = currRing;
    7025 
    7026   if (rParameter(currRing) != NULL)
    7027     DefRingPar(ivstart);
     7699  if(ivtarget->length() == nV)
     7700  {
     7701    if (rParameter(currRing) != NULL)
     7702      DefRingPar(ivstart);
     7703    else
     7704      rChangeCurrRing(VMrDefault(ivstart));
     7705  }
    70287706  else
    7029     rChangeCurrRing(VMrDefault1(ivstart)); //Aenderung2
     7707  {
     7708    rChangeCurrRing(VMatrDefault(ivstart));
     7709  }
    70307710
    70317711  I = idrMoveR(I1,tRing,currRing);
     
    70377717  ideal resF;
    70387718  ring helpRing = currRing;
    7039 //ideal G, int nlev, intvec* omtmp, int weight_rad)
    7040   J = rec_r_fractal_call(J, 1, ivtarget,weight_rad);
     7719
     7720  J = rec_r_fractal_call(J,1,ivtarget,weight_rad,printout);
    70417721
    70427722  rChangeCurrRing(oldRing);
     
    70447724  idSkipZeroes(resF);
    70457725
     7726  si_opt_1 = save1; //set original options, e. g. option(RedSB)
    70467727  delete Xivlp;
    70477728  delete Xsigma;
     
    70997780  intvec* hilb_func;
    71007781#endif
    7101   /* to avoid (1,0,...,0) as the target vector */
     7782  // to avoid (1,0,...,0) as the target vector
    71027783  intvec* last_omega = new intvec(nV);
    71037784  for(i=nV-1; i>0; i--)
     
    71147795
    71157796  to=clock();
    7116   /* compute a red. GB w.r.t. the help ring */
     7797  // compute a red. GB w.r.t. the help ring
    71177798  if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) = "dp"
    71187799    G = MstdCC(G);
     
    71237804      DefRingPar(curr_weight);
    71247805    else
    7125       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 4
     7806      rChangeCurrRing(VMrDefault(curr_weight));
    71267807    G = idrMoveR(G, XXRing,currRing);
    71277808    G = MstdCC(G);
     
    71497830      DefRingPar(curr_weight);
    71507831    else
    7151       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 5
     7832      rChangeCurrRing(VMrDefault(curr_weight));
    71527833    to=clock();
    71537834    Gw = idrMoveR(G, exring,currRing);
     
    71847865      DefRingPar(curr_weight);
    71857866    else
    7186       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 6
     7867      rChangeCurrRing(VMrDefault(curr_weight));
    71877868
    71887869    newRing = currRing;
     
    72697950          DefRingPar(target_tmp);
    72707951        else
    7271           rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 8
     7952          rChangeCurrRing(VMrDefault(target_tmp));
    72727953
    72737954      lpRing = currRing;
     
    73298010          DefRingPar(target_tmp);
    73308011        else
    7331           rChangeCurrRing(VMrDefault(target_tmp)); //Aenderung 9
     8012          rChangeCurrRing(VMrDefault(target_tmp));
    73328013
    73338014      lpRing = currRing;
     
    75328213    else
    75338214    {
    7534       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 10
     8215      rChangeCurrRing(VMrDefault(curr_weight));
    75358216    }
    75368217    G = idrMoveR(G, XXRing,currRing);
     
    75658246    else
    75668247    {
    7567       rChangeCurrRing(VMrDefault(curr_weight)); //Aenderung 11
     8248      rChangeCurrRing(VMrDefault(curr_weight));
    75688249    }
    75698250    to=clock();
     
    76088289    else
    76098290    {
    7610       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 12
     8291      rChangeCurrRing(VMrDefault(curr_weight));
    76118292    }
    76128293    newRing = currRing;
     
    77778458        else
    77788459        {
    7779           rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 13
     8460          rChangeCurrRing(VMrDefault(target_tmp));
    77808461        }
    77818462      }
     
    78508531        else
    78518532        {
    7852           rChangeCurrRing(VMrDefault(target_tmp)); // Aenderung 14
     8533          rChangeCurrRing(VMrDefault(target_tmp));
    78538534        }
    78548535      }
     
    80938774    else
    80948775    {
    8095       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 15
     8776      rChangeCurrRing(VMrDefault(curr_weight));
    80968777    }
    80978778    newRing = currRing;
     
    82358916
    82368917  //Print("\n// \"Mpwalk\" (1,%d) took %d steps and %.2f sec. Overflow_Error (%d)", tp_deg, nwalk, ((double) clock()-tinput)/1000000, nOverflow_Error);
     8918<<<<<<< HEAD
     8919=======
    82378920
    82388921  return(result);
     
    84219104    delete next_weight;
    84229105  } //end of while-loop
     9106>>>>>>> f533f6f7667328bccb271b19b2f603aaebe41596
    84239107  Print("\n// Mprwalk took %d steps. Ring= %s;\n", nwalk, rString(currRing));
    8424   idSkipZeroes(G);
    8425   si_opt_1 = save1; //set original options, e. g. option(RedSB)
    8426   baseRing = currRing;
    8427   rChangeCurrRing(XXRing);
    8428   ideal Res = idrMoveR(G,baseRing,currRing);
    8429   delete tmp_weight;
    8430   delete ivNull;
    8431   delete exivlp;
    8432 #ifndef BUCHBERGER_ALG
    8433   delete last_omega;
    8434 #endif
    8435 #ifdef TIME_TEST
    8436   TimeString(tinput, tostd, tif, tstd, tlift, tred, tnw, nstep);
    8437 #endif
    8438   return(Res);
     9108  return(result);
    84399109}
    84409110
     
    85159185        else
    85169186        {
    8517           rChangeCurrRing(VMrDefault(cw_tmp)); // Aenderung 16
     9187          rChangeCurrRing(VMrDefault(cw_tmp));
    85189188        }
    85199189        G = idrMoveR(Go, XXRing,currRing);
     
    85899259    else
    85909260    {
    8591       rChangeCurrRing(VMrDefault(curr_weight)); // Aenderung 17
     9261      rChangeCurrRing(VMrDefault(curr_weight));
    85929262    }
    85939263    newRing = currRing;
     
    86519321      else
    86529322      {
    8653         rChangeCurrRing(VMrDefault(target_weight)); // Aenderung 18
     9323        rChangeCurrRing(VMrDefault(target_weight));
    86549324      }
    86559325      F1 = idrMoveR(G, newRing,currRing);
  • Singular/walk.h

    • Property mode changed from 100644 to 100755
    r4e3305 rca3864  
    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/std_l.res.gz.uu

    r4083fa rca3864  
    1 begin 644 std_l.res.gz
    2 M'XL(")L9OU```W-T9%]L+G)E<P#L_5N3),F5'@B^YZ_P!45F*\+2T:%V<8]@
    3 M-R"R2[Y09&5>."+[$)+5`@+%9J$+!1`HDNC9F?^^;F9Z.9?O'#7W\(CTR-!Z
    4 MR`HWO1\]>F[ZJ>I__C_^XW_ZWW>[7?CM[A_^8?>W7_[PSS_]^I>__;+;[W<_
    5 M_?GG?]G]\L/??OG;[K_^^:]SVJ?_''/WOYYS_X^__?"WW5]__V^__^G'W^]^
    6 M^/OO_O27GTX?_NM?__RGW7_ZS__Y__4?_I]/C[N__.XO/_PUEQM^O<M_C[_>
    7 M_7_^T_][]ZM3:[_^Z<?_\JM_S"G3;W>GC__\X\\__O+=W3]^FO^_^^UO8^=^
    8 M_N%__?IOO_SNEYS[\-M2Y_'7N[_\]<^_W_WI;S_\\M<??_Z7[W[\^9?=[__;
    9 M[_[ZN]]_WLU___P_/Y_JF9-V?_[K'WZ8_[C+I1]_O?O_Y1]/OS[]\\/??_C]
    10 M__CEA^]^M93XZ^XWNU_MNEC!=VN]=Z</O_K\]^_"KW]-TG[^G\OWN\]S@51G
    11 M"'.=J=TY_1]_=?>/N?=AF)/_]8<?_K*VE@D2IE_O_N_\@XPWI/'^L$["/_^X
    12 M#/C'=:R___.?_O*W/+I`1Q>6T<V9_OAY]Z^?=S_EMOJECW_Y\T__MOO+Y]U_
    13 M+]_)U/73G&?FB>_^^)OPC[L__M-OEK9.?W5=;K`_SKERD_W2Y&[WWT]$#+G:
    14 M(:Q??SI]_6/Y.JQ?ER;^=6[B7__I-S^>_B75#].:)S<P'-</:Q/_?7?_/W_W
    15 MU^]^NBN5/J7TN;&?3N1?.YW2Q]B53.DQ]N(OI^Q_.64OQ!B7MDO&I>6__O#+
    16 M__CKS[OO_E*:')_(Q$T/OSWERK]"G+J_HJD[=?UO:!*GGDSB-%B3.$UX$J=C
    17 MF<3I:<LD'@*;Q,.`)O$PH4D\'.N3>'@2DW@,_B0>AY3^XW_=?7=J\#<+K7*%
    18 MQRFEERHS7ZP]+/T^9H[(D_28V__AI[_]D+\.JM;'B=<Z\U.I^?&H:WX2[/44
    19 M+/9Z&AA[/4T&>ST="7L]/1:Y\/0DF&L5A`97A8>'PE7A8>G6CW_XX7<_G?[]
    20 MQ_PY,]N/Y=O2L?SKF!GJQWFV?_RGN;W3_\M\AX<GRDXA1!+\^(?G'[^<R$#6
    21 MPN?8V[6GN<G`2!-FR9C_9JOPQS^00F09AOXATRGT:1'^R]HPH=)//YZ4X+_+
    22 M'>_)P@O]2HL3`\YY=_^T"R7?Q`;81SY8\OUFU^<NK=(P=VH5@WEF=BM7Y]RK
    23 M/(QZZU]__/D/LR+Z^5<EG9!A%8-SY_[VX__YPW?_[F[WV]U#[M_`)R#)O#G[
    24 M+__VEQ_^_%^_^W?/X<O=O*Y^M;;WJUPVR<-2.J^!N?Q<<"GWUU_M_J__:Y=_
    25 M_C=20UX6I8Z\!G=I9'/)/+0I+\A,K(G)@#+*,@N3D@)A(E*`C;:/HST1_U>[
    26 M_^U_V\U?YLKRW__$)$R82(=S[8=0/N[R',[%\T`.0\F2AW*8U.B2V"P?8H-$
    27 M((4D)G,'N%Q44SD/+H]`R\AP%-19)B\3(2@B'!$1'@TBD-E\1$2@HM2:T<<C
    28 M:O")-KCVN^<\V"L>?&*]S'4]#?0SX44RA4\3S9/[_W0$@WI2NJ5_$`9&_\"$
    29 M6?]05G'_D%?QTI'_!QM#S\5HG\1HMGK_Y:<__Y??_?3/LX&:Y&C\E(W>?\R%
    30 M>2?",D;":WTX\L:>:HUUP6ENM2]S<\2L[%?9F>W?__*[ORUE2]$CR?M$M111
    31 M'?_R'=(;_4#,6FH#](/6:ST1I_W`)V)EIIFW\L^?R[QPZ=HGZ4IUXF^44NRE
    32 M7.V+7%UM@_N9K-_]6$8S"AG1)REZ4J1S_;,N_4O./1$A3P:1VY]D^T5\DOKR
    33 MG_NE-^M$WWU/]50_R7Y-6G;U!R&[^B(987-EKI*TS-6OLK+\?"KSMDI(8`WT
    34 MLZC,18[C;TN1*5D#/_S\PU]_]\L/__R_?OCQ7_[;+_]\4H2+9?#'3++CH9@#
    35 M_2H\.0NM`C)J[+_^\+>YCEEI?Y>5=K^*R_QKD-;3'SF7/#++HD\"L=2=_LH^
    36 MZ(^K:TI:9$9'_\1(I(K_<?5@?U4H]T0I]T0H]Y0H]\/??_GAYS_D9?^W[Q8S
    37 MZL_SOZOA64CX1$GX!$CXE'W4WV<6&!Z*H=27C]0\^C/)/-'O)/^1?A_*]Z7%
    38 MI<L_9V=J6*5KS%TX8O[U&\@J?[PK99>>_3F<<BY$(+IP6"5M5GA+.E-Z`Y>\
    39 M0Y*\?^YS=44Y#3U9Y;S"/E?8BY4^]'FE_WG(E0ZD4K&@AUXOZ&$0"WH8!E`K
    40 MZ>H@UO$PL'4\K&*4-C$R-W1($G.E1)GP)#C79LEW7G^Q.=.7543^PS_L?O>'
    41 M/\0YSG&:OY5<ZVPN#!*'=5HB\_^^^]7_]R]S](>QQ^?=K_Z7_EJ88RIJ9DB2
    42 M,_\NWGE2'&12F608N(\^)''Z\^R6_OQ3ZN$Z"S]^.?7JN__P>>Y6^K(N\_G[
    43 M[]'W7"^S?O)_)Y$FRGS^#VMMZOOOB3`9N.P>B.P>CG0V3G+E#__C]V0Z<J[L
    44 MA?V1K9HC$Y1#,FU_/R_"/^[^\./_+&[8D.S8N993AF[)]9LBI89'R=O%@OW]
    45 MS'Q$-#U*KDXBFC+RHPAX#,4<C?71.,*0K-)<9S)!Q>1&8L^%US]3B#+$,.2O
    46 MNGFQR-1^3273Y=<PV#64B4WF\#Q_/__A\ZP3_OJ[M*C^YP^__^7/?\U9GXS1
    47 M_$XMFU65[>`P-G9Q'N12,13:^W"7F]"5T"8TC305Q@=FYXX/Q<X='U@\Y^>?
    48 M2*$CR46"%F,H08LQI*#%G_ZMA.3'0`(48\A&[2\SU__RXY]^R-'D<=4[?_CA
    49 MOYYLK'\^:?U3AE,]J[-8,BV36$J?K+Y?0DG-JCFKZW'5/[':Q=#^36R`*+VQ
    50 M5V;.*M?6G%RPC3R8,B9EQ.I?_NI22S^2ELC2)DV<LC"=.&;M5:3O6!383S_\
    51 M[@^DY&?QX406D>.41;26>R35WCAH`3$.0D",8Q80>HRC$`\C#TR/J]Z+5"JE
    52 MEB:6'99_^?G/?_WANU].#MNOYFDF_+MJ1)+I3S_\Z<]__;?OPKREL?Y-<Q/+
    53 M<)R*93A.Q*;^_9__\F_Y.['^QE7YK:PC(@;CE%GM9^&.CX=L"_[XN<2=QU7_
    54 M_>FD-7[Z8?>G\ID&*\=5^^1?AK:=W0;&D4>F:L<4=?G3&KY<PIBYP11F82'V
    55 MGUEX?4S*J=2839-8YY]6Y7DBWVR0W^]$(X\BIC`^,G=^?&2RYD]EQAY)['A\
    56 M?"1;$^-C4<7CTT.<OWGS;;7N?SBQX>]^_I<?%I=HWNQ;+?M?_AQ#RW&W;;7\
    57 MD]+.(Y[U71[M4Y]F\%_I##Z-V0[/QE:JJ&0ZS)E(\&'6GDO;)<MC'L@TQ[CS
    58 M7L3<ZV4[XI<_L_V(Z:&G\SL]C-&>C+U0[DW^Z_/N7S-MIX>#FOG=/_UFQPRX
    59 M/])6'SD73.$A<8&(HV1K^H^9!:;0I\QY!:5P]HFJP^<Y&%;Z%L;,8+/ZH)[Q
    60 M%`X\+:[94Y[/)X%)\CVF?/_ZXT\_J4#-U#\4NO>Y=TOXX;?93IOZW),\[CYW
    61 M``UF'];A_#<RG/ZQE-`#&AYDJC6DH2\Y\:"&W-W_.W\Z_%I\>*2+;QH??DU^
    62 MA"P5I[$GJ^KRQ33-\C\3;QS18IK&0WTQ3>-C;3%-TP.1F-/4;UE.T\B6TW3F
    63 MNICDNCB<LRX.9ZV+@[,N#@>?WP]$SAP?+'X_]HK?C^.Y_'X\>/Q^?*QQ\>.#
    64 MXN+'7G#QX\BX^/%`N/CQ6+CX\=3:S&Z<;8;^X6$H[3W]-H5.])3]Z@]_R<&I
    65 MZ:F8N-.L)/[A'_[\EU]^_///WYT6RB]EB+/*B`FS67*BVH\__T"2!U++:1P+
    66 MQXN6_Q:;/I'VI^7?_[C^_;?YWS\L__['OY&.3:3*0YGIV<\!6K'_O#M\7JF@
    67 MPN!S0/KO)Q.J^_MW)P.TOU_^GO]W^G5REXJU]>]G:VSW[__][D^_^]/O_M?_
    68 M^.7__/</(L-J@K$L_?CP.(Z/2POWL\%P<DO6-I9?)Q=F_$1^]W?=2%-C1VA:
    69 MG]*NW+L]&?_^BN/O3^9/?^GX]VS\^^N/O_3NM>9?CY^,2(U>SW?AA=<<_=O-
    70 M_MX9_MX9_CN>_.>YVB^[Y[G:+Z<Q/[.&/N<.?'E7DYI&M1?#VI-A[5]C6&^W
    71 M4F])4G^-M?JA)?5IQ/MP>'@(=-"<"$M?H/".O8PI[Y,!SB;`GA%@_WH$:!*@
    72 M28!FJS5;K=EJS59KDKI)ZF:K-5NM28`/+0&:K=9LM6:KW?!D-4G=)'6SU6[9
    73 M5NO71C^MK75K=Z[<`ET!O5@!QBKOG-5QY=[MR?CWMS+^/5?EKSG^MYM_S?D]