Changeset c01764 in git


Ignore:
Timestamp:
Mar 16, 2018, 6:30:03 PM (5 years ago)
Author:
Karim Abou Zeid <karim23697@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
01a1e69963e02904f3ebb7e48ddd938c9489cc76d1bb4ad41c5c390887e85591280f23792d561fb2
Parents:
0ffcd2e4895401f8aa6557ccbabaca11e287d05a9db8343e5043f1916262be4000d0b798d2cf2b8c
Message:
Merge branch 'fpalgebras' into stable
Location:
Singular/LIB
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/fpadim.lib

    r9db834 rc01764  
    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

    r9db834 rc01764  
    1919PROCEDURES:
    2020  lpNoetherian(<GB>);     check whether A/<GB> is (left/right) noetherian
    21   lpIsSemiPrime(<GB>);    check whether A/<GB> is semi prime
    22   lpIsPrime(<GB>);        check whether A/<GB> is prime
     21  lpIsSemiPrime(<GB>);    check whether A/<LM(GB)> is semi prime
     22  lpIsPrime(<GB>);        check whether A/<LM(GB)> is prime
    2323  lpGkDim(<GB>);          compute the Gelfand Kirillov dimension of A/<GB>
    2424  lpGlDimBound(<GB>);     compute an upper bound for the global dimension of A/<GB>
     
    3737@*      2 right noetherian
    3838@*      3 noetherian
    39 PURPOSE: Check whether R/<G> is (left/right) noetherian, where R is the basering
     39PURPOSE: Check whether A/<G> is (left/right) noetherian
    4040ASSUME: - basering is a Letterplace ring
    4141@*      - G is a Groebner basis
     
    108108  return (3 - inFlag - outFlag);
    109109}
    110 example {
     110example
     111{
    111112  "EXAMPLE:"; echo = 2;
    112113  ring r = 0,(x,y),dp;
     
    198199"USAGE: lpIsSemiPrime(G); G an ideal in a Letterplace ring
    199200RETURN: boolean
    200 PURPOSE: Check whether R/<G> is semi prime, where R is the basering
     201PURPOSE: Check whether A/<LM(G)> is semi prime, that is when p * (A/<LM(G)>) * p != 0 for all p in (A/<LM(G)> - {0}).
    201202ASSUME: - basering is a Letterplace ring
    202203      - G is a Groebner basis
     
    249250  return (1);
    250251}
    251 example {
     252example
     253{
    252254  "EXAMPLE:"; echo = 2;
    253255  ring r = 0,(x1,x2),dp;
     
    298300"USAGE: lpIsPrime(G); G an ideal in a Letterplace ring
    299301RETURN: boolean
    300 PURPOSE: Check whether R/<G> is prime, where R is the basering
     302PURPOSE: Check whether A/<LM(G)> is prime, that is when p1 * (A/<LM(G)>) * p2 != 0 for all p1, p2 in (A/<LM(G)> - {0}).
    301303ASSUME: - basering is a Letterplace ring
    302304      - G is a Groebner basis
     
    362364  return (1);
    363365}
    364 example {
     366example
     367{
    365368  "EXAMPLE:"; echo = 2;
    366369  ring r = 0,(x,y),dp;
     
    681684  return (UG);
    682685}
    683 example {
     686example
     687{
    684688  "EXAMPLE:"; echo = 2;
    685689  ring r = 0,(x,y,z),dp;
     
    10471051    for (int j = 1; j <= size(ivfi); j++) {
    10481052      int varindex = ivfi[j];
    1049       int subindex = lpIndexOf(s1, var(varindex));
    1050       if (subindex > 0) {
    1051         s2[subindex] = lpNF(s2[subindex],G);
    1052         fis = lpMult(fis, s2[subindex]);
    1053       } else {
    1054         fis = lpMult(fis, lpNF(iv2lp(varindex),G));
    1055       }
    1056       /*fis = lpNF(fis,G);*/
    1057       kill varindex; kill subindex;
     1053      if (varindex > 0) {
     1054        int subindex = lpIndexOf(s1, var(varindex));
     1055        if (subindex > 0) {
     1056          s2[subindex] = lpNF(s2[subindex],G);
     1057          fis = lpMult(fis, s2[subindex]);
     1058        } else {
     1059          fis = lpMult(fis, lpNF(iv2lp(varindex),G));
     1060        }
     1061        /*fis = lpNF(fis,G);*/
     1062        kill subindex;
     1063      }
     1064      kill varindex;
    10581065    } kill j;
    10591066    kill ivfi;
     
    10651072  return (fs);
    10661073}
    1067 example {
     1074example
     1075{
     1076  "EXAMPLE:"; echo = 2;
    10681077  //////// EXAMPLE A ////////
    10691078  ring r = 0,(x,y,z),dp;
     
    11441153    for (int j = 1; j <= size(ivfi); j++) {
    11451154      int varindex = ivfi[j];
    1146       int subindex = lpIndexOf(s1, var(varindex));
    1147       if (subindex > 0) {
    1148         tmpDegBound = tmpDegBound + deg(s2[subindex]);
    1149       } else {
    1150         tmpDegBound = tmpDegBound + 1;
    1151       }
    1152       kill varindex; kill subindex;
     1155      if (varindex > 0) {
     1156        int subindex = lpIndexOf(s1, var(varindex));
     1157        if (subindex > 0) {
     1158          tmpDegBound = tmpDegBound + deg(s2[subindex]);
     1159        } else {
     1160          tmpDegBound = tmpDegBound + 1;
     1161        }
     1162        kill subindex;
     1163      }
     1164      kill varindex;
    11531165    } kill j;
    11541166    if (tmpDegBound > maxDegBound) {
     
    11601172  // increase degbound by 50% when ideal is provided
    11611173  // needed for lpNF
    1162   maxDegBound = maxDegBound + maxDegBound/2;
     1174  maxDegBound = maxDegBound + (maxDegBound div 2);
    11631175
    11641176  return (maxDegBound);
    11651177}
    1166 example {
     1178example
     1179{
    11671180  // see lpSubstitute()
    11681181}
     
    11871200  return (maxDegBound);
    11881201}
    1189 example {
     1202example
     1203{
    11901204  // see lpSubstitute()
    11911205}
     
    12771291  def R = lpDelVar(2); setring R; R;
    12781292}
     1293
  • Singular/LIB/freegb.lib

    r9db834 rc01764  
    3737ademRelations(i,j);    compute the ideal of Adem relations for i<2j in char 0
    3838
     39lpPrint(ideal I, def @r); print a letterplace ideal as an easily readable string
     40
    3941SEE ALSO: fpadim_lib, LETTERPLACE
    4042";
     
    4951LIB "qhmoduli.lib"; // for Max
    5052LIB "bfun.lib"; // for inForm
     53LIB "fpadim.lib"; // for intvec conversion
    5154
    5255proc tstfreegb()
     
    25212524  int uptodeg = attrib(basering,"uptodeg");
    25222525  int lV = attrib(basering,"lV");
    2523   if (deg(a) + i > uptodeg)
    2524   {
    2525     ERROR("degree bound violated by the shift!");
    2526   }
    25272526  return(system("stest",a,i,uptodeg,lV));
    25282527}
     
    25392538}
    25402539
     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}
    25412566
    25422567static proc mmLiebr(poly a, poly b)
     
    32763301}
    32773302
     3303proc lpDivision(poly p, ideal I)
     3304"ASSUME: I is a Groebner basis G = {g1,...,gN}, the original ring of the Letterplace ring has the name 'r' and no variable is called 'tag_i' for i in 1...N
     3305RETURN: list L
     3306NOTE: - L[1] NF(p,I)
     3307      - L[2] list of expressions [i,l_{ij},r_{ij}] with \sum_{i,j} l_{ij} g_i r_{ij} = p - NF(p,I)
     3308"
     3309{
     3310  if (p == 0 || size(I) == 0) {
     3311    list L = 0;
     3312    list empty;
     3313    L[2] = empty;
     3314    return (L);
     3315  }
     3316  poly pNF = lpNF(p,I);
     3317  p = p - pNF;
     3318
     3319  // make new ring
     3320  def save = basering;
     3321  int norigvars = nvars(r);
     3322  string tagvarstr = "(tag_1";
     3323  for (int i = 2; i <= size(I); i++) {
     3324    tagvarstr = tagvarstr + ",tag_" + string(i);
     3325  } kill i;
     3326  tagvarstr = tagvarstr + ")";
     3327  string field = string(ringlist(r)[1]);
     3328  execute("ring @tags = " + field + "," + tagvarstr + ",dp;");
     3329  ring @tagged = (r + @tags);
     3330  def @R = makeLetterplaceRing(attrib(save,"uptodeg")); setring @R;
     3331
     3332  // restore vars
     3333  poly p = imap(save, p);
     3334  poly pNF = imap(save, pNF);
     3335  ideal I = imap(save, I);
     3336  for (int i = 1; i <= size(I); i++) {
     3337    I[i] = I[i] - var(norigvars + i);
     3338  } kill i;
     3339
     3340  list summands;
     3341  list L = pNF;
     3342  poly pTaggedNF = lpNF(p,I);
     3343  for (int i = 1; i <= size(pTaggedNF); i++) {
     3344    intvec iv = lp2iv(pTaggedNF[i]);
     3345    for (int j = 1; j <= size(iv); j++) {
     3346      if (iv[j] > norigvars) {
     3347        intvec left;
     3348        intvec right;
     3349        if (j > 1) {
     3350          left = iv[1..(j-1)];
     3351        }
     3352        if (j < size(iv)) {
     3353          right = iv[(j+1)..size(iv)];
     3354        }
     3355        list summand = (iv[j] - norigvars), leadcoef(pTaggedNF[i])*iv2lp(left), iv2lp(right);
     3356        summands = insert(summands, summand, size(summands));
     3357
     3358        kill left;
     3359        kill right;
     3360        kill summand;
     3361        break;
     3362      }
     3363    } kill j;
     3364    kill iv;
     3365  } kill i;
     3366
     3367  L[2] = summands;
     3368
     3369  setring save;
     3370  list L = imap(@R,L);
     3371  return (L);
     3372}
     3373
     3374proc lpGBPres2Poly(list L, ideal I)
     3375"ASSUME: L is a valid Groebner presentation as for example the result of lpDivision
     3376RETURN: poly
     3377NOTE: computes p = \sum_{i,j} l_{ij} g_i r_{ij} + NF(p,I) = \sum_{i} L[2][i][2] I[L[2][i][1]] L[2][i][3] + L[1]
     3378"
     3379{
     3380  poly p;
     3381  for (int i = 1; i <= size(L[2]); i++) {
     3382    p = p + lpMult(lpMult(L[2][i][2], I[L[2][i][1]]), L[2][i][3]);
     3383  }
     3384  p = p + L[1];
     3385  return (p);
     3386}
     3387
    32783388//procedures to convert monomials into the DVec representation, all static
    32793389////////////////////////////////////////////////////////
     
    34733583}
    34743584
    3475 
     3585proc isOrderingShiftInvariant(int withHoles)
     3586  "USAGE: isOrderingShiftInvariant(b); b an integer interpreted as a boolean
     3587  RETURN: int
     3588  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.
     3589@*      If withHoles != 0 even Letterplace polynomials with holes (eg. x(1)*y(4)) are considered.
     3590  ASSUME: - basering is a Letterplace ring.
     3591  "
     3592{
     3593  int shiftInvariant = 1;
     3594
     3595  int n = attrib(basering, "lV");
     3596  int d = attrib(basering, "uptodeg");
     3597
     3598  ideal monomials;
     3599  if (withHoles) {
     3600    monomials = delete(lpMonomialsWithHoles(d-1), 1); // ignore the first element (1)
     3601  } else {
     3602    monomials = lpMaxIdeal(d-1, 0);
     3603  }
     3604
     3605  for (int i = 1; i <= size(monomials); i++) {
     3606    poly monom = monomials[i];
     3607    int lastblock = lastBlock(monom);
     3608    for (int s = 1; s <= d - lastblock; s++) {
     3609      for (int s2 = 0; s2 < s; s2++) { // paranoid, check every pair
     3610        poly first = shiftPoly(monom,s2);
     3611        poly second = shiftPoly(monom,s);
     3612        if (!(first > second)) {
     3613          dbprint(string(first) + " <= " + string(second));
     3614          shiftInvariant = 0;
     3615        }
     3616        kill first; kill second;
     3617      } kill s2;
     3618    } kill s;
     3619    kill monom; kill lastblock;
     3620  } kill i;
     3621
     3622  return(shiftInvariant);
     3623}
     3624example
     3625{
     3626  "EXAMPLE:"; echo = 2;
     3627  ring r = 0,(x,y,z),dp;
     3628  def R = makeLetterplaceRing(5);
     3629  setring R;
     3630  isOrderingShiftInvariant(0);// should be 1
     3631
     3632  ring r = 0,(x,y,z),dp;
     3633  def R = makeLetterplaceRing(5);
     3634  list RL = ringlist(R);
     3635  RL[3][1][1] = "wp";
     3636  intvec weights = 1,1,1,1,1,1,1,2,3,1,1,1,1,1,1;
     3637  RL[3][1][2] = weights;
     3638  def Rw = setLetterplaceAttributes(ring(RL),5,3);
     3639  setring Rw;
     3640  printlevel = voice + 1;
     3641  isOrderingShiftInvariant(0);
     3642  isOrderingShiftInvariant(1);
     3643}
     3644
     3645static proc lpMonomialsWithHoles(int d)
     3646{
     3647  if (d < 0) {
     3648    ERROR("d must not be negative")
     3649  }
     3650
     3651  ideal monomials = 1;
     3652  if (d == 0) {
     3653     return (monomials);
     3654  }
     3655
     3656  int lV = attrib(basering, "lV"); // variable count
     3657  ideal prevMonomials = lpMonomialsWithHoles(d - 1);
     3658
     3659  for (int i = 1; i <= size(prevMonomials); i++) {
     3660    /* if (deg(prevMonomials[i]) >= d - 1) { */
     3661      for (int j = 1; j <= lV; j++) {
     3662        poly m = prevMonomials[i];
     3663        m = m * var(j + (d-1)*lV);
     3664        monomials = monomials, m;
     3665        kill m;
     3666      } kill j;
     3667    /* } */
     3668  } kill i;
     3669
     3670  if (d > 1) {
     3671    // removes the 1
     3672    monomials[1] = 0;
     3673    monomials = simplify(monomials,2);
     3674
     3675    monomials = prevMonomials, monomials;
     3676  }
     3677  return (monomials);
     3678}
    34763679
    34773680
     
    34793682
    34803683static proc getlpCoeffs(poly q, poly p)
    3481 "
    3482 "
    34833684{list R; poly m; intvec cq,t,lv,rv,bla;
    34843685 int n = attrib(basering,"lV"); int d = attrib(basering,"uptodeg");
     
    35033704"
    35043705{poly l,r,qt; int i;
    3505  g = shiftPoly(g,s);
    3506  list K = getlpCoeffs(lead(g),lead(p));
     3706 list K = getlpCoeffs(lead(shiftPoly(g,s)), lead(p));
    35073707 l = K[1]; r = K[2];
    35083708 kill K;
    35093709 for (i = 1; i <= size(g); i++)
    3510  {qt = qt + lpMult(lpMult(l,g[i]),r);
     3710 {
     3711   qt = qt + lpMult(lpMult(l,g[i]),r);
    35113712 }
    3512  return((leadcoef(qt)*p - leadcoef(p)*qt));
     3713 return(p - leadcoef(p)*normalize(qt));
    35133714}
    35143715
     
    37303931  lpMultX(b,a);
    37313932  lpMultX(a,b); // seems to work properly
     3933}
     3934
     3935proc lpPrint(ideal I, def @r)
     3936"USAGE: lpPrint(I, r); I an ideal, r a ring
     3937RETURN: list of strings
     3938PURPOSE: represent Letterplace ideal in the form of words
     3939ASSUME: - basering is a Letterplace ring, r is the commutative ring
     3940from which basering has been built
     3941EXAMPLE: example lpPrint; shows example
     3942"
     3943{
     3944        def save = basering;
     3945        lp2lstr(I,@r); // export an object called @code{@LN} to the ring r
     3946        setring @r;  // change to the ring r
     3947        list @L = lst2str(@LN,1);
     3948        export @L;
     3949        setring save;
     3950        list @@L = @L;
     3951        setring @r;
     3952        kill @L;
     3953        kill @LN;
     3954        setring save;
     3955        return(@@L);
     3956}
     3957example
     3958{
     3959 "EXAMPLE:"; echo = 2;
     3960 ring r = (0,a,b,g),(x,y),Dp;
     3961 def R = makeLetterplaceRing(4); // constructs a Letterplace ring
     3962 setring R; // downup algebra A
     3963 ideal J = x(1)*x(2)*y(3)-a*x(1)*y(2)*x(3) - b*y(1)*x(2)*x(3) - g*x(1),
     3964 x(1)*y(2)*y(3)-a*y(1)*x(2)*y(3) - b*y(1)*y(2)*x(3) - g*y(1);
     3965 list L = lpPrint(J,r);
     3966 L;
    37323967}
    37333968
Note: See TracChangeset for help on using the changeset viewer.