Changeset df9f881 in git


Ignore:
Timestamp:
Oct 8, 2010, 3:37:40 PM (14 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38077648e7239f98078663eb941c3c979511150a')
Children:
39db9ff02d796a352e21e6c0a8ebac451b0e205c
Parents:
6c4bd6daa63b3045452ebf8a622b371160c5e243
Message:
*levandov: implemented critics by T. Markwig and minor changes

git-svn-id: file:///usr/local/Singular/svn/trunk@13429 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/fpadim.lib

    r6c4bd6 rdf9f881  
    66AUTHORS: Grischa Studzinski,       grischa.studzinski@rwth-aachen.de
    77
    8 Support: Projects LE 2697/2-1; KR 1907/3-1 of the Priority Programme SPP 1489:
     8Support: Joint projects LE 2697/2-1 and KR 1907/3-1 of the Priority Programme SPP 1489:
    99@* 'Algorithmische und Experimentelle Methoden in Algebra, Geometrie und Zahlentheorie'
    1010@* of the German DFG
     
    3838@*      on. The monomial x_1*x_3*x_2 for example will be stored as (1,3,2).
    3939@*      Multiplication is concatenation. Note that there is no algorithm for
    40 @*      computing the normalform yet, but for our case it is not needed.
     40@*      computing the normal form yet, but for our case it is not needed.
    4141@*
    4242
    43 REFERENCES:
     43References:
     44
    4445@*   [ufna] Ufnarovskij: Combinatorical and asymptotic methods in algebra, 1990
    4546@*   [lls] Levandovskyy, La Scala: Letterplace ideals and non-commutative
    46            Groebner bases, 2009
     47          Groebner bases, 2009
    4748@*   [studzins] Studzinski: Dimension computations in non-commutative,
    48                       associative algebras, Diploma thesis, RWTH Aachen, 2010
     49                     associative algebras, Diploma thesis, RWTH Aachen, 2010
    4950
    5051Assumptions:
     
    5253@* - all intvecs correspond to Letterplace monomials
    5354@* - if you specify a different degree bound d,
    54       d <= attrib(basering,uptodeg) holds
     55     d <= attrib(basering,uptodeg) holds
    5556@* In the procedures below, 'iv' stands for intvec representation
    56    and 'lp' for the letterplace representation of monomials
     57  and 'lp' for the letterplace representation of monomials
    5758
    5859PROCEDURES:
     
    105106"
    106107{int i,j,r;
    107  intvec V;
    108  for (i = 1; i <= size(P); i++) {if (P[i] == 1){ j = i; break;}}
    109  V = L[j][1..nrows(L[j]),1];
    110  for (i = 1; i <= n; i++) {if (isInVec(i,V) == 0) {r = 1; break;}}
    111  if (r == 0) {return(1);}
    112  else {return(0);}
     108  intvec V;
     109  for (i = 1; i <= size(P); i++) {if (P[i] == 1){ j = i; break;}}
     110  V = L[j][1..nrows(L[j]),1];
     111  for (i = 1; i <= n; i++) {if (isInVec(i,V) == 0) {r = 1; break;}}
     112  if (r == 0) {return(1);}
     113  else {return(0);}
    113114}
    114115
     
    117118"
    118119{if (typeof(attrib(basering,"isLetterplaceRing"))=="string") {ERROR("Basering is not a Letterplace ring!");}
    119  if (d > attrib(basering,"uptodeg")) {ERROR("Specified degree bound exceeds ring parameter!");}
    120  int i;
    121  for (i = 1; i <= size(L); i++)
    122  {if (entryViolation(L[i], attrib(basering,"lV")))
    123   {ERROR("Not allowed monomial/intvec found!");}
    124  }
    125  return();
     120  if (d > attrib(basering,"uptodeg")) {ERROR("Specified degree bound exceeds ring parameter!");}
     121  int i;
     122  for (i = 1; i <= size(L); i++)
     123  {if (entryViolation(L[i], attrib(basering,"lV")))
     124    {ERROR("Not allowed monomial/intvec found!");}
     125  }
     126  return();
    126127}
    127128
     
    133134"
    134135{intmat M[(n^d)][d];
    135  int i1,i2,i3,i4;
    136  for (i1 = 1; i1 <= d; i1++)  //Spalten
    137  {i2 = 1; //durchlaeuft Zeilen
    138   while (i2 <= (n^d))
    139   {for (i3 = 1; i3 <= n; i3++)
    140    {for (i4 = 1; i4 <= (n^(i1-1)); i4++)
    141     {M[i2,i1] = i3;
    142      i2 = i2 + 1;
    143     }
    144    }
    145   }
    146  }
    147  return(M);
     136  int i1,i2,i3,i4;
     137  for (i1 = 1; i1 <= d; i1++)  //Spalten
     138  {i2 = 1; //durchlaeuft Zeilen
     139    while (i2 <= (n^d))
     140    {for (i3 = 1; i3 <= n; i3++)
     141      {for (i4 = 1; i4 <= (n^(i1-1)); i4++)
     142        {M[i2,i1] = i3;
     143          i2 = i2 + 1;
     144        }
     145      }
     146    }
     147  }
     148  return(M);
    148149}
    149150
     
    153154"
    154155{int i;
    155  intvec V,Vt;
    156  V = M[(1..nrows(M)),1];
    157  for (i = 1; i <= size(V); i++) {if (isInVec(i,V) == 0) {Vt = Vt,i;}}
    158  if (Vt == 0) {intmat S; return(S);}
    159  else {Vt = Vt[2..size(Vt)]; intmat S [size(Vt)][1]; S[1..size(Vt),1] = Vt; return(S);}
     156  intvec V,Vt;
     157  V = M[(1..nrows(M)),1];
     158  for (i = 1; i <= size(V); i++) {if (isInVec(i,V) == 0) {Vt = Vt,i;}}
     159  if (Vt == 0) {intmat S; return(S);}
     160  else {Vt = Vt[2..size(Vt)]; intmat S [size(Vt)][1]; S[1..size(Vt),1] = Vt; return(S);}
    160161}
    161162
     
    164165"
    165166{int i,j;
    166  for (i = 1; i <= nrows(M); i++)
    167  {for (j = 1; j <= ncols(M); j++)
    168   {if(!((1<=M[i,j])&&(M[i,j]<=n))) {return(1);}}
    169  }
    170  return(0);
     167  for (i = 1; i <= nrows(M); i++)
     168  {for (j = 1; j <= ncols(M); j++)
     169    {if(!((1<=M[i,j])&&(M[i,j]<=n))) {return(1);}}
     170  }
     171  return(0);
    171172}
    172173
     
    178179"
    179180{int degbound = 0;
    180  if (size(#) > 0) {if (#[1] > 0) {degbound = #[1];}}
    181  int dimen,i,j,w,it;
    182  intvec Vt,Vt2;
    183  module M;
    184  if (degbound == 0)
    185  {for (i = 1; i <= n; i++)
    186   {Vt = V, i; w = 0;
    187    for (j = 1; j<= size(P); j++)
    188    {if (P[j] <= size(Vt))
    189     {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    190      if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    191     }
    192    }
    193     if (w == 0)
    194     {vector Vtt;
    195      for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    196      M = M,Vtt;
    197      kill Vtt;
    198     }
    199   }
    200   if (size(M) == 0) {return(0);}
     181  if (size(#) > 0) {if (#[1] > 0) {degbound = #[1];}}
     182  int dimen,i,j,w,it;
     183  intvec Vt,Vt2;
     184  module M;
     185  if (degbound == 0)
     186  {for (i = 1; i <= n; i++)
     187    {Vt = V, i; w = 0;
     188      for (j = 1; j<= size(P); j++)
     189      {if (P[j] <= size(Vt))
     190        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     191          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     192        }
     193      }
     194      if (w == 0)
     195      {vector Vtt;
     196        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     197        M = M,Vtt;
     198        kill Vtt;
     199      }
     200    }
     201    if (size(M) == 0) {return(0);}
     202    else
     203    {M = simplify(M,2);
     204      for (i = 1; i <= size(M); i++)
     205      {kill Vt; intvec Vt;
     206        for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
     207        dimen = dimen + 1 + findDimen(Vt,n,L,P);
     208      }
     209      return(dimen);
     210    }
     211  }
    201212  else
    202   {M = simplify(M,2);
    203    for (i = 1; i <= size(M); i++)
    204    {kill Vt; intvec Vt;
    205     for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
    206     dimen = dimen + 1 + findDimen(Vt,n,L,P);
    207    }
    208    return(dimen);
    209   }
    210  }
    211  else
    212  {if (size(V) > degbound) {ERROR("monomial exceeds degreebound");}
    213   if (size(V) == degbound) {return(0);}
    214   for (i = 1; i <= n; i++)
    215   {Vt = V, i; w = 0;
    216    for (j = 1; j<= size(P); j++)
    217    {if (P[j] <= size(Vt))
    218     {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    219      if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    220     }
    221    }
    222     if (w == 0) {vector Vtt;
    223      for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    224      M = M,Vtt;
    225      kill Vtt;
    226     }
    227   }
    228   if (size(M) == 0) {return(0);}
    229   else
    230   {M = simplify(M,2);
    231    for (i = 1; i <= size(M); i++)
    232    {kill Vt; intvec Vt;
    233     for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
    234     dimen = dimen + 1 + findDimen(Vt,n,L,P,degbound);
    235    }
    236    return(dimen);
    237   }
    238  }
     213  {if (size(V) > degbound) {ERROR("monomial exceeds degreebound");}
     214    if (size(V) == degbound) {return(0);}
     215    for (i = 1; i <= n; i++)
     216    {Vt = V, i; w = 0;
     217      for (j = 1; j<= size(P); j++)
     218      {if (P[j] <= size(Vt))
     219        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     220          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     221        }
     222      }
     223      if (w == 0) {vector Vtt;
     224        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     225        M = M,Vtt;
     226        kill Vtt;
     227      }
     228    }
     229    if (size(M) == 0) {return(0);}
     230    else
     231    {M = simplify(M,2);
     232      for (i = 1; i <= size(M); i++)
     233      {kill Vt; intvec Vt;
     234        for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
     235        dimen = dimen + 1 + findDimen(Vt,n,L,P,degbound);
     236      }
     237      return(dimen);
     238    }
     239  }
    239240}
    240241
     
    245246"
    246247{int i,j,w,r;intvec Vt,Vt2;
    247  int it, it2;
    248  if (size(V) < ld)
    249  {for (i = 1; i <= n; i++)
    250   {Vt = V,i; w = 0;
    251    for (j = 1; j <= size(P); j++)
    252    {if (P[j] <= size(Vt))
    253     {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    254      if (isInMat(Vt2,L[j]) > 0)
    255      {w = 1; break;}
    256     }
    257    }
    258    if (w == 0) {r = findCycle(Vt,L,P,n,ld,M);}
    259    if (r == 1) {break;}
    260   }
    261   return(r);
    262  }
    263  else
    264  {j = size(M);
    265   if (j > 0)
    266   {
    267    intmat Mt[j][nrows(M)];
    268    for (it = 1; it <= j; it++)
    269    { for(it2 = 1; it2 <= nrows(M);it2++)
    270      {Mt[it,it2] = int(leadcoef(M[it2,it]));}
    271    }
    272    Vt = V[(size(V)-ld+1)..size(V)];
    273    //Mt; type(Mt);Vt;type(Vt);
    274    if (isInMat(Vt,Mt) > 0) {return(1);}
    275    else
    276    {vector Vtt;
    277     for (it =1; it <= size(Vt); it++)
    278      {Vtt = Vtt + Vt[it]*gen(it);}
    279     M = M,Vtt;
    280     kill Vtt;
    281     for (i = 1; i <= n; i++)
     248  int it, it2;
     249  if (size(V) < ld)
     250  {for (i = 1; i <= n; i++)
    282251    {Vt = V,i; w = 0;
    283      for (j = 1; j <= size(P); j++)
    284      {if (P[j] <= size(Vt))
    285       {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    286       //L[j]; type(L[j]);Vt2;type(Vt2);
    287        if (isInMat(Vt2,L[j]) > 0)
    288        {w = 1; break;}
    289       }
    290      }
    291      if (w == 0) {r = findCycle(Vt,L,P,n,ld,M);}
    292      if (r == 1) {break;}
     252      for (j = 1; j <= size(P); j++)
     253      {if (P[j] <= size(Vt))
     254        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     255          if (isInMat(Vt2,L[j]) > 0)
     256          {w = 1; break;}
     257        }
     258      }
     259      if (w == 0) {r = findCycle(Vt,L,P,n,ld,M);}
     260      if (r == 1) {break;}
    293261    }
    294262    return(r);
    295    }
    296263  }
    297264  else
    298   { Vt = V[(size(V)-ld+1)..size(V)];
    299     vector Vtt;
    300     for (it = 1; it <= size(Vt); it++)
    301      {Vtt = Vtt + Vt[it]*gen(it);}
    302     M = Vtt;
    303     kill Vtt;
    304     for (i = 1; i <= n; i++)
    305     {Vt = V,i; w = 0;
    306      for (j = 1; j <= size(P); j++)
    307      {if (P[j] <= size(Vt))
    308       {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    309       //L[j]; type(L[j]);Vt2;type(Vt2);
    310        if (isInMat(Vt2,L[j]) > 0)
    311        {w = 1; break;}
    312       }
    313      }
    314      if (w == 0) {r = findCycle(Vt,L,P,n,ld,M);}
    315      if (r == 1) {break;}
    316     }
    317     return(r);
    318   }
    319  }
     265  {j = size(M);
     266    if (j > 0)
     267    {
     268      intmat Mt[j][nrows(M)];
     269      for (it = 1; it <= j; it++)
     270      { for(it2 = 1; it2 <= nrows(M);it2++)
     271        {Mt[it,it2] = int(leadcoef(M[it2,it]));}
     272      }
     273      Vt = V[(size(V)-ld+1)..size(V)];
     274      //Mt; type(Mt);Vt;type(Vt);
     275      if (isInMat(Vt,Mt) > 0) {return(1);}
     276      else
     277      {vector Vtt;
     278        for (it =1; it <= size(Vt); it++)
     279        {Vtt = Vtt + Vt[it]*gen(it);}
     280        M = M,Vtt;
     281        kill Vtt;
     282        for (i = 1; i <= n; i++)
     283        {Vt = V,i; w = 0;
     284          for (j = 1; j <= size(P); j++)
     285          {if (P[j] <= size(Vt))
     286            {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     287              //L[j]; type(L[j]);Vt2;type(Vt2);
     288              if (isInMat(Vt2,L[j]) > 0)
     289              {w = 1; break;}
     290            }
     291          }
     292          if (w == 0) {r = findCycle(Vt,L,P,n,ld,M);}
     293          if (r == 1) {break;}
     294        }
     295        return(r);
     296      }
     297    }
     298    else
     299    { Vt = V[(size(V)-ld+1)..size(V)];
     300      vector Vtt;
     301      for (it = 1; it <= size(Vt); it++)
     302      {Vtt = Vtt + Vt[it]*gen(it);}
     303      M = Vtt;
     304      kill Vtt;
     305      for (i = 1; i <= n; i++)
     306      {Vt = V,i; w = 0;
     307        for (j = 1; j <= size(P); j++)
     308        {if (P[j] <= size(Vt))
     309          {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     310            //L[j]; type(L[j]);Vt2;type(Vt2);
     311            if (isInMat(Vt2,L[j]) > 0)
     312            {w = 1; break;}
     313          }
     314        }
     315        if (w == 0) {r = findCycle(Vt,L,P,n,ld,M);}
     316        if (r == 1) {break;}
     317      }
     318      return(r);
     319    }
     320  }
    320321}
    321322
     
    325326PURPOSE:Computing the coefficient of the Hilbert series (upto degree degbound)
    326327NOTE:   Starting with a part of the Hilbert series we change the coefficient
    327 @*      depending on how many baseelements we found on the actual branch
     328@*      depending on how many basis elements we found on the actual branch
    328329"
    329330{int degbound = 0;
    330  if (size(#) > 0){if (#[1] > 0){degbound = #[1];}}
    331  int i,w,j,it;
    332  int h1 = 0;
    333  intvec Vt,Vt2,H1;
    334  module M;
    335  if (degbound == 0)
    336  {for (i = 1; i <= n; i++)
    337   {Vt = V, i; w = 0;
    338    for (j = 1; j<= size(P); j++)
    339    {if (P[j] <= size(Vt))
    340     {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    341      if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    342     }
    343    }
    344     if (w == 0)
    345     {vector Vtt;
    346      for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    347      M = M,Vtt;
    348      kill Vtt;
    349     }
    350   }
    351   if (size(M) == 0) {return(H);}
     331  if (size(#) > 0){if (#[1] > 0){degbound = #[1];}}
     332  int i,w,j,it;
     333  int h1 = 0;
     334  intvec Vt,Vt2,H1;
     335  module M;
     336  if (degbound == 0)
     337  {for (i = 1; i <= n; i++)
     338    {Vt = V, i; w = 0;
     339      for (j = 1; j<= size(P); j++)
     340      {if (P[j] <= size(Vt))
     341        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     342          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     343        }
     344      }
     345      if (w == 0)
     346      {vector Vtt;
     347        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     348        M = M,Vtt;
     349        kill Vtt;
     350      }
     351    }
     352    if (size(M) == 0) {return(H);}
     353    else
     354    {M = simplify(M,2);
     355      for (i = 1; i <= size(M); i++)
     356      {kill Vt; intvec Vt;
     357        for (j =1; j <= size(M[i]); j++) {Vt[j] =  int(leadcoef(M[i][j]));}
     358        h1 = h1 + 1; H1 = findHCoeff(Vt,n,L,P,H1);
     359      }
     360      if (size(H1) < (size(V)+2)) {H1[(size(V)+2)] = h1;}
     361      else {H1[(size(V)+2)] = H1[(size(V)+2)] + h1;}
     362      H1 = H1 + H;
     363      return(H1);
     364    }
     365  }
    352366  else
    353   {M = simplify(M,2);
    354    for (i = 1; i <= size(M); i++)
    355    {kill Vt; intvec Vt;
    356     for (j =1; j <= size(M[i]); j++) {Vt[j] =  int(leadcoef(M[i][j]));}
    357     h1 = h1 + 1; H1 = findHCoeff(Vt,n,L,P,H1);
    358    }
    359    if (size(H1) < (size(V)+2)) {H1[(size(V)+2)] = h1;}
    360    else {H1[(size(V)+2)] = H1[(size(V)+2)] + h1;}
    361    H1 = H1 + H;
    362    return(H1);
    363   }
    364  }
    365  else
    366  {if (size(V) > degbound) {ERROR("monomial exceeds degreebound");}
    367   if (size(V) == degbound) {return(H);}
    368   for (i = 1; i <= n; i++)
    369   {Vt = V, i; w = 0;
    370    for (j = 1; j<= size(P); j++)
    371    {if (P[j] <= size(Vt))
    372     {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    373      if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    374     }
    375    }
    376     if (w == 0)
    377     {vector Vtt;
    378      for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    379      M = M,Vtt;
    380      kill Vtt;
    381     }
    382   }
    383   if (size(M) == 0) {return(H);}
    384   else
    385   {M = simplify(M,2);
    386    for (i = 1; i <= size(M); i++)
    387    {kill Vt; intvec Vt;
    388     for (j =1; j <= size(M[i]); j++)
    389      {Vt[j] =  int(leadcoef(M[i][j]));}
    390     h1 = h1 + 1; H1 = findHCoeff(Vt,n,L,P,H1,degbound);
    391    }
    392    if (size(H1) < (size(V)+2)) { H1[(size(V)+2)] = h1;}
    393    else {H1[(size(V)+2)] = H1[(size(V)+2)] + h1;}
    394    H1 = H1 + H;
    395    return(H1);
    396   }
    397  }
     367  {if (size(V) > degbound) {ERROR("monomial exceeds degreebound");}
     368    if (size(V) == degbound) {return(H);}
     369    for (i = 1; i <= n; i++)
     370    {Vt = V, i; w = 0;
     371      for (j = 1; j<= size(P); j++)
     372      {if (P[j] <= size(Vt))
     373        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     374          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     375        }
     376      }
     377      if (w == 0)
     378      {vector Vtt;
     379        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     380        M = M,Vtt;
     381        kill Vtt;
     382      }
     383    }
     384    if (size(M) == 0) {return(H);}
     385    else
     386    {M = simplify(M,2);
     387      for (i = 1; i <= size(M); i++)
     388      {kill Vt; intvec Vt;
     389        for (j =1; j <= size(M[i]); j++)
     390        {Vt[j] =  int(leadcoef(M[i][j]));}
     391        h1 = h1 + 1; H1 = findHCoeff(Vt,n,L,P,H1,degbound);
     392      }
     393      if (size(H1) < (size(V)+2)) { H1[(size(V)+2)] = h1;}
     394      else {H1[(size(V)+2)] = H1[(size(V)+2)] + h1;}
     395      H1 = H1 + H;
     396      return(H1);
     397    }
     398  }
    398399}
    399400
     
    406407"
    407408{int degbound = 0;
    408  if (size(#) > 0) {if (#[1] > 0) {degbound = #[1];}}
    409  int i,w,j,h1;
    410  intvec Vt,Vt2,H1; int it;
    411  module M;
    412  if (degbound == 0)
    413  {for (i = 1; i <= n; i++)
    414   {Vt = V, i; w = 0;
    415    for (j = 1; j<= size(P); j++)
    416    {if (P[j] <= size(Vt))
    417     {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    418      if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    419     }
    420    }
    421     if (w == 0)
    422     {vector Vtt;
    423     for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    424     M = M,Vtt;
    425     kill Vtt;
    426     }
    427   }
    428   if (size(M) == 0) {if (size(R) < 2){R[2] = list(V);} else {R[2] = R[2] + list(V);} return(R);}
     409  if (size(#) > 0) {if (#[1] > 0) {degbound = #[1];}}
     410  int i,w,j,h1;
     411  intvec Vt,Vt2,H1; int it;
     412  module M;
     413  if (degbound == 0)
     414  {for (i = 1; i <= n; i++)
     415    {Vt = V, i; w = 0;
     416      for (j = 1; j<= size(P); j++)
     417      {if (P[j] <= size(Vt))
     418        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     419          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     420        }
     421      }
     422      if (w == 0)
     423      {vector Vtt;
     424        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     425        M = M,Vtt;
     426        kill Vtt;
     427      }
     428    }
     429    if (size(M) == 0) {if (size(R) < 2){R[2] = list(V);} else {R[2] = R[2] + list(V);} return(R);}
     430    else
     431    {M = simplify(M,2);
     432      for (i = 1; i <= size(M); i++)
     433      {kill Vt; intvec Vt;
     434        for (j =1; j <= size(M[i]); j++)
     435        {Vt[j] =  int(leadcoef(M[i][j]));}
     436        if (size(R[1]) < (size(V)+2)) { R[1][(size(V)+2)] = 1;}
     437        else
     438        {R[1][(size(V)+2)] = R[1][(size(V)+2)] + 1;}
     439        R = findHCoeffMis(Vt,n,L,P,R);
     440      }
     441      return(R);
     442    }
     443  }
    429444  else
    430   {M = simplify(M,2);
    431    for (i = 1; i <= size(M); i++)
    432    {kill Vt; intvec Vt;
    433     for (j =1; j <= size(M[i]); j++)
    434      {Vt[j] =  int(leadcoef(M[i][j]));}
    435     if (size(R[1]) < (size(V)+2)) { R[1][(size(V)+2)] = 1;}
     445  {if (size(V) > degbound) {ERROR("monomial exceeds degreebound");}
     446    if (size(V) == degbound)
     447    {if (size(R) < 2){R[2] = list (V);}
     448      else{R[2] = R[2] + list (V);}
     449      return(R);
     450    }
     451    for (i = 1; i <= n; i++)
     452    {Vt = V, i; w = 0;
     453      for (j = 1; j<= size(P); j++)
     454      {if (P[j] <= size(Vt))
     455        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     456          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     457        }
     458      }
     459      if (w == 0)
     460      {vector Vtt;
     461        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     462        M = M,Vtt;
     463        kill Vtt;
     464      }
     465    }
     466    if (size(M) == 0) {if (size(R) < 2){R[2] = list(V);} else {R[2] = R[2] + list(V);} return(R);}
    436467    else
    437     {R[1][(size(V)+2)] = R[1][(size(V)+2)] + 1;}
    438     R = findHCoeffMis(Vt,n,L,P,R);
    439    }
    440    return(R);
    441   }
    442  }
    443  else
    444  {if (size(V) > degbound) {ERROR("monomial exceeds degreebound");}
    445   if (size(V) == degbound)
    446   {if (size(R) < 2){R[2] = list (V);}
    447    else{R[2] = R[2] + list (V);}
    448    return(R);
    449   }
    450   for (i = 1; i <= n; i++)
    451   {Vt = V, i; w = 0;
    452    for (j = 1; j<= size(P); j++)
    453    {if (P[j] <= size(Vt))
    454     {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    455      if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    456     }
    457    }
    458     if (w == 0)
    459     {vector Vtt;
    460     for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    461     M = M,Vtt;
    462     kill Vtt;
    463     }
    464   }
    465   if (size(M) == 0) {if (size(R) < 2){R[2] = list(V);} else {R[2] = R[2] + list(V);} return(R);}
    466   else
    467   {M = simplify(M,2);
    468     for (i = 1; i <= ncols(M); i++)
    469     {kill Vt; intvec Vt;
    470      for (j =1; j <= size(M[i]); j++)
    471      {Vt[j] =  int(leadcoef(M[i][j]));}
    472      if (size(R[1]) < (size(V)+2)) { R[1][(size(V)+2)] = 1;}
    473      else
    474      {R[1][(size(V)+2)] = R[1][(size(V)+2)] + 1;}
    475      R = findHCoeffMis(Vt,n,L,P,R,degbound);
    476     }
    477    return(R);
    478   }
    479  }
     468    {M = simplify(M,2);
     469      for (i = 1; i <= ncols(M); i++)
     470      {kill Vt; intvec Vt;
     471        for (j =1; j <= size(M[i]); j++)
     472        {Vt[j] =  int(leadcoef(M[i][j]));}
     473        if (size(R[1]) < (size(V)+2)) { R[1][(size(V)+2)] = 1;}
     474        else
     475        {R[1][(size(V)+2)] = R[1][(size(V)+2)] + 1;}
     476        R = findHCoeffMis(Vt,n,L,P,R,degbound);
     477      }
     478      return(R);
     479    }
     480  }
    480481}
    481482
     
    487488"
    488489{int degbound = 0;
    489  if (size(#) > 0) {if (#[1] > 0) {degbound = #[1];}}
    490  int dimen,i,j,w;
    491  intvec Vt,Vt2; int it;
    492  module M;
    493  if (degbound == 0)
    494  {for (i = 1; i <= n; i++)
    495   {Vt = V, i; w = 0;
    496    for (j = 1; j<= size(P); j++)
    497    {if (P[j] <= size(Vt))
    498     {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    499      if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    500     }
    501    }
    502     if (w == 0)
    503     {vector Vtt;
    504      for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    505      M = M,Vtt;
    506      kill Vtt;
    507     }
    508   }
    509   if (size(M) == 0)
    510   {if (size(R) < 2){R[2] = list (V);}
    511    else{R[2] = R[2] + list(V);}
    512    return(R);
     490  if (size(#) > 0) {if (#[1] > 0) {degbound = #[1];}}
     491  int dimen,i,j,w;
     492  intvec Vt,Vt2; int it;
     493  module M;
     494  if (degbound == 0)
     495  {for (i = 1; i <= n; i++)
     496    {Vt = V, i; w = 0;
     497      for (j = 1; j<= size(P); j++)
     498      {if (P[j] <= size(Vt))
     499        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     500          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     501        }
     502      }
     503      if (w == 0)
     504      {vector Vtt;
     505        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     506        M = M,Vtt;
     507        kill Vtt;
     508      }
     509    }
     510    if (size(M) == 0)
     511    {if (size(R) < 2){R[2] = list (V);}
     512      else{R[2] = R[2] + list(V);}
     513      return(R);
     514    }
     515    else
     516    {M = simplify(M,2);
     517      for (i = 1; i <= size(M); i++)
     518      {kill Vt; intvec Vt;
     519        for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
     520        R[1] = R[1] + 1; R = findMisDim(Vt,n,L,P,R);
     521      }
     522      return(R);
     523    }
    513524  }
    514525  else
    515   {M = simplify(M,2);
    516    for (i = 1; i <= size(M); i++)
    517    {kill Vt; intvec Vt;
    518     for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
    519      R[1] = R[1] + 1; R = findMisDim(Vt,n,L,P,R);
    520    }
    521    return(R);
    522   }
    523  }
    524  else
    525  {if (size(V) > degbound) {ERROR("monomial exceeds degreebound");}
    526   if (size(V) == degbound)
    527   {if (size(R) < 2){R[2] = list (V);}
    528    else{R[2] = R[2] + list (V);}
    529    return(R);
    530   }
    531   for (i = 1; i <= n; i++)
    532   {Vt = V, i; w = 0;
    533    for (j = 1; j<= size(P); j++)
    534    {if (P[j] <= size(Vt))
    535     {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    536      if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
    537     }
    538    }
    539     if (w == 0)
    540     {vector Vtt;
    541      for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    542      M = M,Vtt;
    543      kill Vtt;
    544     }
    545   }
    546   if (size(M) == 0)
    547   {if (size(R) < 2){R[2] = list (V);}
    548    else{R[2] = R[2] + list(V);}
    549    return(R);
    550   }
    551   else
    552   {M = simplify(M,2);
    553    for (i = 1; i <= size(M); i++)
    554    {kill Vt; intvec Vt;
    555     for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
    556      R[1] = R[1] + 1; R = findMisDim(Vt,n,L,P,R,degbound);
    557    }
    558    return(R);
    559 
    560   }
    561  }
     526  {if (size(V) > degbound) {ERROR("monomial exceeds degreebound");}
     527    if (size(V) == degbound)
     528    {if (size(R) < 2){R[2] = list (V);}
     529      else{R[2] = R[2] + list (V);}
     530      return(R);
     531    }
     532    for (i = 1; i <= n; i++)
     533    {Vt = V, i; w = 0;
     534      for (j = 1; j<= size(P); j++)
     535      {if (P[j] <= size(Vt))
     536        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     537          if (isInMat(Vt2,L[j]) > 0) {w = 1; break;}
     538        }
     539      }
     540      if (w == 0)
     541      {vector Vtt;
     542        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     543        M = M,Vtt;
     544        kill Vtt;
     545      }
     546    }
     547    if (size(M) == 0)
     548    {if (size(R) < 2){R[2] = list (V);}
     549      else{R[2] = R[2] + list(V);}
     550      return(R);
     551    }
     552    else
     553    {M = simplify(M,2);
     554      for (i = 1; i <= size(M); i++)
     555      {kill Vt; intvec Vt;
     556        for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
     557        R[1] = R[1] + 1; R = findMisDim(Vt,n,L,P,R,degbound);
     558      }
     559      return(R);
     560
     561    }
     562  }
    562563}
    563564
     
    572573"
    573574{int degbound = 0;
    574  if (size(#) > 0) {if (#[1] > 0) {degbound = #[1];}}
    575  list R; intvec Vt,Vt2; int it;
    576  int i,j;
    577  module M;
    578  if (degbound == 0)
    579  {int w;
    580   for (i = 1; i <= n; i++)
    581   {Vt = V,i; w = 0;
    582    for (j = 1; j <= size(P); j++)
    583    {if (P[j] <= size(Vt))
    584     {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    585      if (isInMat(Vt2,L[j]) > 0)
    586      {w = 1; break;}
    587     }
    588    }
    589    if (w == 0)
    590    {vector Vtt;
    591     for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    592     M = M,Vtt;
    593     kill Vtt;
    594    }
    595   }
    596   if (size(M)==0) {R = V; return(R);}
     575  if (size(#) > 0) {if (#[1] > 0) {degbound = #[1];}}
     576  list R; intvec Vt,Vt2; int it;
     577  int i,j;
     578  module M;
     579  if (degbound == 0)
     580  {int w;
     581    for (i = 1; i <= n; i++)
     582    {Vt = V,i; w = 0;
     583      for (j = 1; j <= size(P); j++)
     584      {if (P[j] <= size(Vt))
     585        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     586          if (isInMat(Vt2,L[j]) > 0)
     587          {w = 1; break;}
     588        }
     589      }
     590      if (w == 0)
     591      {vector Vtt;
     592        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     593        M = M,Vtt;
     594        kill Vtt;
     595      }
     596    }
     597    if (size(M)==0) {R = V; return(R);}
     598    else
     599    {M = simplify(M,2);
     600      for (i = 1; i <= size(M); i++)
     601      {kill Vt; intvec Vt;
     602        for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
     603        R = R + findmistletoes(Vt,n,L,P);
     604      }
     605      return(R);
     606    }
     607  }
    597608  else
    598   {M = simplify(M,2);
    599    for (i = 1; i <= size(M); i++)
    600    {kill Vt; intvec Vt;
    601     for (j =1; j <= size(M[i]); j++){Vt[j] =  int(leadcoef(M[i][j]));}
    602     R = R + findmistletoes(Vt,n,L,P);
    603    }
    604    return(R);
    605   }
    606  }
    607  else
    608  {if (size(V) > degbound) {ERROR("monomial exceeds degreebound");}
    609   if (size(V) == degbound) {R = V; return(R);}
    610   int w;
    611   for (i = 1; i <= n; i++)
    612   {Vt = V,i; w = 0;
    613    for (j = 1; j <= size(P); j++)
    614    {if (P[j] <= size(Vt))
    615     {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
    616      if (isInMat(Vt2,L[j]) > 0){w = 1; break;}
    617     }
    618    }
    619    if (w == 0)
    620    {vector Vtt;
    621     for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
    622     M = M,Vtt;
    623     kill Vtt;
    624    }
    625   }
    626   if (size(M) == 0) {R = V; return(R);}
    627   else
    628   {M = simplify(M,2);
    629    for (i = 1; i <= ncols(M); i++)
    630    {kill Vt; intvec Vt;
    631     for (j =1; j <= size(M[i]); j++)
    632      {Vt[j] =  int(leadcoef(M[i][j]));}
    633       //Vt; typeof(Vt); size(Vt);
    634       R = R + findmistletoes(Vt,n,L,P,degbound);
    635    }
    636    return(R);
    637   }
    638  }
     609  {if (size(V) > degbound) {ERROR("monomial exceeds degreebound");}
     610    if (size(V) == degbound) {R = V; return(R);}
     611    int w;
     612    for (i = 1; i <= n; i++)
     613    {Vt = V,i; w = 0;
     614      for (j = 1; j <= size(P); j++)
     615      {if (P[j] <= size(Vt))
     616        {Vt2 = Vt[(size(Vt)-P[j]+1)..size(Vt)];
     617          if (isInMat(Vt2,L[j]) > 0){w = 1; break;}
     618        }
     619      }
     620      if (w == 0)
     621      {vector Vtt;
     622        for (it = 1; it <= size(Vt); it++){Vtt = Vtt + Vt[it]*gen(it);}
     623        M = M,Vtt;
     624        kill Vtt;
     625      }
     626    }
     627    if (size(M) == 0) {R = V; return(R);}
     628    else
     629    {M = simplify(M,2);
     630      for (i = 1; i <= ncols(M); i++)
     631      {kill Vt; intvec Vt;
     632        for (j =1; j <= size(M[i]); j++)
     633        {Vt[j] =  int(leadcoef(M[i][j]));}
     634        //Vt; typeof(Vt); size(Vt);
     635        R = R + findmistletoes(Vt,n,L,P,degbound);
     636      }
     637      return(R);
     638    }
     639  }
    639640}
    640641
     
    645646"
    646647{int i,n;
    647  n = 0;
    648  for (i = 1; i <= size(L); i++) {if (L[i] == V) {n = i; break;}}
    649  return(n);
     648  n = 0;
     649  for (i = 1; i <= size(L); i++) {if (L[i] == V) {n = i; break;}}
     650  return(n);
    650651}
    651652
     
    656657"
    657658{if (size(V) <> ncols(M)) {return(0);}
    658  int i;
    659  intvec Vt;
    660  for (i = 1; i <= nrows(M); i++)
    661  {Vt = M[i,1..ncols(M)];
    662   if ((V-Vt) == 0){return(i);}
    663  }
    664  return(0);
     659  int i;
     660  intvec Vt;
     661  for (i = 1; i <= nrows(M); i++)
     662  {Vt = M[i,1..ncols(M)];
     663    if ((V-Vt) == 0){return(i);}
     664  }
     665  return(0);
    665666}
    666667
     
    671672"
    672673{int i,n;
    673  n = 0;
    674  for (i = 1; i <= size(V); i++) {if (V[i] == v) {n = i; break;}}
    675  return(n);
     674  n = 0;
     675  for (i = 1; i <= size(V); i++) {if (V[i] == v) {n = i; break;}}
     676  return(n);
    676677}
    677678
     
    685686"
    686687{checkAssumptions(0,L);
    687  int i; ideal G;
    688  poly p;
    689  for (i = 1; i <= size(L); i++)
    690  {p = iv2lp(L[i]);
    691   G[(size(G) + 1)] = p;
    692  }
    693  return(G);
     688  int i; ideal G;
     689  poly p;
     690  for (i = 1; i <= size(L); i++)
     691  {p = iv2lp(L[i]);
     692    G[(size(G) + 1)] = p;
     693  }
     694  return(G);
    694695}
    695696example
     
    715716"
    716717{if (I[1] == 0) {return(1);}
    717  int i = size(I);
    718  if (i > attrib(basering,"uptodeg")) {ERROR("polynomial exceeds degreebound");}
    719  int j; poly p = 1;
    720  for (j = 1; j <= i; j++) {if (I[j] > 0) { p = lpMult(p,var(I[j]));}} //ignore zeroes, because they correspond to 1
    721  return(p);
     718  int i = size(I);
     719  if (i > attrib(basering,"uptodeg")) {ERROR("polynomial exceeds degreebound");}
     720  int j; poly p = 1;
     721  for (j = 1; j <= i; j++) {if (I[j] > 0) { p = lpMult(p,var(I[j]));}} //ignore zeroes, because they correspond to 1
     722  return(p);
    722723}
    723724example
     
    743744"
    744745{checkAssumptions(0,L);
    745  ideal G;
    746  int i;
    747  for (i = 1; i <= size(L); i++){G = G + iv2lpMat(L[i]);}
    748  return(G);
     746  ideal G;
     747  int i;
     748  for (i = 1; i <= size(L); i++){G = G + iv2lpMat(L[i]);}
     749  return(G);
    749750}
    750751example
     
    772773"
    773774{list L = M;
    774  checkAssumptions(0,L);
    775  kill L;
    776  ideal G; poly p;
    777  int i; intvec I;
    778  for (i = 1; i <= nrows(M); i++)
     775  checkAssumptions(0,L);
     776  kill L;
     777  ideal G; poly p;
     778  int i; intvec I;
     779  for (i = 1; i <= nrows(M); i++)
    779780  { I = M[i,1..ncols(M)];
    780781    p = iv2lp(I);
    781782    G[size(G)+1] = p;
    782783  }
    783  return(G);
     784  return(G);
    784785}
    785786example
     
    805806"
    806807{int i,j,k;
    807  list M;
    808  checkAssumptions(0,M);
    809  for (i = 1; i <= size(G); i++) {M[i] = lp2iv(G[i]);}
    810  return(M);
    811 }
    812 example
    813 {
    814   "EXAMPLE:"; echo = 2;
    815    ring r = 0,(x,y),dp;
    816    def R = makeLetterplaceRing(5); // constructs a Letterplace ring
    817    setring R; // sets basering to Letterplace ring
    818    ideal L = x(1)*x(2),y(1)*y(2),x(1)*y(2)*x(3);
    819    lpId2ivLi(L); // returns the corresponding intvecs as a list
     808  list M;
     809  checkAssumptions(0,M);
     810  for (i = 1; i <= size(G); i++) {M[i] = lp2iv(G[i]);}
     811  return(M);
     812}
     813example
     814{
     815  "EXAMPLE:"; echo = 2;
     816  ring r = 0,(x,y),dp;
     817  def R = makeLetterplaceRing(5); // constructs a Letterplace ring
     818  setring R; // sets basering to Letterplace ring
     819  ideal L = x(1)*x(2),y(1)*y(2),x(1)*y(2)*x(3);
     820  lpId2ivLi(L); // returns the corresponding intvecs as a list
    820821}
    821822
     
    829830"
    830831{p = normalize(lead(p));
    831  intvec I;
    832  int i,j;
    833  if (deg(p) > attrib(basering,"uptodeg")) {ERROR("Monomial exceeds degreebound");}
    834  if (p == 1) {return(I);}
    835  if (p == 0) {ERROR("Monomial is not allowed to equal zero");}
    836  intvec lep = leadexp(p);
    837  for ( i = 1; i <= attrib(basering,"lV"); i++) {if (lep[i] == 1) {I = i; break;}}
    838  for (i = (attrib(basering,"lV")+1); i <= size(lep); i++)
    839    {if (lep[i] == 1)
     832  intvec I;
     833  int i,j;
     834  if (deg(p) > attrib(basering,"uptodeg")) {ERROR("Monomial exceeds degreebound");}
     835  if (p == 1) {return(I);}
     836  if (p == 0) {ERROR("Monomial is not allowed to equal zero");}
     837  intvec lep = leadexp(p);
     838  for ( i = 1; i <= attrib(basering,"lV"); i++) {if (lep[i] == 1) {I = i; break;}}
     839  for (i = (attrib(basering,"lV")+1); i <= size(lep); i++)
     840  {if (lep[i] == 1)
    840841    { j = (i mod attrib(basering,"lV"));
    841842      if (j == 0) {I = I,attrib(basering,"lV");}
     
    843844    }
    844845    else { if (lep[i] > 1) {ERROR("monomial has a not allowed multidegree");}}
    845    }
    846  if (I[1] == 0) {ERROR("monomial has a not allowed multidegree");}
    847 
    848  return(I);
     846  }
     847  if (I[1] == 0) {ERROR("monomial has a not allowed multidegree");}
     848
     849  return(I);
    849850}
    850851example
     
    870871"
    871872{G = normalize(lead(G));
    872  intvec I; list L;
    873  checkAssumptions(0,L);
    874  int i,md;
    875  for (i = 1; i <= size(G); i++) { if (md <= deg(G[i])) {md = deg(G[i]);}}
    876  while (size(G) > 0)
    877  {ideal Gt;
    878   for (i = 1; i <= ncols(G); i++) {if (md == deg(G[i])) {Gt = Gt + G[i]; G[i] = 0;}}
    879   if (size(Gt) > 0)
    880   {G = simplify(G,2);
    881    intmat M [size(Gt)][md];
    882    for (i = 1; i <= size(Gt); i++) {M[i,1..md] = lp2iv(Gt[i]);}
    883    L = insert(L,M);
    884    kill M; kill Gt;
    885    md = md - 1;
    886   }
    887   else {kill Gt; md = md - 1;}
    888  }
    889  return(L);
     873  intvec I; list L;
     874  checkAssumptions(0,L);
     875  int i,md;
     876  for (i = 1; i <= size(G); i++) { if (md <= deg(G[i])) {md = deg(G[i]);}}
     877  while (size(G) > 0)
     878  {ideal Gt;
     879    for (i = 1; i <= ncols(G); i++) {if (md == deg(G[i])) {Gt = Gt + G[i]; G[i] = 0;}}
     880    if (size(Gt) > 0)
     881    {G = simplify(G,2);
     882      intmat M [size(Gt)][md];
     883      for (i = 1; i <= size(Gt); i++) {M[i,1..md] = lp2iv(Gt[i]);}
     884      L = insert(L,M);
     885      kill M; kill Gt;
     886      md = md - 1;
     887    }
     888    else {kill Gt; md = md - 1;}
     889  }
     890  return(L);
    890891}
    891892example
     
    927928"
    928929{int degbound = 0;
    929  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] > 0){degbound = #[1];}}}
    930  checkAssumptions(degbound,L);
    931  intvec H; int i,dimen;
    932  H = ivHilbert(L,n,degbound);
    933  for (i = 1; i <= size(H); i++){dimen = dimen + H[i];}
    934  L = dimen,H;
    935  return(L);
    936 }
    937 example
    938 {
    939   "EXAMPLE:"; echo = 2;
    940   ring r = 0,(x,y),dp;
    941   def R = makeLetterplaceRing(5); // constructs a Letterplace ring
    942     R;
     930  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] > 0){degbound = #[1];}}}
     931  checkAssumptions(degbound,L);
     932  intvec H; int i,dimen;
     933  H = ivHilbert(L,n,degbound);
     934  for (i = 1; i <= size(H); i++){dimen = dimen + H[i];}
     935  L = dimen,H;
     936  return(L);
     937}
     938example
     939{
     940  "EXAMPLE:"; echo = 2;
     941  ring r = 0,(x,y),dp;
     942  def R = makeLetterplaceRing(5); // constructs a Letterplace ring
     943  R;
    943944  setring R; // sets basering to Letterplace ring
    944945  //some intmats, which contain monomials in intvec representation as rows
     
    966967@*      - If you specify a different degree bound degbound,
    967968@*        degbound <= attrib(basering,uptodeg) holds.
    968 NOTE: - If L is the list returned, then L[1] is an intvec which contains the
    969 @*      coefficients of the Hilbert series, L[2] is an integer and L[3]
     969NOTE: - If L is the list returned, then L[1] is an integer, L[2] is an intvec
     970@*      which contains the coefficients of the Hilbert series and L[3]
    970971@*      is a list, containing the mistletoes as intvecs.
    971972@*    - If degbound is set, a degree bound will be added. By default there
    972973@*      is no degree bound.
    973974@*    - n is the number of variables.
    974 @*    - If I = L[1] is the intvec returned, then I[k] is the (k-1)-th
     975@*    - If I = L[2] is the intvec returned, then I[k] is the (k-1)-th
    975976@*      coefficient of the Hilbert series.
    976977@*    - If the K-dimension is known to be infinite, a degree bound is needed
     
    978979"
    979980{int degbound = 0;
    980  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] > 0){degbound = #[1];}}}
    981  checkAssumptions(degbound,L);
    982  int i,dimen; list R;
    983  R = ivSickleHil(L,n,degbound);
    984  for (i = 1; i <= size(R[1]); i++){dimen = dimen + R[1][i];}
    985  R[3] = R[2]; R[2] = dimen;
    986  return(R);
     981  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] > 0){degbound = #[1];}}}
     982  checkAssumptions(degbound,L);
     983  int i,dimen; list R;
     984  R = ivSickleHil(L,n,degbound);
     985  for (i = 1; i <= size(R[1]); i++){dimen = dimen + R[1][i];}
     986  R[3] = R[2]; R[2] = R[1]; R[1] = dimen;
     987  return(R);
    987988}
    988989example
     
    10161017"
    10171018{checkAssumptions(0,L);
    1018  int i,r;
    1019  intvec P,H;
    1020  for (i = 1; i <= size(L); i++)
    1021  {P[i] = ncols(L[i]);
    1022   if (P[i] == 1) {if (isInMat(H,L[i]) > 0) {ERROR("Quotient algebra is trivial");}}
    1023  }
    1024  if (size(L) == 0) {ERROR("GB is empty, quotient algebra corresponds to free algebra");}
    1025  kill H;
    1026  intmat S; int sd,ld; intvec V;
    1027  sd = P[1]; ld = P[1];
    1028  for (i = 2; i <= size(P); i++)
    1029  {if (P[i] < sd) {sd = P[i];}
    1030   if (P[i] > ld) {ld = P[i];}
    1031  }
    1032  sd = (sd - 1); ld = ld - 1;
    1033  if (ld == 0) { return(allVars(L,P,n));}
    1034  if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
    1035  else {S = createStartMat(sd,n);}
    1036  module M;
    1037  for (i = 1; i <= nrows(S); i++)
    1038  {V = S[i,1..ncols(S)];
    1039   if (findCycle(V,L,P,n,ld,M)) {r = 1; break;}
    1040  }
    1041  return(r);
     1019  int i,r;
     1020  intvec P,H;
     1021  for (i = 1; i <= size(L); i++)
     1022  {P[i] = ncols(L[i]);
     1023    if (P[i] == 1) {if (isInMat(H,L[i]) > 0) {ERROR("Quotient algebra is trivial");}}
     1024  }
     1025  if (size(L) == 0) {ERROR("GB is empty, quotient algebra corresponds to free algebra");}
     1026  kill H;
     1027  intmat S; int sd,ld; intvec V;
     1028  sd = P[1]; ld = P[1];
     1029  for (i = 2; i <= size(P); i++)
     1030  {if (P[i] < sd) {sd = P[i];}
     1031    if (P[i] > ld) {ld = P[i];}
     1032  }
     1033  sd = (sd - 1); ld = ld - 1;
     1034  if (ld == 0) { return(allVars(L,P,n));}
     1035  if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
     1036  else {S = createStartMat(sd,n);}
     1037  module M;
     1038  for (i = 1; i <= nrows(S); i++)
     1039  {V = S[i,1..ncols(S)];
     1040    if (findCycle(V,L,P,n,ld,M)) {r = 1; break;}
     1041  }
     1042  return(r);
    10421043}
    10431044example
     
    10791080"
    10801081{int degbound = 0;
    1081  if (size(#) > 0) {if (typeof(#[1])=="int"){if (#[1] > 0) {degbound = #[1];}}}
    1082  intvec P,H; int i;
    1083  for (i = 1; i <= size(L); i++)
    1084  {P[i] = ncols(L[i]);
    1085   if (P[i] == 1) {if ( isInMat(H,L[i]) > 0) {ERROR("Quotient algebra is trivial");}}
    1086  }
    1087  if (size(L) == 0) {ERROR("GB is empty, quotient algebra corresponds to free algebra");}
    1088  H[1] = 1;
    1089  checkAssumptions(degbound,L);
    1090  if (degbound == 0)
    1091  {int sd;
    1092   intmat S;
    1093   sd = P[1];
    1094   for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
    1095   sd = (sd - 1);
    1096   if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
    1097   else {S = createStartMat(sd,n);}
    1098   if (intvec(S) == 0) {return(H);}
    1099   for (i = 1; i <= sd; i++) {H = H,(n^i);}
    1100   for (i = 1; i <= nrows(S); i++)
    1101   {intvec St = S[i,1..ncols(S)];
    1102    H = findHCoeff(St,n,L,P,H);
    1103    kill St;
    1104   }
    1105   return(H);
    1106  }
    1107  else
    1108  {for (i = 1; i <= size(P); i++)
    1109   {if (P[i] > degbound) {ERROR("degreebound is too small, GB contains elements of higher degree");}}
    1110   int sd;
    1111   intmat S;
    1112   sd = P[1];
    1113   for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
    1114   sd = (sd - 1);
    1115   if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
    1116   else {S = createStartMat(sd,n);}
    1117   if (intvec(S) == 0) {return(H);}
    1118   for (i = 1; i <= sd; i++) {H = H,(n^i);}
    1119   for (i = 1; i <= nrows(S); i++)
    1120   {intvec St = S[i,1..ncols(S)];
    1121    H = findHCoeff(St,n,L,P,H,degbound);
    1122    kill St;
    1123   }
    1124   return(H);
    1125  }
     1082  if (size(#) > 0) {if (typeof(#[1])=="int"){if (#[1] > 0) {degbound = #[1];}}}
     1083  intvec P,H; int i;
     1084  for (i = 1; i <= size(L); i++)
     1085  {P[i] = ncols(L[i]);
     1086    if (P[i] == 1) {if ( isInMat(H,L[i]) > 0) {ERROR("Quotient algebra is trivial");}}
     1087  }
     1088  if (size(L) == 0) {ERROR("GB is empty, quotient algebra corresponds to free algebra");}
     1089  H[1] = 1;
     1090  checkAssumptions(degbound,L);
     1091  if (degbound == 0)
     1092  {int sd;
     1093    intmat S;
     1094    sd = P[1];
     1095    for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
     1096    sd = (sd - 1);
     1097    if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
     1098    else {S = createStartMat(sd,n);}
     1099    if (intvec(S) == 0) {return(H);}
     1100    for (i = 1; i <= sd; i++) {H = H,(n^i);}
     1101    for (i = 1; i <= nrows(S); i++)
     1102    {intvec St = S[i,1..ncols(S)];
     1103      H = findHCoeff(St,n,L,P,H);
     1104      kill St;
     1105    }
     1106    return(H);
     1107  }
     1108  else
     1109  {for (i = 1; i <= size(P); i++)
     1110    {if (P[i] > degbound) {ERROR("degreebound is too small, GB contains elements of higher degree");}}
     1111    int sd;
     1112    intmat S;
     1113    sd = P[1];
     1114    for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
     1115    sd = (sd - 1);
     1116    if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
     1117    else {S = createStartMat(sd,n);}
     1118    if (intvec(S) == 0) {return(H);}
     1119    for (i = 1; i <= sd; i++) {H = H,(n^i);}
     1120    for (i = 1; i <= nrows(S); i++)
     1121    {intvec St = S[i,1..ncols(S)];
     1122      H = findHCoeff(St,n,L,P,H,degbound);
     1123      kill St;
     1124    }
     1125    return(H);
     1126  }
    11261127}
    11271128example
     
    11621163"
    11631164{int degbound = 0;
    1164  if (size(#) > 0) {if (typeof(#[1])=="int"){if (#[1] > 0) {degbound = #[1];}}}
    1165  intvec P,H; int i;
    1166  for (i = 1; i <= size(L); i++)
    1167  {P[i] = ncols(L[i]);
    1168   if (P[i] == 1) {if ( isInMat(H,L[i]) > 0) {ERROR("Quotient algebra is trivial");}}
    1169  }
    1170  if (size(L) == 0) {ERROR("GB is empty, quotient algebra corresponds to free algebra");}
    1171  kill H;
    1172  checkAssumptions(degbound,L);
    1173  if (degbound == 0)
    1174  {int sd; int dimen = 1;
    1175   intmat S;
    1176   sd = P[1];
    1177   for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
    1178   sd = (sd - 1);
    1179   if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
    1180   else {S = createStartMat(sd,n);}
    1181   if (intvec(S) == 0) {return(dimen);}
    1182   for (i = 1; i <= sd; i++) {dimen = dimen +(n^i);}
    1183   for (i = 1; i <= nrows(S); i++)
    1184   {intvec St = S[i,1..ncols(S)];
    1185    dimen = dimen + findDimen(St,n,L,P);
    1186    kill St;
    1187   }
    1188   return(dimen);
    1189  }
    1190  else
    1191  {for (i = 1; i <= size(P); i++)
    1192   {if (P[i] > degbound) {ERROR("degreebound is too small, GB contains elements of higher degree");}}
    1193   int sd; int dimen = 1;
    1194   intmat S;
    1195   sd = P[1];
    1196   for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
    1197   sd = (sd - 1);
    1198   if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
    1199   else {S = createStartMat(sd,n);}
    1200   if (intvec(S) == 0) {return(dimen);}
    1201   for (i = 1; i <= sd; i++) {dimen = dimen +(n^i);}
    1202   for (i = 1; i <= nrows(S); i++)
    1203   {intvec St = S[i,1..ncols(S)];
    1204    dimen = dimen + findDimen(St,n,L,P, degbound);
    1205    kill St;
    1206   }
    1207   return(dimen);
    1208  }
     1165  if (size(#) > 0) {if (typeof(#[1])=="int"){if (#[1] > 0) {degbound = #[1];}}}
     1166  intvec P,H; int i;
     1167  for (i = 1; i <= size(L); i++)
     1168  {P[i] = ncols(L[i]);
     1169    if (P[i] == 1) {if ( isInMat(H,L[i]) > 0) {ERROR("Quotient algebra is trivial");}}
     1170  }
     1171  if (size(L) == 0) {ERROR("GB is empty, quotient algebra corresponds to free algebra");}
     1172  kill H;
     1173  checkAssumptions(degbound,L);
     1174  if (degbound == 0)
     1175  {int sd; int dimen = 1;
     1176    intmat S;
     1177    sd = P[1];
     1178    for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
     1179    sd = (sd - 1);
     1180    if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
     1181    else {S = createStartMat(sd,n);}
     1182    if (intvec(S) == 0) {return(dimen);}
     1183    for (i = 1; i <= sd; i++) {dimen = dimen +(n^i);}
     1184    for (i = 1; i <= nrows(S); i++)
     1185    {intvec St = S[i,1..ncols(S)];
     1186      dimen = dimen + findDimen(St,n,L,P);
     1187      kill St;
     1188    }
     1189    return(dimen);
     1190  }
     1191  else
     1192  {for (i = 1; i <= size(P); i++)
     1193    {if (P[i] > degbound) {ERROR("degreebound is too small, GB contains elements of higher degree");}}
     1194    int sd; int dimen = 1;
     1195    intmat S;
     1196    sd = P[1];
     1197    for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
     1198    sd = (sd - 1);
     1199    if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
     1200    else {S = createStartMat(sd,n);}
     1201    if (intvec(S) == 0) {return(dimen);}
     1202    for (i = 1; i <= sd; i++) {dimen = dimen +(n^i);}
     1203    for (i = 1; i <= nrows(S); i++)
     1204    {intvec St = S[i,1..ncols(S)];
     1205      dimen = dimen + findDimen(St,n,L,P, degbound);
     1206      kill St;
     1207    }
     1208    return(dimen);
     1209  }
    12091210}
    12101211example
     
    12381239"
    12391240{checkAssumptions(0,M);
    1240  intvec L;
    1241  if (size(M) == 0){ERROR("There are no mistletoes, so it appears your dimension is infinite!");}
    1242  if (isInList(L,M) > 0) {print("1 is a mistletoe, therefore dim = 1"); return(1);}
    1243  int i,j,d,s;
    1244  j = 1;
    1245  d = 1 + size(M[1]);
    1246  for (i = 1; i < size(M); i++)
     1241  intvec L;
     1242  if (size(M) == 0){ERROR("There are no mistletoes, so it appears your dimension is infinite!");}
     1243  if (isInList(L,M) > 0) {print("1 is a mistletoe, therefore dim = 1"); return(1);}
     1244  int i,j,d,s;
     1245  j = 1;
     1246  d = 1 + size(M[1]);
     1247  for (i = 1; i < size(M); i++)
    12471248  {s = size(M[i]); if (s > size(M[i+1])){s = size(M[i+1]);}
    1248    while ((M[i][j] == M[i+1][j]) && (j <= s)){j = j + 1;}
    1249    d = d + size(M[i+1])- j + 1;
    1250   }
    1251  return(d);
    1252 }
    1253 example
    1254 {
    1255   "EXAMPLE:"; echo = 2;
    1256    ring r = 0,(x,y),dp;
    1257    def R = makeLetterplaceRing(5); // constructs a Letterplace ring
    1258    R;
    1259    setring R; // sets basering to Letterplace ring
    1260    intvec i1 = 1,2; intvec i2 = 2,1,2;
    1261    // the mistletoes are xy and yxy, which are already ordered lexicographically
    1262    list L = i1,i2;
    1263    ivMis2Dim(L); // returns the dimension of the factor algebra
     1249    while ((M[i][j] == M[i+1][j]) && (j <= s)){j = j + 1;}
     1250    d = d + size(M[i+1])- j + 1;
     1251  }
     1252  return(d);
     1253}
     1254example
     1255{
     1256  "EXAMPLE:"; echo = 2;
     1257  ring r = 0,(x,y),dp;
     1258  def R = makeLetterplaceRing(5); // constructs a Letterplace ring
     1259  R;
     1260  setring R; // sets basering to Letterplace ring
     1261  intvec i1 = 1,2; intvec i2 = 2,1,2;
     1262  // the mistletoes are xy and yxy, which are already ordered lexicographically
     1263  list L = i1,i2;
     1264  ivMis2Dim(L); // returns the dimension of the factor algebra
    12641265}
    12651266
     
    12691270PURPOSE:Orders a given set of mistletoes lexicographically
    12701271ASSUME: - basering is a Letterplace ring.
    1271         - intvecs correspond to monomials
     1272       - intvecs correspond to monomials
    12721273NOTE:   - This is preprocessing, it's not needed if the mistletoes are returned
    12731274@*        from the sickle algorithm.
     
    12761277"
    12771278{checkAssumptions(0,M);
    1278  return(sort(M)[1]);
    1279 }
    1280 example
    1281 {
    1282   "EXAMPLE:"; echo = 2;
    1283    ring r = 0,(x,y),dp;
    1284    def R = makeLetterplaceRing(5); // constructs a Letterplace ring
    1285    setring R; // sets basering to Letterplace ring
    1286    intvec i1 = 1,2,1; intvec i2 = 2,2,1; intvec i3 = 1,1; intvec i4 = 2,1,1,1;
    1287    // the corresponding monomials are xyx,y^2x,x^2,yx^3
    1288    list M = i1,i2,i3,i4;
    1289    M;
    1290    ivOrdMisLex(M);// orders the list of monomials
     1279  return(sort(M)[1]);
     1280}
     1281example
     1282{
     1283  "EXAMPLE:"; echo = 2;
     1284  ring r = 0,(x,y),dp;
     1285  def R = makeLetterplaceRing(5); // constructs a Letterplace ring
     1286  setring R; // sets basering to Letterplace ring
     1287  intvec i1 = 1,2,1; intvec i2 = 2,2,1; intvec i3 = 1,1; intvec i4 = 2,1,1,1;
     1288  // the corresponding monomials are xyx,y^2x,x^2,yx^3
     1289  list M = i1,i2,i3,i4;
     1290  M;
     1291  ivOrdMisLex(M);// orders the list of monomials
    12911292}
    12921293
     
    13071308"
    13081309{list M;
    1309  int degbound = 0;
    1310  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] > 0){degbound = #[1];}}}
    1311  int i;
    1312  intvec P,H;
    1313  for (i = 1; i <= size(L); i++)
    1314  {P[i] = ncols(L[i]);
    1315   if (P[i] == 1) {if (isInMat(H,L[i]) > 0) {ERROR("Quotient algebra is trivial");}}
    1316  }
    1317  if (size(L) == 0) {ERROR("GB is empty, quotient algebra corresponds to free algebra");}
    1318  kill H;
    1319  checkAssumptions(degbound,L);
    1320  if (degbound == 0)
    1321  {intmat S; int sd;
    1322   sd = P[1];
    1323   for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
    1324   sd = (sd - 1);
    1325   if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
    1326   else {S = createStartMat(sd,n);}
    1327   if (intvec(S) == 0) {return(list (intvec(0)));}
    1328   for (i = 1; i <= nrows(S); i++)
    1329   {intvec St = S[i,1..ncols(S)];
    1330    M = M + findmistletoes(St,n,L,P);
    1331    kill St;
    1332   }
    1333   return(M);
    1334  }
    1335  else
    1336  {for (i = 1; i <= size(P); i++)
    1337   {if (P[i] > degbound) {ERROR("degreebound is too small, GB contains elements of higher degree");}}
    1338   intmat S; int sd;
    1339   sd = P[1];
    1340   for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
    1341   sd = (sd - 1);
    1342   if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
    1343   else {S = createStartMat(sd,n);}
    1344   if (intvec(S) == 0) {return(list (intvec(0)));}
    1345   for (i = 1; i <= nrows(S); i++)
    1346   {intvec St = S[i,1..ncols(S)];
    1347    M = M + findmistletoes(St,n,L,P,degbound);
    1348    kill St;
    1349   }
    1350   return(M);
    1351  }
     1310  int degbound = 0;
     1311  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] > 0){degbound = #[1];}}}
     1312  int i;
     1313  intvec P,H;
     1314  for (i = 1; i <= size(L); i++)
     1315  {P[i] = ncols(L[i]);
     1316    if (P[i] == 1) {if (isInMat(H,L[i]) > 0) {ERROR("Quotient algebra is trivial");}}
     1317  }
     1318  if (size(L) == 0) {ERROR("GB is empty, quotient algebra corresponds to free algebra");}
     1319  kill H;
     1320  checkAssumptions(degbound,L);
     1321  if (degbound == 0)
     1322  {intmat S; int sd;
     1323    sd = P[1];
     1324    for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
     1325    sd = (sd - 1);
     1326    if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
     1327    else {S = createStartMat(sd,n);}
     1328    if (intvec(S) == 0) {return(list (intvec(0)));}
     1329    for (i = 1; i <= nrows(S); i++)
     1330    {intvec St = S[i,1..ncols(S)];
     1331      M = M + findmistletoes(St,n,L,P);
     1332      kill St;
     1333    }
     1334    return(M);
     1335  }
     1336  else
     1337  {for (i = 1; i <= size(P); i++)
     1338    {if (P[i] > degbound) {ERROR("degreebound is too small, GB contains elements of higher degree");}}
     1339    intmat S; int sd;
     1340    sd = P[1];
     1341    for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
     1342    sd = (sd - 1);
     1343    if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
     1344    else {S = createStartMat(sd,n);}
     1345    if (intvec(S) == 0) {return(list (intvec(0)));}
     1346    for (i = 1; i <= nrows(S); i++)
     1347    {intvec St = S[i,1..ncols(S)];
     1348      M = M + findmistletoes(St,n,L,P,degbound);
     1349      kill St;
     1350    }
     1351    return(M);
     1352  }
    13521353}
    13531354example
     
    13881389"
    13891390{list M;
    1390  int degbound = 0;
    1391  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] > 0){degbound = #[1];}}}
    1392  int i,dimen; list R;
    1393  intvec P,H;
    1394  for (i = 1; i <= size(L); i++)
    1395  {P[i] = ncols(L[i]);
    1396   if (P[i] == 1) {if (isInMat(H,L[i]) > 0) {ERROR("Quotient algebra is trivial, dimension equals zero");}}
    1397  }
    1398  if (size(L) == 0) {ERROR("GB is empty, quotient algebra corresponds to free algebra");}
    1399  kill H;
    1400  checkAssumptions(degbound,L);
    1401  if (degbound == 0)
    1402  {int sd; dimen = 1;
    1403   intmat S;
    1404   sd = P[1];
    1405   for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
    1406   sd = (sd - 1);
    1407   if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
    1408   else {S = createStartMat(sd,n);}
    1409   if (intvec(S) == 0) {return(list(dimen,list(intvec(0))));}
    1410   for (i = 1; i <= sd; i++) {dimen = dimen +(n^i);}
    1411   R[1] = dimen;
    1412   for (i = 1; i <= nrows(S); i++)
    1413   {intvec St = S[i,1..ncols(S)];
    1414    R = findMisDim(St,n,L,P,R);
    1415    kill St;
    1416   }
    1417   return(R);
    1418  }
    1419  else
    1420  {for (i = 1; i <= size(P); i++)
    1421   {if (P[i] > degbound) {ERROR("degreebound is too small, GB contains elements of higher degree");}}
    1422   int sd; dimen = 1;
    1423   intmat S;
    1424   sd = P[1];
    1425   for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
    1426   sd = (sd - 1);
    1427   if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
    1428   else {S = createStartMat(sd,n);}
    1429   if (intvec(S) == 0) {return(list(dimen,list(intvec(0))));}
    1430   for (i = 1; i <= sd; i++) {dimen = dimen +(n^i);}
    1431   R[1] = dimen;
    1432   for (i = 1; i <= nrows(S); i++)
    1433   {intvec St = S[i,1..ncols(S)];
    1434    R = findMisDim(St,n,L,P,R,degbound);
    1435    kill St;
    1436   }
    1437   return(R);
    1438  }
     1391  int degbound = 0;
     1392  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] > 0){degbound = #[1];}}}
     1393  int i,dimen; list R;
     1394  intvec P,H;
     1395  for (i = 1; i <= size(L); i++)
     1396  {P[i] = ncols(L[i]);
     1397    if (P[i] == 1) {if (isInMat(H,L[i]) > 0) {ERROR("Quotient algebra is trivial, dimension equals zero");}}
     1398  }
     1399  if (size(L) == 0) {ERROR("GB is empty, quotient algebra corresponds to free algebra");}
     1400  kill H;
     1401  checkAssumptions(degbound,L);
     1402  if (degbound == 0)
     1403  {int sd; dimen = 1;
     1404    intmat S;
     1405    sd = P[1];
     1406    for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
     1407    sd = (sd - 1);
     1408    if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
     1409    else {S = createStartMat(sd,n);}
     1410    if (intvec(S) == 0) {return(list(dimen,list(intvec(0))));}
     1411    for (i = 1; i <= sd; i++) {dimen = dimen +(n^i);}
     1412    R[1] = dimen;
     1413    for (i = 1; i <= nrows(S); i++)
     1414    {intvec St = S[i,1..ncols(S)];
     1415      R = findMisDim(St,n,L,P,R);
     1416      kill St;
     1417    }
     1418    return(R);
     1419  }
     1420  else
     1421  {for (i = 1; i <= size(P); i++)
     1422    {if (P[i] > degbound) {ERROR("degreebound is too small, GB contains elements of higher degree");}}
     1423    int sd; dimen = 1;
     1424    intmat S;
     1425    sd = P[1];
     1426    for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
     1427    sd = (sd - 1);
     1428    if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
     1429    else {S = createStartMat(sd,n);}
     1430    if (intvec(S) == 0) {return(list(dimen,list(intvec(0))));}
     1431    for (i = 1; i <= sd; i++) {dimen = dimen +(n^i);}
     1432    R[1] = dimen;
     1433    for (i = 1; i <= nrows(S); i++)
     1434    {intvec St = S[i,1..ncols(S)];
     1435      R = findMisDim(St,n,L,P,R,degbound);
     1436      kill St;
     1437    }
     1438    return(R);
     1439  }
    14391440}
    14401441example
     
    14771478"
    14781479{int degbound = 0;
    1479  if (size(#) > 0) {if (typeof(#[1])=="int"){if (#[1] > 0) {degbound = #[1];}}}
    1480  intvec P,H; int i; list R;
    1481  for (i = 1; i <= size(L); i++)
    1482  {P[i] = ncols(L[i]);
    1483   if (P[i] == 1) {if ( isInMat(H,L[i]) > 0) {ERROR("Quotient algebra is trivial");}}
    1484  }
    1485  if (size(L) == 0) {ERROR("GB is empty, quotient algebra corresponds to free algebra");}
    1486  H[1] = 1;
    1487  checkAssumptions(degbound,L);
    1488  if (degbound == 0)
    1489  {int sd;
    1490   intmat S;
    1491   sd = P[1];
    1492   for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
    1493   sd = (sd - 1);
    1494   if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
    1495   else {S = createStartMat(sd,n);}
    1496   if (intvec(S) == 0) {return(list(H,list(intvec (0))));}
    1497   for (i = 1; i <= sd; i++) {H = H,(n^i);}
    1498   R[1] = H; kill H;
    1499   for (i = 1; i <= nrows(S); i++)
    1500   {intvec St = S[i,1..ncols(S)];
    1501    R = findHCoeffMis(St,n,L,P,R);
    1502    kill St;
    1503   }
    1504   return(R);
    1505  }
    1506  else
    1507  {for (i = 1; i <= size(P); i++)
    1508   {if (P[i] > degbound) {ERROR("degreebound is too small, GB contains elements of higher degree");}}
    1509   int sd;
    1510   intmat S;
    1511   sd = P[1];
    1512   for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
    1513   sd = (sd - 1);
    1514   if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
    1515   else {S = createStartMat(sd,n);}
    1516   if (intvec(S) == 0) {return(list(H,list(intvec(0))));}
    1517   for (i = 1; i <= sd; i++) {H = H,(n^i);}
    1518   R[1] = H; kill H;
    1519   for (i = 1; i <= nrows(S); i++)
    1520   {intvec St = S[i,1..ncols(S)];
    1521    R = findHCoeffMis(St,n,L,P,R,degbound);
    1522    kill St;
    1523   }
    1524   return(R);
    1525  }
     1480  if (size(#) > 0) {if (typeof(#[1])=="int"){if (#[1] > 0) {degbound = #[1];}}}
     1481  intvec P,H; int i; list R;
     1482  for (i = 1; i <= size(L); i++)
     1483  {P[i] = ncols(L[i]);
     1484    if (P[i] == 1) {if ( isInMat(H,L[i]) > 0) {ERROR("Quotient algebra is trivial");}}
     1485  }
     1486  if (size(L) == 0) {ERROR("GB is empty, quotient algebra corresponds to free algebra");}
     1487  H[1] = 1;
     1488  checkAssumptions(degbound,L);
     1489  if (degbound == 0)
     1490  {int sd;
     1491    intmat S;
     1492    sd = P[1];
     1493    for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
     1494    sd = (sd - 1);
     1495    if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
     1496    else {S = createStartMat(sd,n);}
     1497    if (intvec(S) == 0) {return(list(H,list(intvec (0))));}
     1498    for (i = 1; i <= sd; i++) {H = H,(n^i);}
     1499    R[1] = H; kill H;
     1500    for (i = 1; i <= nrows(S); i++)
     1501    {intvec St = S[i,1..ncols(S)];
     1502      R = findHCoeffMis(St,n,L,P,R);
     1503      kill St;
     1504    }
     1505    return(R);
     1506  }
     1507  else
     1508  {for (i = 1; i <= size(P); i++)
     1509    {if (P[i] > degbound) {ERROR("degreebound is too small, GB contains elements of higher degree");}}
     1510    int sd;
     1511    intmat S;
     1512    sd = P[1];
     1513    for (i = 2; i <= size(P); i++) {if (P[i] < sd) {sd = P[i];}}
     1514    sd = (sd - 1);
     1515    if (sd == 0) { for (i = 1; i <= size(L); i++){if (ncols(L[i]) == 1){S = createStartMat1(n,L[i]); break;}}}
     1516    else {S = createStartMat(sd,n);}
     1517    if (intvec(S) == 0) {return(list(H,list(intvec(0))));}
     1518    for (i = 1; i <= sd; i++) {H = H,(n^i);}
     1519    R[1] = H; kill H;
     1520    for (i = 1; i <= nrows(S); i++)
     1521    {intvec St = S[i,1..ncols(S)];
     1522      R = findHCoeffMis(St,n,L,P,R,degbound);
     1523      kill St;
     1524    }
     1525    return(R);
     1526  }
    15261527}
    15271528example
     
    15641565"
    15651566{int degbound = attrib(basering,"uptodeg");int n = attrib(basering, "lV");
    1566  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
    1567  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
    1568  list L;
    1569  L = lp2ivId(normalize(lead(G)));
    1570  return(ivDHilbert(L,n,degbound));
     1567  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
     1568  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
     1569  list L;
     1570  L = lp2ivId(normalize(lead(G)));
     1571  return(ivDHilbert(L,n,degbound));
    15711572}
    15721573example
     
    15931594@*      - if you specify a different degree bound degbound,
    15941595@*        degbound <= attrib(basering,uptodeg) holds.
    1595 NOTE: - If L is the list returned, then L[1] is an intvec, the Hilbert series,
    1596 @*      L[2] is an integer, the K-dimension and L[3] is an ideal, the mistletoes
     1596NOTE: - If L is the list returned, then L[1] is an integer, the K-dimension,
     1597@*      L[2] is an intvec, the Hilbert series and L[3] is an ideal,
     1598@*      the mistletoes
    15971599@*    - If degbound is set, there will be a degree bound added. 0 means no
    15981600@*      degree bound. Default: attrib(basering,uptodeg).
     
    16051607"
    16061608{int degbound = attrib(basering,"uptodeg");int n = attrib(basering, "lV");
    1607  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
    1608  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
    1609  list L;
    1610  L = lp2ivId(normalize(lead(G)));
    1611  L = ivDHilbertSickle(L,n,degbound);
    1612  L[3] =  ivL2lpI(L[3]);
    1613  return(L);
     1609  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
     1610  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
     1611  list L;
     1612  L = lp2ivId(normalize(lead(G)));
     1613  L = ivDHilbertSickle(L,n,degbound);
     1614  L[3] =  ivL2lpI(L[3]);
     1615  return(L);
    16141616}
    16151617example
     
    16241626  // note that the optional parameters are not necessary, due to the finiteness
    16251627  // of the K-dimension of the factor algebra
    1626   lpDHilbert(G); // procedure with ring parameters
    1627   lpDHilbert(G,0); // procedure without degreebound
     1628  lpDHilbertSickle(G); // procedure with ring parameters
     1629  lpDHilbertSickle(G,0); // procedure without degreebound
    16281630}
    16291631
     
    16451647"
    16461648{int degbound = attrib(basering,"uptodeg");int n = attrib(basering, "lV");
    1647  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
    1648  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
    1649  list L;
    1650  L = lp2ivId(normalize(lead(G)));
    1651  return(ivHilbert(L,n,degbound));
     1649  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
     1650  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
     1651  list L;
     1652  L = lp2ivId(normalize(lead(G)));
     1653  return(ivHilbert(L,n,degbound));
    16521654}
    16531655example
     
    16741676"
    16751677{int n = attrib(basering,"lV");
    1676  list L;
    1677  ideal R;
    1678  R = normalize(lead(G));
    1679  L = lp2ivId(R);
    1680  return(ivDimCheck(L,n));
     1678  list L;
     1679  ideal R;
     1680  R = normalize(lead(G));
     1681  L = lp2ivId(R);
     1682  return(ivDimCheck(L,n));
    16811683}
    16821684example
     
    17091711"
    17101712{int degbound = attrib(basering, "uptodeg");int n = attrib(basering, "lV");
    1711  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
    1712  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
    1713  list L;
    1714  L = lp2ivId(normalize(lead(G)));
    1715  return(ivKDim(L,n,degbound));
     1713  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
     1714  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
     1715  list L;
     1716  L = lp2ivId(normalize(lead(G)));
     1717  return(ivKDim(L,n,degbound));
    17161718}
    17171719example
     
    17391741"
    17401742{list L;
    1741  L = lpId2ivLi(M);
    1742  return(ivMis2Dim(L));
    1743 }
    1744 example
    1745 {
    1746   "EXAMPLE:"; echo = 2;
    1747    ring r = 0,(x,y),dp;
    1748    def R = makeLetterplaceRing(5); // constructs a Letterplace ring
    1749   setring R; // sets basering to Letterplace ring
    1750    ideal L = x(1)*y(2),y(1)*x(2)*y(3);
    1751    // ideal containing the mistletoes
    1752    lpMis2Dim(L); // returns the K-dimension of the factor algebra
     1743  L = lpId2ivLi(M);
     1744  return(ivMis2Dim(L));
     1745}
     1746example
     1747{
     1748  "EXAMPLE:"; echo = 2;
     1749  ring r = 0,(x,y),dp;
     1750  def R = makeLetterplaceRing(5); // constructs a Letterplace ring
     1751  setring R; // sets basering to Letterplace ring
     1752  ideal L = x(1)*y(2),y(1)*x(2)*y(3);
     1753  // ideal containing the mistletoes
     1754  lpMis2Dim(L); // returns the K-dimension of the factor algebra
    17531755}
    17541756
     
    17661768{
    17671769  "EXAMPLE:"; echo = 2;
    1768    ring r = 0,(x,y),dp;
    1769    def R = makeLetterplaceRing(5); // constructs a Letterplace ring
    1770    setring R; // sets basering to Letterplace ring
    1771    ideal M = x(1)*y(2)*x(3), y(1)*y(2)*x(3), x(1)*x(2), y(1)*x(2)*x(3)*x(4);
    1772    // some monomials
    1773    lpOrdMisLex(M); // orders the monomials lexicographically
     1770  ring r = 0,(x,y),dp;
     1771  def R = makeLetterplaceRing(5); // constructs a Letterplace ring
     1772  setring R; // sets basering to Letterplace ring
     1773  ideal M = x(1)*y(2)*x(3), y(1)*y(2)*x(3), x(1)*x(2), y(1)*x(2)*x(3)*x(4);
     1774  // some monomials
     1775  lpOrdMisLex(M); // orders the monomials lexicographically
    17741776}
    17751777
     
    17891791"
    17901792{int degbound = attrib(basering,"uptodeg"); int n = attrib(basering, "lV");
    1791  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
    1792  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
    1793  list L; ideal R;
    1794  R = normalize(lead(G));
    1795  L = lp2ivId(R);
    1796  L = ivSickle(L,n,degbound);
    1797  R = ivL2lpI(L);
    1798  return(R);
     1793  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
     1794  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
     1795  list L; ideal R;
     1796  R = normalize(lead(G));
     1797  L = lp2ivId(R);
     1798  L = ivSickle(L,n,degbound);
     1799  R = ivL2lpI(L);
     1800  return(R);
    17991801}
    18001802example
     
    18291831"
    18301832{int degbound = attrib(basering,"uptodeg");int n = attrib(basering, "lV");
    1831  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
    1832  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
    1833  list L;
    1834  L = lp2ivId(normalize(lead(G)));
    1835  L = ivSickleDim(L,n,degbound);
    1836  L[2] = ivL2lpI(L[2]);
    1837  return(L);
     1833  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
     1834  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
     1835  list L;
     1836  L = lp2ivId(normalize(lead(G)));
     1837  L = ivSickleDim(L,n,degbound);
     1838  L[2] = ivL2lpI(L[2]);
     1839  return(L);
    18381840}
    18391841example
     
    18701872"
    18711873{int degbound = attrib(basering,"uptodeg");int n = attrib(basering, "lV");
    1872  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
    1873  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
    1874  list L;
    1875  L = lp2ivId(normalize(lead(G)));
    1876  L = ivSickleHil(L,n,degbound);
    1877  L[2] =  ivL2lpI(L[2]);
    1878  return(L);
     1874  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
     1875  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
     1876  list L;
     1877  L = lp2ivId(normalize(lead(G)));
     1878  L = ivSickleHil(L,n,degbound);
     1879  L[2] =  ivL2lpI(L[2]);
     1880  return(L);
    18791881}
    18801882example
     
    19161918"
    19171919{int m,d,h,degbound;
    1918  m = 1; d = 0; h = 0; degbound = attrib(basering,"uptodeg");
    1919  if (size(#) > 0) {if (typeof(#[1])=="int"){if (#[1] < 1) {m = 0;}}}
    1920  if (size(#) > 1) {if (typeof(#[1])=="int"){if (#[2] > 0) {d = 1;}}}
    1921  if (size(#) > 2) {if (typeof(#[1])=="int"){if (#[3] > 0) {h = 1;}}}
    1922  if (size(#) > 3) {if (typeof(#[1])=="int"){if (#[4] >= 0) {degbound = #[4];}}}
    1923  if (m == 1)
    1924  {if (d == 0)
    1925   {if (h == 0) {return(lpSickle(G,degbound,attrib(basering,"lV")));}
    1926    else        {return(lpSickleHil(G,degbound,attrib(basering,"lV")));}
     1920  m = 1; d = 0; h = 0; degbound = attrib(basering,"uptodeg");
     1921  if (size(#) > 0) {if (typeof(#[1])=="int"){if (#[1] < 1) {m = 0;}}}
     1922  if (size(#) > 1) {if (typeof(#[1])=="int"){if (#[2] > 0) {d = 1;}}}
     1923  if (size(#) > 2) {if (typeof(#[1])=="int"){if (#[3] > 0) {h = 1;}}}
     1924  if (size(#) > 3) {if (typeof(#[1])=="int"){if (#[4] >= 0) {degbound = #[4];}}}
     1925  if (m == 1)
     1926  {if (d == 0)
     1927    {if (h == 0) {return(lpSickle(G,degbound,attrib(basering,"lV")));}
     1928      else        {return(lpSickleHil(G,degbound,attrib(basering,"lV")));}
     1929    }
     1930    else
     1931    {if (h == 0) {return(lpSickleDim(G,degbound,attrib(basering,"lV")));}
     1932      else {return(lpDHilbertSickle(G,degbound,attrib(basering,"lV")));}
     1933    }
    19271934  }
    19281935  else
    1929   {if (h == 0) {return(lpSickleDim(G,degbound,attrib(basering,"lV")));}
    1930    else {return(lpDHilbertSickle(G,degbound,attrib(basering,"lV")));}
    1931   }
    1932  }
    1933  else
    1934  {if (d == 0)
    1935   {if (h == 0) {ERROR("You request to do nothing, so relax and do so");}
    1936    else        {return(lpHilbert(G,degbound,attrib(basering,"lV")));}
    1937   }
    1938   else
    1939   {if (h == 0) {return(lpKDim(G,degbound,attrib(basering,"lV")));}
    1940    else {return(lpDHilbert(G,degbound,attrib(basering,"lV")));}
    1941   }
    1942  }
     1936  {if (d == 0)
     1937    {if (h == 0) {ERROR("You request to do nothing, so relax and do so");}
     1938      else        {return(lpHilbert(G,degbound,attrib(basering,"lV")));}
     1939    }
     1940    else
     1941    {if (h == 0) {return(lpKDim(G,degbound,attrib(basering,"lV")));}
     1942      else {return(lpDHilbert(G,degbound,attrib(basering,"lV")));}
     1943    }
     1944  }
    19431945}
    19441946example
     
    19611963proc tst_fpadim()
    19621964{
    1963  example ivDHilbert;
    1964  example ivDHilbertSickle;
    1965  example ivDimCheck;
    1966  example ivHilbert;
    1967  example ivKDim;
    1968  example ivMis2Dim;
    1969  example ivOrdMisLex;
    1970  example ivSickle;
    1971  example ivSickleHil;
    1972  example ivSickleDim;
    1973  example lpDHilbert;
    1974  example lpDHilbertSickle;
    1975  example lpHilbert;
    1976  example lpDimCheck;
    1977  example lpKDim;
    1978  example lpMis2Dim;
    1979  example lpOrdMisLex;
    1980  example lpSickle;
    1981  example lpSickleHil;
    1982  example lpSickleDim;
    1983  example sickle;
    1984  example ivL2lpI;
    1985  example iv2lp;
    1986  example iv2lpList;
    1987  example iv2lpMat;
    1988  example lp2iv;
    1989  example lp2ivId;
    1990  example lpId2ivLi;
     1965  example ivDHilbert;
     1966  example ivDHilbertSickle;
     1967  example ivDimCheck;
     1968  example ivHilbert;
     1969  example ivKDim;
     1970  example ivMis2Dim;
     1971  example ivOrdMisLex;
     1972  example ivSickle;
     1973  example ivSickleHil;
     1974  example ivSickleDim;
     1975  example lpDHilbert;
     1976  example lpDHilbertSickle;
     1977  example lpHilbert;
     1978  example lpDimCheck;
     1979  example lpKDim;
     1980  example lpMis2Dim;
     1981  example lpOrdMisLex;
     1982  example lpSickle;
     1983  example lpSickleHil;
     1984  example lpSickleDim;
     1985  example sickle;
     1986  example ivL2lpI;
     1987  example iv2lp;
     1988  example iv2lpList;
     1989  example iv2lpMat;
     1990  example lp2iv;
     1991  example lp2ivId;
     1992  example lpId2ivLi;
    19911993}
    19921994
     
    19961998
    19971999/*
    1998 Here are some examples one may try. Just copy them into your console.
    1999 These are relations for braid groups, up to degree d:
    2000 
    2001 
    2002 LIB "fpadim.lib";
    2003 ring r = 0,(x,y,z),dp;
    2004 int d =10; // degree
    2005 def R = makeLetterplaceRing(d);
    2006 setring R;
    2007 ideal I = y(1)*x(2)*y(3) - z(1)*y(2)*z(3), x(1)*y(2)*x(3) - z(1)*x(2)*y(3),
    2008 z(1)*x(2)*z(3) - y(1)*z(2)*x(3), x(1)*x(2)*x(3) + y(1)*y(2)*y(3) +
    2009 z(1)*z(2)*z(3) + x(1)*y(2)*z(3);
    2010 option(prot);
    2011 option(redSB);option(redTail);option(mem);
    2012 ideal J = system("freegb",I,d,3);
    2013 lpDimCheck(J);
    2014 sickle(J,1,1,1,d);//Computes mistletoes, K-dimension and the Hilbert series
    2015 
    2016 
    2017 
    2018 LIB "fpadim.lib";
    2019 ring r = 0,(x,y,z),dp;
    2020 int d =11; // degree
    2021 def R = makeLetterplaceRing(d);
    2022 setring R;
    2023 ideal I = y(1)*x(2)*y(3) - z(1)*y(2)*z(3), x(1)*y(2)*z(3) - z(1)*x(2)*y(3),
    2024 z(1)*x(2)*z(3) - y(1)*z(2)*x(3), x(1)*x(2)*x(3) + y(1)*y(2)*y(3) +
    2025 z(1)*z(2)*z(3) + x(1)*y(2)*z(3);
    2026 option(prot);
    2027 option(redSB);option(redTail);option(mem);
    2028 ideal J = system("freegb",I,d,3);
    2029 lpDimCheck(J);
    2030 sickle(J,1,1,1,d);
    2031 
    2032 
    2033 
    2034 LIB "fpadim.lib";
    2035 ring r = 0,(x,y,z),dp;
    2036 int d  = 6; // degree
    2037 def R  = makeLetterplaceRing(d);
    2038 setring R;
    2039 ideal I = y(1)*x(2)*y(3) - z(1)*y(2)*z(3), x(1)*y(2)*x(3) - z(1)*x(2)*y(3),
    2040 z(1)*x(2)*z(3) - y(1)*z(2)*x(3), x(1)*x(2)*x(3) -2*y(1)*y(2)*y(3) + 3*z(1)*z(2)*z(3) -4*x(1)*y(2)*z(3) + 5*x(1)*z(2)*z(3)- 6*x(1)*y(2)*y(3) +7*x(1)*x(2)*z(3) - 8*x(1)*x(2)*y(3);
    2041 option(prot);
    2042 option(redSB);option(redTail);option(mem);
    2043 ideal J = system("freegb",I,d,3);
    2044 lpDimCheck(J);
    2045 sickle(J,1,1,1,d);
     2000  Here are some examples one may try. Just copy them into your console.
     2001  These are relations for braid groups, up to degree d:
     2002
     2003
     2004  LIB "fpadim.lib";
     2005  ring r = 0,(x,y,z),dp;
     2006  int d =10; // degree
     2007  def R = makeLetterplaceRing(d);
     2008  setring R;
     2009  ideal I = y(1)*x(2)*y(3) - z(1)*y(2)*z(3), x(1)*y(2)*x(3) - z(1)*x(2)*y(3),
     2010  z(1)*x(2)*z(3) - y(1)*z(2)*x(3), x(1)*x(2)*x(3) + y(1)*y(2)*y(3) +
     2011  z(1)*z(2)*z(3) + x(1)*y(2)*z(3);
     2012  option(prot);
     2013  option(redSB);option(redTail);option(mem);
     2014  ideal J = system("freegb",I,d,3);
     2015  lpDimCheck(J);
     2016  sickle(J,1,1,1,d);//Computes mistletoes, K-dimension and the Hilbert series
     2017
     2018
     2019
     2020  LIB "fpadim.lib";
     2021  ring r = 0,(x,y,z),dp;
     2022  int d =11; // degree
     2023  def R = makeLetterplaceRing(d);
     2024  setring R;
     2025  ideal I = y(1)*x(2)*y(3) - z(1)*y(2)*z(3), x(1)*y(2)*z(3) - z(1)*x(2)*y(3),
     2026  z(1)*x(2)*z(3) - y(1)*z(2)*x(3), x(1)*x(2)*x(3) + y(1)*y(2)*y(3) +
     2027  z(1)*z(2)*z(3) + x(1)*y(2)*z(3);
     2028  option(prot);
     2029  option(redSB);option(redTail);option(mem);
     2030  ideal J = system("freegb",I,d,3);
     2031  lpDimCheck(J);
     2032  sickle(J,1,1,1,d);
     2033
     2034
     2035
     2036  LIB "fpadim.lib";
     2037  ring r = 0,(x,y,z),dp;
     2038  int d  = 6; // degree
     2039  def R  = makeLetterplaceRing(d);
     2040  setring R;
     2041  ideal I = y(1)*x(2)*y(3) - z(1)*y(2)*z(3), x(1)*y(2)*x(3) - z(1)*x(2)*y(3),
     2042  z(1)*x(2)*z(3) - y(1)*z(2)*x(3), x(1)*x(2)*x(3) -2*y(1)*y(2)*y(3) + 3*z(1)*z(2)*z(3) -4*x(1)*y(2)*z(3) + 5*x(1)*z(2)*z(3)- 6*x(1)*y(2)*y(3) +7*x(1)*x(2)*z(3) - 8*x(1)*x(2)*y(3);
     2043  option(prot);
     2044  option(redSB);option(redTail);option(mem);
     2045  ideal J = system("freegb",I,d,3);
     2046  lpDimCheck(J);
     2047  sickle(J,1,1,1,d);
    20462048*/
    20472049
    20482050/*
    2049 Here are some examples, which can also be found in [studzins]:
    2050 
    2051 // takes up to 880Mb of memory
    2052 LIB "fpadim.lib";
    2053 ring r = 0,(x,y,z),dp;
    2054 int d =10; // degree
    2055 def R = makeLetterplaceRing(d);
    2056 setring R;
    2057 ideal I =
    2058 z(1)*z(2)*z(3)*z(4) + y(1)*x(2)*y(3)*x(4) - x(1)*y(2)*y(3)*x(4) - 3*z(1)*y(2)*x(3)*z(4), x(1)*x(2)*x(3) + y(1)*x(2)*y(3) - x(1)*y(2)*x(3), z(1)*y(2)*x(3)-x(1)*y(2)*z(3) + z(1)*x(2)*z(3);
    2059 option(prot);
    2060 option(redSB);option(redTail);option(mem);
    2061 ideal J = system("freegb",I,d,nvars(r));
    2062 lpDimCheck(J);
    2063 sickle(J,1,1,1,d); // dimension is 24872
    2064 
    2065 
    2066 LIB "fpadim.lib";
    2067 ring r = 0,(x,y,z),dp;
    2068 int d =10; // degree
    2069 def R = makeLetterplaceRing(d);
    2070 setring R;
    2071 ideal I = x(1)*y(2) + y(1)*z(2), x(1)*x(2) + x(1)*y(2) - y(1)*x(2) - y(1)*y(2);
    2072 option(prot);
    2073 option(redSB);option(redTail);option(mem);
    2074 ideal J = system("freegb",I,d,3);
    2075 lpDimCheck(J);
    2076 sickle(J,1,1,1,d);
     2051  Here are some examples, which can also be found in [studzins]:
     2052
     2053  // takes up to 880Mb of memory
     2054  LIB "fpadim.lib";
     2055  ring r = 0,(x,y,z),dp;
     2056  int d =10; // degree
     2057  def R = makeLetterplaceRing(d);
     2058  setring R;
     2059  ideal I =
     2060  z(1)*z(2)*z(3)*z(4) + y(1)*x(2)*y(3)*x(4) - x(1)*y(2)*y(3)*x(4) - 3*z(1)*y(2)*x(3)*z(4), x(1)*x(2)*x(3) + y(1)*x(2)*y(3) - x(1)*y(2)*x(3), z(1)*y(2)*x(3)-x(1)*y(2)*z(3) + z(1)*x(2)*z(3);
     2061  option(prot);
     2062  option(redSB);option(redTail);option(mem);
     2063  ideal J = system("freegb",I,d,nvars(r));
     2064  lpDimCheck(J);
     2065  sickle(J,1,1,1,d); // dimension is 24872
     2066
     2067
     2068  LIB "fpadim.lib";
     2069  ring r = 0,(x,y,z),dp;
     2070  int d =10; // degree
     2071  def R = makeLetterplaceRing(d);
     2072  setring R;
     2073  ideal I = x(1)*y(2) + y(1)*z(2), x(1)*x(2) + x(1)*y(2) - y(1)*x(2) - y(1)*y(2);
     2074  option(prot);
     2075  option(redSB);option(redTail);option(mem);
     2076  ideal J = system("freegb",I,d,3);
     2077  lpDimCheck(J);
     2078  sickle(J,1,1,1,d);
    20772079*/
Note: See TracChangeset for help on using the changeset viewer.