Changeset ed52bb in git


Ignore:
Timestamp:
Dec 11, 2017, 4:46:55 PM (6 years ago)
Author:
Karim Abou Zeid <karim23697@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
93abb9c89829d0418842e398902ce392bf28616e
Parents:
b61362c423ac6841ae7cfd90313d92230630e096
Message:
Add examples and monomialBasis()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/fpadim.lib

    rb61362 red52bb  
    23612361  return (words);
    23622362}
     2363example {
     2364  "EXAMPLE:"; echo = 2;
     2365  ring r = 0,(a,b,c),dp;
     2366  def R = makeLetterplaceRing(7); setring R;
     2367  ivMaxIdeal(1,0);
     2368  ivMaxIdeal(2,0);
     2369  ivMaxIdeal(2,1);
     2370  ivMaxIdeal(4,0);
     2371  ivMaxIdeal(4,1);
     2372}
    23632373
    23642374proc lpMaxIdeal(int d, donly)
    23652375{
    23662376  ivL2lpI(ivMaxIdeal(d, donly));
     2377}
     2378example {
     2379  "EXAMPLE:"; echo = 2;
     2380  ring r = 0,(a,b,c),dp;
     2381  def R = makeLetterplaceRing(7); setring R;
     2382  lpMaxIdeal(1,0);
     2383  lpMaxIdeal(2,0);
     2384  lpMaxIdeal(2,1);
     2385  lpMaxIdeal(4,0);
     2386  lpMaxIdeal(4,1);
     2387}
     2388
     2389proc monomialBasis(int d, int donly, ideal J)
     2390{
     2391  /*
     2392  TODO: doc
     2393  computes a list of free monomials in a Letterplace basering R
     2394  of degree at most d, where d <= degree bound (uptodeg) of R
     2395  - the ideal J has to be a Groebner basis up; if J is nonzero, then
     2396  the list of monomials, not contained in LM(J) is returned
     2397  - if donly <>0, only monomials of degree exactly d is returned
     2398  */
     2399  /*
     2400  history and changelog
     2401  old name: maxLPideal(int d, int donly) without I
     2402  problem: fpadim.lib needs nonzero ideal
     2403  motivation: unite everything
     2404  new idea: in presence of J, apply sickle
     2405  */
     2406  if (size(J)==0)
     2407  {
     2408    ideal I = maxLPideal(d,donly);
     2409    if (!donly)
     2410    {
     2411      // append 1 as the first element
     2412      I = 1, I;
     2413    }
     2414    return( I );
     2415  }
     2416  int nv = attrib(basering,"uptodeg");
     2417  if ((d>nv) || (d<0) )
     2418  {
     2419    ERROR("incorrect degree");
     2420  }
     2421  nv = attrib(basering,"lV"); // nvars
     2422  // ok, Sickle misbehaves: have to remove all
     2423  // elts from J of degree >d
     2424  ideal JJ;
     2425  int j; int sj = size(J);
     2426  int cnt=0;
     2427  for(j=1;j<=sj;j++)
     2428  {
     2429     if (deg(J[j]) <= d)
     2430        {
     2431             cnt++;
     2432                 JJ[cnt]=lead(J[j]); // only LMs are needed
     2433                  }
     2434  }
     2435  if (cnt==0)
     2436  {
     2437    // there are no elements in J of degree <= d
     2438    // return free stuff
     2439    return( monomialBasis(d, donly, std(0)) );
     2440  }
     2441  // from here on, Ibase is not zero
     2442  ideal Ibase = lpMis2Base(lpSickle(JJ,d)); // the complete K-basis modulo J up to d
     2443  if (!donly)
     2444  {
     2445    // for not donly, give everything back
     2446     return(Ibase);
     2447  }
     2448  /* !donly: pick out only monomials of degree d */
     2449  ideal I;
     2450  int i; int si = size(Ibase);
     2451  cnt=0;
     2452  for(i=1;i<=si;i++)
     2453  {
     2454     if (deg(Ibase[i]) == d)
     2455        {
     2456             cnt++;
     2457                 I[cnt]=Ibase[i];
     2458                  }
     2459  }
     2460  kill Ibase;
     2461  return(I);
     2462}
     2463example {
     2464  "EXAMPLE:"; echo = 2;
     2465  ring r = 0,(x,y),dp;
     2466  def R = makeLetterplaceRing(7); setring R;
     2467  ideal J = x(1)*y(2)*x(3) - y(1)*x(2)*y(3);
     2468  option(redSB); option(redTail);
     2469  J = letplaceGBasis(J);
     2470  J;
     2471  monomialBasis(2,1,std(0));
     2472  monomialBasis(2,0,std(0));
     2473  monomialBasis(3,1,J);
     2474  monomialBasis(3,0,J);
    23672475}
    23682476
Note: See TracChangeset for help on using the changeset viewer.