Changeset 52ac08 in git


Ignore:
Timestamp:
Mar 16, 2018, 6:28:12 PM (5 years ago)
Author:
Karim Abou Zeid <karim23697@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a657104b677b4c461d018cbf3204d72d34ad66a9')
Children:
0ffcd2e4895401f8aa6557ccbabaca11e287d05a
Parents:
0be0394f8808f23d95c9df90daf22918ecc53e4925c1b81b33a57f7dd03b06ccb5e90cbfeb1e77f8
Message:
Merge branch 'shiftinvariant' into stable
Location:
Singular/LIB
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/fpadim.lib

    r25c1b8 r52ac08  
    23782378  return (words);
    23792379}
    2380 example {
     2380example
     2381{
    23812382  "EXAMPLE:"; echo = 2;
    23822383  ring r = 0,(a,b,c),dp;
     
    23992400  return(ivL2lpI(ivMaxIdeal(d, donly)));
    24002401}
    2401 example {
     2402example
     2403{
    24022404  "EXAMPLE:"; echo = 2;
    24032405  ring r = 0,(a,b,c),dp;
     
    24892491  return(I);
    24902492}
    2491 example {
     2493example
     2494{
    24922495  "EXAMPLE:"; echo = 2;
    24932496  ring r = 0,(x,y),dp;
  • Singular/LIB/fpaprops.lib

    r0be039 r52ac08  
    12911291  def R = lpDelVar(2); setring R; R;
    12921292}
     1293
  • Singular/LIB/freegb.lib

    r0be039 r52ac08  
    25242524  int uptodeg = attrib(basering,"uptodeg");
    25252525  int lV = attrib(basering,"lV");
    2526   if (deg(a) + i > uptodeg)
    2527   {
    2528     ERROR("degree bound violated by the shift!");
    2529   }
    25302526  return(system("stest",a,i,uptodeg,lV));
    25312527}
     
    25422538}
    25432539
     2540proc lastBlock(poly p)
     2541"USAGE:  lastBlock(p); p letterplace poly
     2542RETURN: int
     2543ASSUME: basering has letterplace ring structure
     2544PURPOSE: get the number of the last block occuring in the poly
     2545EXAMPLE: example lastBlock; shows examples
     2546"
     2547{
     2548  if (lpAssumeViolation())
     2549  {
     2550    ERROR("Incomplete Letterplace structure on the basering!");
     2551  }
     2552  int lV = attrib(basering,"lV");
     2553  // calls pLastVblock(p,lV);
     2554  return(system("btest",p,lV));
     2555}
     2556example
     2557{
     2558  "EXAMPLE:"; echo = 2;
     2559  ring r = 0,(x,y,z),dp;
     2560  int uptodeg = 5;
     2561  def R = makeLetterplaceRing(uptodeg);
     2562  setring R;
     2563  poly f = x(1)*z(2)*y(3) - 2*z(1)*y(2) + 3*x(1);
     2564  lastBlock(f); // should be 3
     2565}
    25442566
    25452567static proc mmLiebr(poly a, poly b)
     
    35623584}
    35633585
    3564 
     3586proc isOrderingShiftInvariant(int withHoles)
     3587  "USAGE: isOrderingShiftInvariant(b); b an integer interpreted as a boolean
     3588  RETURN: int
     3589  NOTE: Tests whether the ordering of the current ring is shift invariant, which is the case, when LM(p) > LM(p') for all p and p' where p' is p shifted by any number of places.
     3590@*      If withHoles != 0 even Letterplace polynomials with holes (eg. x(1)*y(4)) are considered.
     3591  ASSUME: - basering is a Letterplace ring.
     3592  "
     3593{
     3594  int shiftInvariant = 1;
     3595
     3596  int n = attrib(basering, "lV");
     3597  int d = attrib(basering, "uptodeg");
     3598
     3599  ideal monomials;
     3600  if (withHoles) {
     3601    monomials = delete(lpMonomialsWithHoles(d-1), 1); // ignore the first element (1)
     3602  } else {
     3603    monomials = lpMaxIdeal(d-1, 0);
     3604  }
     3605
     3606  for (int i = 1; i <= size(monomials); i++) {
     3607    poly monom = monomials[i];
     3608    int lastblock = lastBlock(monom);
     3609    for (int s = 1; s <= d - lastblock; s++) {
     3610      for (int s2 = 0; s2 < s; s2++) { // paranoid, check every pair
     3611        poly first = shiftPoly(monom,s2);
     3612        poly second = shiftPoly(monom,s);
     3613        if (!(first > second)) {
     3614          dbprint(string(first) + " <= " + string(second));
     3615          shiftInvariant = 0;
     3616        }
     3617        kill first; kill second;
     3618      } kill s2;
     3619    } kill s;
     3620    kill monom; kill lastblock;
     3621  } kill i;
     3622
     3623  return(shiftInvariant);
     3624}
     3625example
     3626{
     3627  "EXAMPLE:"; echo = 2;
     3628  ring r = 0,(x,y,z),dp;
     3629  def R = makeLetterplaceRing(5);
     3630  setring R;
     3631  isOrderingShiftInvariant(0);// should be 1
     3632
     3633  ring r = 0,(x,y,z),dp;
     3634  def R = makeLetterplaceRing(5);
     3635  list RL = ringlist(R);
     3636  RL[3][1][1] = "wp";
     3637  intvec weights = 1,1,1,1,1,1,1,2,3,1,1,1,1,1,1;
     3638  RL[3][1][2] = weights;
     3639  def Rw = setLetterplaceAttributes(ring(RL),5,3);
     3640  setring Rw;
     3641  printlevel = voice + 1;
     3642  isOrderingShiftInvariant(0);
     3643  isOrderingShiftInvariant(1);
     3644}
     3645
     3646static proc lpMonomialsWithHoles(int d)
     3647{
     3648  if (d < 0) {
     3649    ERROR("d must not be negative")
     3650  }
     3651
     3652  ideal monomials = 1;
     3653  if (d == 0) {
     3654     return (monomials);
     3655  }
     3656
     3657  int lV = attrib(basering, "lV"); // variable count
     3658  ideal prevMonomials = lpMonomialsWithHoles(d - 1);
     3659
     3660  for (int i = 1; i <= size(prevMonomials); i++) {
     3661    /* if (deg(prevMonomials[i]) >= d - 1) { */
     3662      for (int j = 1; j <= lV; j++) {
     3663        poly m = prevMonomials[i];
     3664        m = m * var(j + (d-1)*lV);
     3665        monomials = monomials, m;
     3666        kill m;
     3667      } kill j;
     3668    /* } */
     3669  } kill i;
     3670
     3671  if (d > 1) {
     3672    // removes the 1
     3673    monomials[1] = 0;
     3674    monomials = simplify(monomials,2);
     3675
     3676    monomials = prevMonomials, monomials;
     3677  }
     3678  return (monomials);
     3679}
    35653680
    35663681
Note: See TracChangeset for help on using the changeset viewer.