Changeset 91dd10f in git


Ignore:
Timestamp:
Feb 19, 2018, 4:12:01 PM (6 years ago)
Author:
Karim Abou Zeid <karim23697@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
372eea8de23123686035e3b95b7280c2a804aa88
Parents:
1af34f3a9d6f48f7bc59d937c310ee496a6c7258
Message:
Add proc for checking if ordering is shiftinvariant
Location:
Singular/LIB
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/fpaprops.lib

    r1af34f r91dd10f  
    12651265  def R = lpDelVar(2); setring R; R;
    12661266}
     1267
     1268proc isOrderingShiftInvariant(int withHoles)
     1269  "USAGE:
     1270  RETURN: int
     1271  ASSUME: - basering is a Letterplace ring.
     1272  "
     1273{
     1274  int shiftInvariant = 1;
     1275
     1276  int n = attrib(basering, "lV");
     1277  int d = attrib(basering, "uptodeg");
     1278
     1279  ideal monomials;
     1280  if (withHoles) {
     1281    monomials = delete(lpMonomialsWithHoles(d-1), 1); // ignore the first element (1)
     1282  } else {
     1283    monomials = lpMaxIdeal(d-1, 0);
     1284  }
     1285
     1286  for (int i = 1; i <= size(monomials); i++) {
     1287    poly monom = monomials[i];
     1288    int lastblock = lastBlock(monom);
     1289    for (int s = 1; s <= d - lastblock; s++) {
     1290      for (int s2 = 0; s2 < s; s2++) { // paranoid, check every pair
     1291        poly first = shiftPoly(monom,s2);
     1292        poly second = shiftPoly(monom,s);
     1293        if (!(first > second)) {
     1294          dbprint(string(first) + " <= " + string(second));
     1295          shiftInvariant = 0;
     1296        }
     1297        kill first; kill second;
     1298      } kill s2;
     1299    } kill s;
     1300    kill monom; kill lastblock;
     1301  } kill i;
     1302
     1303  return(shiftInvariant);
     1304}
     1305example
     1306{
     1307  "EXAMPLE:"; echo = 2;
     1308  ring r = 0,(x,y,z),dp;
     1309  def R = makeLetterplaceRing(5);
     1310  setring R;
     1311  isOrderingShiftInvariant(0);// should be 1
     1312
     1313  ring r = 0,(x,y,z),dp;
     1314  def R = makeLetterplaceRing(5);
     1315  list RL = ringlist(R);
     1316  RL[3][1][1] = "wp";
     1317  intvec weights = 1,1,1,1,1,1,1,2,3,1,1,1,1,1,1;
     1318  RL[3][1][2] = weights;
     1319  def Rw = setLetterplaceAttributes(ring(RL),5,3);
     1320  setring Rw;
     1321  printlevel = voice + 1;
     1322  isOrderingShiftInvariant(0);
     1323  isOrderingShiftInvariant(1);
     1324}
     1325
     1326proc lpMonomialsWithHoles(int d)
     1327{
     1328  if (d < 0) {
     1329    ERROR("d must not be negative")
     1330  }
     1331
     1332  ideal monomials = 1;
     1333  if (d == 0) {
     1334     return (monomials);
     1335  }
     1336
     1337  int lV = attrib(basering, "lV"); // variable count
     1338  ideal prevMonomials = lpMonomialsWithHoles(d - 1);
     1339
     1340  for (int i = 1; i <= size(prevMonomials); i++) {
     1341    /* if (deg(prevMonomials[i]) >= d - 1) { */
     1342      for (int j = 1; j <= lV; j++) {
     1343        poly m = prevMonomials[i];
     1344        m = m * var(j + (d-1)*lV);
     1345        monomials = monomials, m;
     1346        kill m;
     1347      } kill j;
     1348    /* } */
     1349  } kill i;
     1350
     1351  if (d > 1) {
     1352    // removes the 1
     1353    monomials[1] = 0;
     1354    monomials = simplify(monomials,2);
     1355
     1356    monomials = prevMonomials, monomials;
     1357  }
     1358  return (monomials);
     1359}
  • Singular/LIB/freegb.lib

    r1af34f r91dd10f  
    25212521  int uptodeg = attrib(basering,"uptodeg");
    25222522  int lV = attrib(basering,"lV");
    2523   if (deg(a) + i > uptodeg)
    2524   {
    2525     ERROR("degree bound violated by the shift!");
    2526   }
    25272523  return(system("stest",a,i,uptodeg,lV));
    25282524}
     
    25392535}
    25402536
     2537proc lastBlock(poly p)
     2538"USAGE:  lastBlock(p); p letterplace poly
     2539RETURN: int
     2540ASSUME: basering has letterplace ring structure
     2541PURPOSE: get the number of the last block occuring in the poly
     2542EXAMPLE: example lastBlock; shows examples
     2543"
     2544{
     2545  if (lpAssumeViolation())
     2546  {
     2547    ERROR("Incomplete Letterplace structure on the basering!");
     2548  }
     2549  int lV = attrib(basering,"lV");
     2550  // calls pLastVblock(p,lV);
     2551  return(system("btest",p,lV));
     2552}
     2553example
     2554{
     2555  "EXAMPLE:"; echo = 2;
     2556  ring r = 0,(x,y,z),dp;
     2557  int uptodeg = 5;
     2558  def R = makeLetterplaceRing(uptodeg);
     2559  setring R;
     2560  poly f = x(1)*z(2)*y(3) - 2*z(1)*y(2) + 3*x(1);
     2561  lastBlock(f); // should be 3
     2562}
    25412563
    25422564static proc mmLiebr(poly a, poly b)
Note: See TracChangeset for help on using the changeset viewer.