Changeset 17bad9 in git


Ignore:
Timestamp:
Dec 12, 2018, 4:20:51 PM (5 years ago)
Author:
Karim Abou Zeid <karim.abou.zeid@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
46a76ba9bfad59f96c1075c0730715fb0e47c6f1
Parents:
f04e8db1241a45b11103d9b24bd600bb1906a278
Message:
Updated libraries and tests for lpDegBound, lpBlockSize and isFreeAlgebra
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/fpadim.lib

    rf04e8db r17bad9  
    132132"PURPOSE: Checks, if all the Assumptions are holding
    133133"
    134 {if (attrib(basering,"isLetterplaceRing")==0) {ERROR("Basering is not a Letterplace ring!");}
    135   if (d > attrib(basering,"uptodeg")) {ERROR("Specified degree bound exceeds ring parameter!");}
     134{if (!isFreeAlgebra(basering)) {ERROR("Basering is not a Letterplace ring!");}
     135  if (d > lpDegBound(basering)) {ERROR("Specified degree bound exceeds ring parameter!");}
    136136  int i;
    137137  for (i = 1; i <= size(L); i++)
    138   {if (entryViolation(L[i], attrib(basering,"isLetterplaceRing")))
     138  {if (entryViolation(L[i], lpBlockSize(basering)))
    139139    {ERROR("Not allowed monomial/intvec found!");}
    140140  }
     
    907907  // construct the Graph of normal words [Studzinski page 78]
    908908  // construct set of vertices
    909   int v = attrib(basering,"isLetterplaceRing"); int d = attrib(basering,"uptodeg");
     909  int v = lpBlockSize(basering); int d = lpDegBound(basering);
    910910  ideal V; poly p,q,w;
    911911  ideal LG = lead(G);
     
    16911691EXAMPLE: example lpDHilbert; shows examples
    16921692"
    1693 {int degbound = attrib(basering,"uptodeg");int n = attrib(basering, "isLetterplaceRing");
     1693{int degbound = lpDegBound(basering);int n = lpBlockSize(basering);
    16941694  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
    16951695  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
     
    17331733EXAMPLE: example lpDHilbertSickle; shows examples
    17341734"
    1735 {int degbound = attrib(basering,"uptodeg");int n = attrib(basering, "isLetterplaceRing");
     1735{int degbound = lpDegBound(basering);int n = lpBlockSize(basering);
    17361736  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
    17371737  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
     
    17781778SEE ALSO: ncHilb_lib
    17791779"
    1780 {int degbound = attrib(basering,"uptodeg");int n = attrib(basering, "isLetterplaceRing");
     1780{int degbound = lpDegBound(basering);int n = lpBlockSize(basering);
    17811781  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
    17821782  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
     
    18091809EXAMPLE: example lpKDimCheck; shows examples
    18101810"
    1811 {int n = attrib(basering,"isLetterplaceRing");
     1811{int n = lpBlockSize(basering);
    18121812  list L;
    18131813  ideal R;
     
    18441844EXAMPLE: example lpKDim; shows examples
    18451845"
    1846 {int degbound = attrib(basering, "uptodeg");int n = attrib(basering, "isLetterplaceRing");
     1846{int degbound = lpDegBound(basering);int n = lpBlockSize(basering);
    18471847  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
    18481848  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
     
    19481948EXAMPLE: example lpSickle; shows examples
    19491949"
    1950 {int degbound = attrib(basering,"uptodeg"); int n = attrib(basering, "isLetterplaceRing");
     1950{int degbound = lpDegBound(basering); int n = lpBlockSize(basering);
    19511951  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
    19521952  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
     
    19881988EXAMPLE: example lpSickleDim; shows examples
    19891989"
    1990 {int degbound = attrib(basering,"uptodeg");int n = attrib(basering, "isLetterplaceRing");
     1990{int degbound = lpDegBound(basering);int n = lpBlockSize(basering);
    19911991  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
    19921992  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
     
    20282028EXAMPLE: example lpSickleHil; shows examples
    20292029"
    2030 {int degbound = attrib(basering,"uptodeg");int n = attrib(basering, "isLetterplaceRing");
     2030{int degbound = lpDegBound(basering);int n = lpBlockSize(basering);
    20312031  if (size(#) > 0){if (typeof(#[1])=="int"){if (#[1] >= 0){degbound = #[1];}}}
    20322032  if (size(#) > 1){if (typeof(#[1])=="int"){if (#[2] > 0){n = #[2];}}}
     
    20752075"
    20762076{int m,d,h,degbound;
    2077   m = 1; d = 0; h = 0; degbound = attrib(basering,"uptodeg");
     2077  m = 1; d = 0; h = 0; degbound = lpDegBound(basering);
    20782078  if (size(#) > 0) {if (typeof(#[1])=="int"){if (#[1] < 1) {m = 0;}}}
    20792079  if (size(#) > 1) {if (typeof(#[1])=="int"){if (#[2] > 0) {d = 1;}}}
     
    20822082  if (m == 1)
    20832083  {if (d == 0)
    2084     {if (h == 0) {return(lpSickle(G,degbound,attrib(basering,"isLetterplaceRing")));}
    2085       else        {return(lpSickleHil(G,degbound,attrib(basering,"isLetterplaceRing")));}
     2084    {if (h == 0) {return(lpSickle(G,degbound,lpBlockSize(basering)));}
     2085      else        {return(lpSickleHil(G,degbound,lpBlockSize(basering)));}
    20862086    }
    20872087    else
    2088     {if (h == 0) {return(lpSickleDim(G,degbound,attrib(basering,"isLetterplaceRing")));}
    2089       else {return(lpDHilbertSickle(G,degbound,attrib(basering,"isLetterplaceRing")));}
     2088    {if (h == 0) {return(lpSickleDim(G,degbound,lpBlockSize(basering)));}
     2089      else {return(lpDHilbertSickle(G,degbound,lpBlockSize(basering)));}
    20902090    }
    20912091  }
     
    20932093  {if (d == 0)
    20942094    {if (h == 0) {ERROR("You request to do nothing, so relax and do so");}
    2095       else        {return(lpHilbert(G,degbound,attrib(basering,"isLetterplaceRing")));}
     2095      else        {return(lpHilbert(G,degbound,lpBlockSize(basering)));}
    20962096    }
    20972097    else
    2098     {if (h == 0) {return(lpKDim(G,degbound,attrib(basering,"isLetterplaceRing")));}
    2099       else {return(lpDHilbert(G,degbound,attrib(basering,"isLetterplaceRing")));}
     2098    {if (h == 0) {return(lpKDim(G,degbound,lpBlockSize(basering)));}
     2099      else {return(lpDHilbert(G,degbound,lpBlockSize(basering)));}
    21002100    }
    21012101  }
  • Singular/LIB/fpaprops.lib

    rf04e8db r17bad9  
    9191  // if longest word has length 1 we handle it as a special case
    9292  if (l == 1) {
    93     int n = attrib(basering, "isLetterplaceRing"); // variable count
     93    int n = lpBlockSize(basering); // variable count
    9494    int k = size(G);
    9595    if (k == n) { // only the field left
     
    746746    ERROR("Ufnarovskij graph not implemented for l = 1");
    747747  }
    748   int lV = attrib(basering, "isLetterplaceRing");
     748  int lV = lpBlockSize(basering);
    749749  // TODO: what if l <= 0?
    750750  dbprint("computing standard words");
     
    836836    return (words); // no standard words
    837837  }
    838   int lV = attrib(basering, "isLetterplaceRing"); // variable count
     838  int lV = lpBlockSize(basering); // variable count
    839839  list prevWords = ivStandardWords(G, length - 1);
    840840  list words;
     
    907907  // if longest word has length 1, or G is the zero ideal, we handle it as a special case
    908908  if (l == 1 || size(G) == 0) {
    909     int n = attrib(basering, "isLetterplaceRing"); // variable count
     909    int n = lpBlockSize(basering); // variable count
    910910    int k = size(G);
    911911    if (k == n) { // V = {1} no edges
     
    10041004  if (size(G1) > 0) {
    10051005    while (size(G1) > 0) {
    1006       if (attrib(R, "isLetterplaceRing") > 1) {
    1007         ring R = lpDelVar(lp2iv(G1[1])[1]);
     1006      if (lpBlockSize(R) > 1) {
     1007        ring R = lpDelVar(lp2iv(G1[1])[1]); // TODO replace with proper method
    10081008        ideal G1 = imap(save,G1);
    10091009        G1 = simplify(G1, 2); // remove zero generators
     
    10781078{
    10791079  list LG = lpId2ivLi(lead(G));
    1080   int n = attrib(basering, "isLetterplaceRing");
     1080  int n = lpBlockSize(basering);
    10811081  int degbound = attrib(basering, "uptodeg");
    10821082
     
    13791379// removes a variable from a letterplace ring (a bit of a hack)
    13801380static proc lpDelVar(int index) {
    1381   int lV = attrib(basering, "isLetterplaceRing"); // number of variables in the main block
     1381  int lV = lpBlockSize(basering); // number of variables in the main block
    13821382  int d = attrib(basering, "uptodeg"); // degree bround
    13831383  list LR = ringlist(basering);
  • Singular/LIB/freegb.lib

    rf04e8db r17bad9  
    116116  attrib(RL, "maxExp", 1);
    117117  def @R = ring(RL);
    118   attrib(@R, "uptodeg", uptodeg);
     118  attrib(@R, "uptodeg", uptodeg); // no longer needed
    119119  attrib(@R, "isLetterplaceRing", lV);
    120120  return (@R);
     
    125125  ring r = 0,(x(1),y(1),x(2),y(2),x(3),y(3),x(4),y(4)),dp;
    126126  def R = setLetterplaceAttributes(r, 4, 2); setring R;
    127   attrib(R,"isLetterplaceRing");
     127  lpBlockSize(R);
    128128  lieBracket(x(1),y(1),2);
    129129}
     
    11271127  def A = makeLetterplaceRing(2); // same as  makeLetterplaceRing(2,0)
    11281128  setring A;  A;
    1129   attrib(A,"isLetterplaceRing");
    1130   attrib(A,"uptodeg");  // degree bound
     1129  lpBlockSize(A);
     1130  lpDegBound(A);  // degree bound
    11311131  setring r; def B = makeLetterplaceRing(2,1); // to compare:
    11321132  setring B;  B;
    1133   attrib(B,"isLetterplaceRing");
    1134   attrib(B,"uptodeg");  // degree bound
     1133  lpBlockSize(B);
     1134  lpDegBound(B);  // degree bound
    11351135  setring r; def C = makeLetterplaceRing(2,2); // to compare:
    11361136  setring C;  C;
    1137   attrib(C,"isLetterplaceRing");
    1138   attrib(C,"uptodeg");  // degree bound
     1137  lpDegBound(C);
     1138  lpDegBound(C);  // degree bound
    11391139}
    11401140
     
    12181218  setring A;
    12191219  A;
    1220   attrib(A,"isLetterplaceRing");// number of variables in the main block
    1221   attrib(A,"uptodeg");  // degree bound
     1220  lpBlockSize(A);// number of variables in the main block
     1221  lpDegBound(A);  // degree bound
    12221222}
    12231223
     
    13231323  setring A;
    13241324  A;
    1325   attrib(A,"isLetterplaceRing"); // number of variables in the main block
    1326   attrib(A,"uptodeg");  // degree bound
     1325  lpBlockSize(A); // number of variables in the main block
     1326  lpDegBound(A);  // degree bound
    13271327}
    13281328
     
    13871387  setring A;
    13881388  A;
    1389   attrib(A,"isLetterplaceRing"); // number of variables in the main block
    1390   attrib(A,"uptodeg");  // degree bound
     1389  lpBlockSize(A); // number of variables in the main block
     1390  lpDegBound(A);  // degree bound
    13911391}
    13921392
     
    14931493  setring A;
    14941494  A;
    1495   attrib(A,"isLetterplaceRing"); // number of variables in the main block
    1496   attrib(A,"uptodeg");  // degree bound
     1495  lpBlockSize(A); // number of variables in the main block
     1496  lpDegBound(A);  // degree bound
    14971497}
    14981498
     
    27542754//   }
    27552755//   intvec v = w;
    2756 //   for(i=1; i< attrib(basering,"uptodeg"); i++)
     2756//   for(i=1; i< lpDegBound(basering); i++)
    27572757//   {
    27582758//     v = v,w;
     
    29402940  // make new ring
    29412941  def save = basering;
    2942   int norigvars = attrib(save, "isLetterplaceRing");
     2942  int norigvars = lpBlockSize(save);
    29432943  def Rtagged; def temp = save;
    29442944  for (int i = 1; i <= size(I); i++) {
     
    29472947  } kill i;
    29482948  // currently R + "var" doesn't preserve uptodeg
    2949   Rtagged = setLetterplaceAttributes(Rtagged, attrib(Rtagged, "isLetterplaceRing"), attrib(save, "uptodeg"));
     2949  Rtagged = setLetterplaceAttributes(Rtagged, lpBlockSize(Rtagged), lpDegBound(save));
    29502950  setring Rtagged;
    29512951
     
    30593059{if (I==intvec(0)) {return(intvec(0));}
    30603060 int j,k,l;
    3061  int n = attrib(basering,"isLetterplaceRing"); int d = attrib(basering,"uptodeg");
     3061 int n = lpBlockSize(basering); int d = lpDegBound(basering);
    30623062 intvec w; j = 1;
    30633063 while (j <= d)
     
    30953095"
    30963096{int i,j,k,r1,r2; intvec D;
    3097  int n = attrib(basering,"isLetterplaceRing");
     3097 int n = lpBlockSize(basering);
    30983098 k = size(V) div n; r1 = 0; r2 = 0;
    30993099 for (i=1; i<= k; i++)
     
    31403140
    31413141 int i,j,r; intvec T; list R;
    3142  int n = attrib(basering,"isLetterplaceRing");
     3142 int n = lpBlockSize(basering);
    31433143 int k = size(V) - size(W) + 1;
    31443144 if (intvec(V[1..size(W)])-W == 0){R[1]=0;}
     
    32413241  int shiftInvariant = 1;
    32423242
    3243   int n = attrib(basering, "isLetterplaceRing");
    3244   int d = attrib(basering, "uptodeg");
     3243  int n = lpDegBound(basering);
     3244  int d = lpDegBound(basering);
    32453245
    32463246  ideal monomials;
     
    33093309  }
    33103310
    3311   int lV = attrib(basering, "isLetterplaceRing"); // variable count
     3311  int lV = lpBlockSize(basering); // variable count
    33123312  ideal prevMonomials = lpMonomialsWithHoles(d - 1);
    33133313
     
    33353335static proc getlpCoeffs(poly q, poly p)
    33363336{list R; intvec cq,t,lv,rv,bla;
    3337  int n = attrib(basering,"isLetterplaceRing"); int d = attrib(basering,"uptodeg");
     3337 int n = lpBlockSize(basering); int d = lpDegBound(basering);
    33383338 int i;
    33393339 cq = leadexp(p)-leadexp(q); /* p/q */
     
    33793379"PURPOSE: Checks, if all the Assumptions are holding
    33803380"
    3381 {if (attrib(basering,"isLetterplaceRing")==0) {ERROR("Basering is not a Letterplace ring!");}
    3382   if (d > attrib(basering,"uptodeg")) {ERROR("Specified degree bound exceeds ring parameter!");}
     3381{if (!isFreeAlgebra(basering)) {ERROR("Basering is not a Letterplace ring!");}
     3382  if (d > lpDegBound(basering)) {ERROR("Specified degree bound exceeds ring parameter!");}
    33833383  int i;
    33843384  for (i = 1; i <= size(L); i++)
    3385   {if (entryViolation(L[i], attrib(basering,"isLetterplaceRing")))
     3385  {if (entryViolation(L[i], lpBlockSize(basering)))
    33863386    {ERROR("Not allowed monomial/intvec found!");}
    33873387  }
     
    34013401"
    34023402"
    3403 {if (attrib(basering,"isLetterplaceRing")==0) {ERROR("Basering is not a Letterplace ring!");}
     3403{if (!isFreeAlgebra(basering)) {ERROR("Basering is not a Letterplace ring!");}
    34043404 return();
    34053405}
     
    34273427{int r = 0; intvec w;
    34283428 intvec l = leadexp(p);
    3429  int n = attrib(basering,"isLetterplaceRing"); int d = attrib(basering,"uptodeg");
     3429 int n = lpBlockSize(basering); int d = lpDegBound(basering);
    34303430 int i,j,c,c1;
    34313431 while (1 <= d)
     
    35393539  // uptodeg and lV are defined
    35403540  // returns Boolean : yes/no [for assume violation]
    3541   def uptodeg = attrib(basering,"uptodeg");
     3541  def uptodeg = lpDegBound(basering);
    35423542  if ( typeof(uptodeg)!="int" )
    35433543  {
    35443544    return(1);
    35453545  }
    3546   int lV = attrib(basering,"isLetterplaceRing");
    3547   // isLetterplaceRing for rings is always defined and of type int
    3548   if ( lV==0 )
    3549   {
    3550     return(1);
    3551   }
    3552   return(0);
     3546  return (!isFreeAlgebra(basering))
    35533547}
    35543548
     
    37063700{if (I[1] == 0) {return(1);}
    37073701  int i = size(I);
    3708   if (i > attrib(basering,"uptodeg")) {ERROR("polynomial exceeds degreebound");}
     3702  if (i > lpDegBound(basering)) {ERROR("polynomial exceeds degreebound");}
    37093703  int j; poly p = 1;
    37103704  for (j = 1; j <= i; j++) {if (I[j] > 0) { p = p*var(I[j]);}} //ignore zeroes, because they correspond to 1
     
    38243818  intvec I;
    38253819  int i,j;
    3826   if (deg(p) > attrib(basering,"uptodeg")) {ERROR("Monomial exceeds degreebound");}
     3820  if (deg(p) > lpDegBound(basering)) {ERROR("Monomial exceeds degreebound");}
    38273821  if (p == 1) {return(I);}
    38283822  if (p == 0) {ERROR("Monomial is not allowed to equal zero");}
    38293823  intvec lep = leadexp(p);
    3830   for ( i = 1; i <= attrib(basering,"isLetterplaceRing"); i++) {if (lep[i] == 1) {I = i; break;}}
    3831   for (i = (attrib(basering,"isLetterplaceRing")+1); i <= size(lep); i++)
     3824  for ( i = 1; i <= lpBlockSize(basering); i++) {if (lep[i] == 1) {I = i; break;}}
     3825  for (i = (lpBlockSize(basering)+1); i <= size(lep); i++)
    38323826  {if (lep[i] == 1)
    3833     { j = (i mod attrib(basering,"isLetterplaceRing"));
    3834       if (j == 0) {I = I,attrib(basering,"isLetterplaceRing");}
     3827    { j = (i mod lpBlockSize(basering));
     3828      if (j == 0) {I = I,lpBlockSize(basering);}
    38353829      else {I = I,j;}
    38363830    }
  • Singular/LIB/ncHilb.lib

    rf04e8db r17bad9  
    6969EXAMPLE: example fpahilb; shows an example "
    7070{
    71     if (attrib(basering, "isLetterplaceRing")==0)
     71    if (!isFreeAlgebra(basering))
    7272    {
    7373      ERROR("Basering should be Letterplace ring");
     
    7575    def save = basering;
    7676    int sz=size(#);
    77     int lV=attrib(save,"isLetterplaceRing"); // nvars(orig comm ring)
     77    int lV=lpBlockSize(save); // nvars(orig comm ring)
    7878    int ig=0;
    7979    int mgrad=0;
     
    137137    }
    138138    // new: truncation should be < than degbound/2
    139     int degbnd = attrib(save,"uptodeg");
     139    int degbnd = lpDegBound(save);
    140140    if (tdeg == 0)
    141141    {
     
    403403EXAMPLE: example rcolon; shows an example"
    404404{
    405     int lV =  attrib(R,"isLetterplaceRing"); //nvars(save);
     405    int lV =  lpBlockSize(R); //nvars(save);
    406406    if (lV == 0)
    407407    {
     
    419419        }
    420420    }
    421     int degbnd = attrib(R,"uptodeg");
     421    int degbnd = lpDegBound(R);
    422422    if ( 2*maxdegI != degbnd)
    423423    {
  • Tst/Manual/makeLetterplaceRing.tst

    rf04e8db r17bad9  
    44def A = makeLetterplaceRing(2);
    55setring A;  A;
    6 attrib(A,"isLetterplaceRing");
    7 attrib(A,"uptodeg");  // degree bound
    8 attrib(A,"lV"); // number of variables in the main block
     6isFreeAlgebra(A);
     7lpDegBound(A);  // degree bound
     8lpBlockSize(A); // number of variables in the main block
    99setring r; def B = makeLetterplaceRing(2,1); // to compare:
    1010setring B;  B;
  • Tst/Manual/setLetterplaceAttributes.tst

    rf04e8db r17bad9  
    33ring r = 0,(x(1),y(1),x(2),y(2),x(3),y(3),x(4),y(4)),dp;
    44def R = setLetterplaceAttributes(r, 4, 2); setring R;
    5 attrib(R,"isLetterplaceRing");
     5isFreeAlgebra(R);
     6lpDegBound(R);
     7lpBlockSize(R);
    68lieBracket(x(1),y(1),2);
    79tst_status(1);$
Note: See TracChangeset for help on using the changeset viewer.