Changeset b840b1 in git for Singular/LIB/multigrading.lib


Ignore:
Timestamp:
Mar 22, 2011, 6:27:38 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
fd1b0f2e9e097faef7d6563aeb22798d790e146e
Parents:
086a962ad11bef0e873f25f43c9633ad85216bdb
Message:
FIX: minor fixes in multigrading.lib
ADD: changes by Lars
TODO: example for 'intersectLattices' (multigrading.lib) seems to be wrong...?

From: Oleksandr Motsak <motsak@mathematik.uni-kl.de>

git-svn-id: file:///usr/local/Singular/svn/trunk@14035 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/multigrading.lib

    r086a96 rb840b1  
    1212@*        Simon Keicher, keicher@mail.mathematik.uni-tuebingen.de
    1313@*        Oleksandr Motsak, U@D, where U={motsak}, D={mathematik.uni-kl.de}
    14 
    15 
    16 OVERVIEW: This library allows one to virtually add multigradings to Singular.
     14@*        Anna-Lena Winz, anna-lena.winz@math.fu-berlin.de
     15
     16OVERVIEW: This library allows one to virtually add multigradings to Singular:
     17grade multivariate polynomial rings with arbitrary (fin. gen. Abelian) groups.
    1718For more see http://code.google.com/p/convex-singular/wiki/Multigrading
    1819For theoretical references see:
    19 E. Miller, B. Sturmfels: 'Combinatorial Commutative Algebra' and
    20 M. Kreuzer, L. Robbiano: 'Computational Commutative Algebra'.
    21 
    22 NOTE: 'mDegBasis' relies on 4ti2 for computing Hilbert Bases.
     20@* E. Miller, B. Sturmfels: 'Combinatorial Commutative Algebra'
     21and
     22@* M. Kreuzer, L. Robbiano: 'Computational Commutative Algebra'.
     23
     24NOTE: 'multiDegBasis' relies on 4ti2 for computing Hilbert Bases.
    2325All groups are finitely generated Abelian
    2426
     
    5153latticeBasis(B);          computes an integral basis of the lattice B
    5254preimageLattice(P,L);     computes an integral basis for the preimage of the lattice L under the linear map P.
    53 projectLattices(B);       computes a linear map of lattices having the primitive span of B as its kernel.
     55projectLattice(B);        computes a linear map of lattices having the primitive span of B as its kernel.
    5456intersectLattices(A,B);   computes an integral basis for the intersection of the lattices A and B.
    5557isIntegralSurjective(P);  test whether the map P of lattices is surjective.
     
    6365productgroup(G,H);        create the group G x H
    6466
    65 mDeg(A);                  compute the multidegree of A
    66 mDegBasis(d);             compute all monomials of multidegree d
    67 mDegPartition(p);         compute the multigraded-homogeneous components of p
     67multiDeg(A);                  compute the multidegree of A
     68multiDegBasis(d);             compute all monomials of multidegree d
     69multiDegPartition(p);         compute the multigraded-homogeneous components of p
    6870
    6971isTorsionFree();          test whether the current multigrading is  free
     
    7375isHomogeneous(a);         test whether 'a' is multigraded-homogeneous
    7476
    75 equalMDeg(e1,e2[,V]);     test whether e1==e2 in the current multigrading
    76 
    77 mDegGroebner(M);          compute the multigraded GB/SB of M
    78 mDegSyzygy(M);            compute the multigraded syzygies of M
    79 mDegModulo(I,J);          compute the multigraded 'modulo' module of I and J
    80 mDegResolution(M,l[,m]);  compute the multigraded resolution of M
    81 mDegTensor(m,n);          compute the tensor product of multigraded modules m,n
    82 mDegTor(i,m,n);           compute the Tor_i(m,n) for multigraded modules m,n
     77equalMultiDeg(e1,e2[,V]);     test whether e1==e2 in the current multigrading
     78
     79multiDegGroebner(M);          compute the multigraded GB/SB of M
     80multiDegSyzygy(M);            compute the multigraded syzygies of M
     81multiDegModulo(I,J);          compute the multigraded 'modulo' module of I and J
     82multiDegResolution(M,l[,m]);  compute the multigraded resolution of M
     83multiDegTensor(m,n);          compute the tensor product of multigraded modules m,n
     84multiDegTor(i,m,n);           compute the Tor_i(m,n) for multigraded modules m,n
    8385
    8486defineHomogeneous(p);     get a grading group wrt which p becomes homogeneous
     
    104106LIB "standard.lib"; // for groebner
    105107LIB "lll.lib"; // for lll_matrix
    106 LIB "matrix.lib"; // for mDegTor
     108LIB "matrix.lib"; // for multiDegTor
    107109
    108110/******************************************************/
     
    174176  def dst = basering;
    175177
    176   intmat result_degs = mDeg(Im);
    177   print(result_degs);
     178  intmat result_degs = multiDeg(Im);
     179//  print(result_degs);
    178180
    179181  setring src;
    180182
    181   intmat input_degs = mDeg(maxideal(1));
    182   print(input_degs);
     183  intmat input_degs = multiDeg(maxideal(1));
     184//  print(input_degs);
    183185
    184186  def image_degs = A * input_degs;
    185   print( image_degs );
     187//  print( image_degs );
    186188
    187189  def df = image_degs - result_degs;
    188   print(df);
     190//  print(df);
    189191
    190192  setring dst;
     
    245247  print(B);
    246248
    247   isGradedRingHomomorphism(r, ideal(F), B);
    248   def hh = createGradedRingHomomorphism(r, ideal(F), B);
    249 
    250   if( defined(hh) ) { ERROR("That input was not valid"); }
     249  isGradedRingHomomorphism(r, ideal(F), B); // FALSE: there is no such homomorphism!
     250  // Therefore: the following command should return an error
     251  // createGradedRingHomomorphism(r, ideal(F), B);
     252
    251253}
    252254
     
    458460/******************************************************/
    459461proc setBaseMultigrading(intmat M, list #)
    460 "USAGE: setBaseMultigrading(M[, G]); M is an intege matrix, G is a group (or lattice)
     462"USAGE: setBaseMultigrading(M[, G]); M is an integer matrix, G is a group (or lattice)
    461463PURPOSE: attaches weights of variables and grading group to the basering.
    462464NOTE: M encodes the weights of variables column-wise.
     
    492494  if( !defined(L) ){ ERROR("Wrong arguments: no group given?"); }
    493495
    494 
    495 
    496496  attrib(basering, attrMgrad, M);
    497497  attrib(basering, attrGradingGroup, L);
     
    502502    "Warning: your quotient ideal is not homogenous (multigrading was set anyway)!";
    503503  }
    504 
    505 
    506 
    507504
    508505}
     
    10091006   isHomogeneous(I);
    10101007
    1011    intmat V = mDeg(I); print(V);
     1008   intmat V = multiDeg(I); print(V);
    10121009
    10131010   module S = syz(I); print(S);
     
    10201017   getModuleGrading(v) == V;
    10211018   isHomogeneous(v);
    1022    print( mDeg(v) );
     1019   print( multiDeg(v) );
    10231020
    10241021   isHomogeneous(S);
    1025    print( mDeg(S) );
     1022   print( multiDeg(S) );
    10261023}
    10271024
     
    10601057
    10611058   ideal I = x, y, xy^5;
    1062    intmat V = mDeg(I);
     1059   intmat V = multiDeg(I);
    10631060
    10641061   // V == M; modulo T
     
    10751072   getModuleGrading(v) == V;
    10761073
    1077    print( mDeg(v) );
     1074   print( multiDeg(v) );
    10781075
    10791076   isHomogeneous(S);
    10801077
    1081    print( mDeg(S) );
    1082 }
    1083 
    1084 
    1085 proc mDegTensor(module m, module n){
     1078   print( multiDeg(S) );
     1079}
     1080
     1081
     1082proc multiDegTensor(module m, module n){
    10861083  matrix M = m;
    10871084  matrix N = n;
     
    11401137mm = setModuleGrading(mm, gm);
    11411138nn = setModuleGrading(nn, gn);
    1142 module mmtnn = mDegTensor(mm, nn);
     1139module mmtnn = multiDegTensor(mm, nn);
    11431140print(mmtnn);
    11441141getModuleGrading(mmtnn);
     
    11591156mm = setModuleGrading(mm, gm);
    11601157nn = setModuleGrading(nn, gn);
    1161 module mmtnn = mDegTensor(mm, nn);
     1158module mmtnn = multiDegTensor(mm, nn);
    11621159print(mmtnn);
    11631160getModuleGrading(mmtnn);
     
    11681165}
    11691166
    1170 proc mDegTor(int i, module m, module n)
    1171 {
    1172   def res = mDegResolution(n, 0, 1);
     1167proc multiDegTor(int i, module m, module n)
     1168{
     1169  def res = multiDegResolution(n, 0, 1);
    11731170  //print(res);
    11741171  list l = res;
     
    11891186    freedim3 = setModuleGrading(freedim3, getModuleGrading(l[i]));
    11901187
    1191     module mimag = mDegTensor(freedim3, m);
     1188    module mimag = multiDegTensor(freedim3, m);
    11921189    //"mimag ok.";
    1193     module mf = mDegTensor(l[i], freedim);
     1190    module mf = multiDegTensor(l[i], freedim);
    11941191    //"mf ok.";
    1195     module mim1 = mDegTensor(freedim2 ,m);
    1196     module mim2 = mDegTensor(l[i+1],freedim);
     1192    module mim1 = multiDegTensor(freedim2 ,m);
     1193    module mim2 = multiDegTensor(l[i+1],freedim);
    11971194    //"mim1+2 ok.";
    1198     module mker = mDegModulo(mf,mimag);
     1195    module mker = multiDegModulo(mf,mimag);
    11991196    //"mker ok.";
    12001197    module mim = mim1,mim2;
     
    12061203    //matrix mimmat1[16][4]=mimmat[1..16,25..28];
    12071204    //print(mimmat1-matrix(mim2));
    1208     return(mDegModulo(mker,mim));
     1205    return(multiDegModulo(mker,mim));
    12091206    //return(0);
    12101207  }
     
    12191216setBaseMultigrading(g);
    12201217ideal i = maxideal(1);
    1221 module m = mDegSyzygy(i);
     1218module m = multiDegSyzygy(i);
    12221219module rt = Tor(2,m,m);
    1223 module mDegT = mDegTor(2,m,m);
    1224 print(matrix(rt)-matrix(mDegT));
     1220module multiDegT = multiDegTor(2,m,m);
     1221print(matrix(rt)-matrix(multiDegT));
    12251222/*
    12261223ring r = 0,(x),dp;
     
    12371234isHomogeneous(mm,"checkGens");
    12381235isHomogeneous(nn,"checkGens");
    1239 mDegTor(1,mm, nn);
     1236multiDegTor(1,mm, nn);
    12401237
    12411238kill m, mm, n, nn, gm, gn;
     
    12511248mm = setModuleGrading(mm, gm);
    12521249nn = setModuleGrading(nn, gn);
    1253 module mmtnn = mDegTensor(mm, nn);
     1250module mmtnn = multiDegTensor(mm, nn);
    12541251*/
    12551252}
     
    14401437    m= system ("LLL", m);
    14411438    list result= list();
     1439    intvec buf;
    14421440
    14431441    for (i= 1; i <= sizeA; i++)
    14441442    {
    1445       intvec buf= intvec (m[i , 1]);
    1446       for (j= 2; j <= columns; j++)
    1447       {
    1448         buf= buf,intvec (m [i, j]);
    1449       }
     1443      buf = intvec (m[i , 1..columns]);
    14501444      result= result+ list (buf);
    14511445
     
    17261720  poly f = z2;
    17271721
    1728  intmat m[5][2]=mDeg(a)-mDeg(b),mDeg(b)-mDeg(c),mDeg(c)-mDeg(d),mDeg(d)-mDeg(e),mDeg(e)-mDeg(f);
     1722 intmat m[5][2]=multiDeg(a)-multiDeg(b),multiDeg(b)-multiDeg(c),multiDeg(c)-multiDeg(d),multiDeg(d)-multiDeg(e),multiDeg(e)-multiDeg(f);
    17291723 m=transpose(m);
    17301724 areZeroElements(m);
     
    18161810  poly f = z2;
    18171811
    1818   intvec v1 = mDeg(a) - mDeg(b);
     1812  intvec v1 = multiDeg(a) - multiDeg(b);
    18191813  v1;
    18201814  isZeroElement(v1);
    18211815  isZeroElement(v1, tt);
    18221816
    1823   intvec v2 = mDeg(a) - mDeg(c);
     1817  intvec v2 = multiDeg(a) - multiDeg(c);
    18241818  v2;
    18251819  isZeroElement(v2);
    18261820  isZeroElement(v2, tt);
    18271821
    1828   intvec v3 = mDeg(e) - mDeg(f);
     1822  intvec v3 = multiDeg(e) - multiDeg(f);
    18291823  v3;
    18301824  isZeroElement(v3);
    18311825  isZeroElement(v3, tt);
    18321826
    1833   intvec v4 = mDeg(c) - mDeg(d);
     1827  intvec v4 = multiDeg(c) - multiDeg(d);
    18341828  v4;
    18351829  isZeroElement(v4);
     
    20992093
    21002094/******************************************************/
    2101 proc equalMDeg(intvec exp1, intvec exp2, list #)
    2102 "USAGE: equalMDeg(exp1, exp2[, V]); intvec exp1, exp2, intmat V
     2095proc equalMultiDeg(intvec exp1, intvec exp2, list #)
     2096"USAGE: equalMultiDeg(exp1, exp2[, V]); intvec exp1, exp2, intmat V
    21032097PURPOSE: Tests if the exponent vectors of two monomials (given by exp1 and exp2)
    21042098represent the same multidegree.
    21052099NOTE: the integer matrix V encodes multidegrees of module components,
    21062100if module component is present in exp1 and exp2
    2107 EXAMPLE: example equalMDeg; shows an example
     2101EXAMPLE: example equalMultiDeg; shows an example
    21082102"
    21092103{
     
    21762170
    21772171
    2178   equalMDeg(leadexp(a), leadexp(b));
    2179   equalMDeg(leadexp(a), leadexp(c));
    2180   equalMDeg(leadexp(a), leadexp(d));
    2181   equalMDeg(leadexp(a), leadexp(e));
    2182   equalMDeg(leadexp(a), leadexp(f));
    2183 
    2184   equalMDeg(leadexp(b), leadexp(c));
    2185   equalMDeg(leadexp(b), leadexp(d));
    2186   equalMDeg(leadexp(b), leadexp(e));
    2187   equalMDeg(leadexp(b), leadexp(f));
    2188 
    2189   equalMDeg(leadexp(c), leadexp(d));
    2190   equalMDeg(leadexp(c), leadexp(e));
    2191   equalMDeg(leadexp(c), leadexp(f));
    2192 
    2193   equalMDeg(leadexp(d), leadexp(e));
    2194   equalMDeg(leadexp(d), leadexp(f));
    2195 
    2196   equalMDeg(leadexp(e), leadexp(f));
     2172  equalMultiDeg(leadexp(a), leadexp(b));
     2173  equalMultiDeg(leadexp(a), leadexp(c));
     2174  equalMultiDeg(leadexp(a), leadexp(d));
     2175  equalMultiDeg(leadexp(a), leadexp(e));
     2176  equalMultiDeg(leadexp(a), leadexp(f));
     2177
     2178  equalMultiDeg(leadexp(b), leadexp(c));
     2179  equalMultiDeg(leadexp(b), leadexp(d));
     2180  equalMultiDeg(leadexp(b), leadexp(e));
     2181  equalMultiDeg(leadexp(b), leadexp(f));
     2182
     2183  equalMultiDeg(leadexp(c), leadexp(d));
     2184  equalMultiDeg(leadexp(c), leadexp(e));
     2185  equalMultiDeg(leadexp(c), leadexp(f));
     2186
     2187  equalMultiDeg(leadexp(d), leadexp(e));
     2188  equalMultiDeg(leadexp(d), leadexp(f));
     2189
     2190  equalMultiDeg(leadexp(e), leadexp(f));
    21972191
    21982192}
     
    22222216  if( (typeof(a) == "poly") or (typeof(a) == "vector") )
    22232217  {
    2224     return ( size(mDegPartition(a)) <= 1 )
     2218    return ( size(multiDegPartition(a)) <= 1 )
    22252219  }
    22262220
     
    22522246      aa = getGradedGenerator(a, i);
    22532247
    2254       b = mDegPartition(aa);
     2248      b = multiDegPartition(aa);
    22552249      for( j = ncols(b); j > 0; j-- )
    22562250      {
     
    22852279  poly f = x-yz;
    22862280
    2287   mDegPartition(f);
    2288   print(mDeg(_));
     2281  multiDegPartition(f);
     2282  print(multiDeg(_));
    22892283
    22902284  isHomogeneous(f);   // f: is not homogeneous
     
    22922286  poly g = 1-xy2z3;
    22932287  isHomogeneous(g); // g: is homogeneous
    2294   mDegPartition(g);
     2288  multiDegPartition(g);
    22952289
    22962290  kill T;
     
    23062300  f;
    23072301  isHomogeneous(f);
    2308   mDegPartition(f);
     2302  multiDegPartition(f);
    23092303
    23102304  // ---------------------
    23112305  g;
    23122306  isHomogeneous(g);
    2313   mDegPartition(g);
     2307  multiDegPartition(g);
    23142308
    23152309  kill r, T, M;
     
    23302324
    23312325  // Degree partition:
    2332   mDegPartition(x2 - y3 -xy +z);
    2333   mDegPartition(x3 -y2z + x2 -y3 + z + 1);
     2326  multiDegPartition(x2 - y3 -xy +z);
     2327  multiDegPartition(x3 -y2z + x2 -y3 + z + 1);
    23342328
    23352329
     
    23412335
    23422336  v1 = setModuleGrading(N[1], V); v1;
    2343   mDegPartition(v1);
    2344   print( mDeg(_) );
     2337  multiDegPartition(v1);
     2338  print( multiDeg(_) );
    23452339
    23462340  v2 = setModuleGrading(N[2], V); v2;
    2347   mDegPartition(v2);
    2348   print( mDeg(_) );
     2341  multiDegPartition(v2);
     2342  print( multiDeg(_) );
    23492343
    23502344  N = setModuleGrading(N, V);
    23512345  isHomogeneous(N);
    2352   print( mDeg(N) );
     2346  print( multiDeg(N) );
    23532347
    23542348  ///////////////////////////////////////
     
    23592353
    23602354  v1 = setModuleGrading(N[1], V); v1;
    2361   mDegPartition(v1);
    2362   print( mDeg(_) );
     2355  multiDegPartition(v1);
     2356  print( multiDeg(_) );
    23632357
    23642358  v2 = setModuleGrading(N[2], V); v2;
    2365   mDegPartition(v2);
    2366   print( mDeg(_) );
     2359  multiDegPartition(v2);
     2360  print( multiDeg(_) );
    23672361
    23682362  N = setModuleGrading(N, V);
    23692363  isHomogeneous(N);
    2370   print( mDeg(N) );
     2364  print( multiDeg(N) );
    23712365
    23722366  ///////////////////////////////////////
     
    23792373  N = setModuleGrading(N, V); print(N);
    23802374  isHomogeneous(N);
    2381   print( mDeg(N) );
     2375  print( multiDeg(N) );
    23822376  v1 = getGradedGenerator(N,1); print(v1);
    2383   mDegPartition(v1);
    2384   print( mDeg(_) );
     2377  multiDegPartition(v1);
     2378  print( multiDeg(_) );
    23852379  N = setModuleGrading(N, V); print(N);
    23862380  isHomogeneous(N);
    2387   print( mDeg(N) );
     2381  print( multiDeg(N) );
    23882382}
    23892383
    23902384/******************************************************/
    2391 proc mDeg(def A)
    2392 "USAGE: mDeg(A); polynomial/vector/ideal/module A
     2385proc multiDeg(def A)
     2386"USAGE: multiDeg(A); polynomial/vector/ideal/module A
    23932387PURPOSE: compute multidegree
    2394 EXAMPLE: example mDeg; shows an example
     2388EXAMPLE: example multiDeg; shows an example
    23952389"
    23962390{
     
    24792473    for( i = ncols(A); i > 0; i-- )
    24802474    {
    2481       d = mDeg( A[i] );
     2475      d = multiDeg( A[i] );
    24822476
    24832477      for( j = 1; j <= r; j++ ) // see ticket: 253
     
    24992493
    25002494      // G[1..r, i]
    2501       d = mDeg(v);
     2495      d = multiDeg(v);
    25022496
    25032497      for( j = 1; j <= r; j++ ) // see ticket: 253
     
    25302524
    25312525
    2532   mDeg( x*x, A );
    2533   mDeg( y*y*y, A );
     2526  multiDeg( x*x, A );
     2527  multiDeg( y*y*y, A );
    25342528
    25352529  setBaseMultigrading(A, Ta);
    25362530
    2537   mDeg( x*x*y );
    2538 
    2539   mDeg( y*y*y*x );
    2540 
    2541   mDeg( x*y + x + 1 );
    2542 
    2543   mDegPartition(x*y + x + 1);
    2544 
    2545   print ( mDeg(0) );
     2531  multiDeg( x*x*y );
     2532
     2533  multiDeg( y*y*y*x );
     2534
     2535  multiDeg( x*y + x + 1 );
     2536
     2537  multiDegPartition(x*y + x + 1);
     2538
     2539  print ( multiDeg(0) );
    25462540  poly zero = 0;
    2547   print ( mDeg(zero) );
     2541  print ( multiDeg(zero) );
    25482542
    25492543//  "ideal:";
    25502544
    25512545  ideal I = y*x*x, x*y*y*y;
    2552   print( mDeg(I) );
    2553 
    2554   print ( mDeg(ideal(0)) );
    2555   print ( mDeg(ideal(0,0,0)) );
     2546  print( multiDeg(I) );
     2547
     2548  print ( multiDeg(ideal(0)) );
     2549  print ( multiDeg(ideal(0,0,0)) );
    25562550
    25572551//  "vectors:";
     
    25602554  print(B);
    25612555
    2562   mDeg( setModuleGrading(y*y*y*gen(2), B ));
    2563   mDeg( setModuleGrading(x*x*gen(1), B ));
     2556  multiDeg( setModuleGrading(y*y*y*gen(2), B ));
     2557  multiDeg( setModuleGrading(x*x*gen(1), B ));
    25642558
    25652559
    25662560  vector V = x*gen(1) + y*gen(2);
    25672561  V = setModuleGrading(V, B);
    2568   mDeg( V );
     2562  multiDeg( V );
    25692563
    25702564  vector v1 = setModuleGrading([0, 0, 0], B);
    2571   print( mDeg( v1 ) );
     2565  print( multiDeg( v1 ) );
    25722566
    25732567  vector v2 = setModuleGrading([0], B);
    2574   print( mDeg( v2 ) );
     2568  print( multiDeg( v2 ) );
    25752569
    25762570//  "module:";
     
    25792573  D;
    25802574  D = setModuleGrading(D, B);
    2581   print( mDeg( D ) );
     2575  print( multiDeg( D ) );
    25822576
    25832577
    25842578  module DD = [0, 0],[0, 0, 0];
    25852579  DD = setModuleGrading(DD, B);
    2586   print( mDeg( DD ) );
     2580  print( multiDeg( DD ) );
    25872581
    25882582  module DDD = [0, 0];
    25892583  DDD = setModuleGrading(DDD, B);
    2590   print( mDeg( DDD ) );
     2584  print( multiDeg( DDD ) );
    25912585
    25922586};
     
    25972591
    25982592/******************************************************/
    2599 proc mDegPartition(def p)
    2600 "USAGE: mDegPartition(def p), p polynomial/vector
     2593proc multiDegPartition(def p)
     2594"USAGE: multiDegPartition(def p), p polynomial/vector
    26012595RETURNS: an ideal/module consisting of multigraded-homogeneous parts of p
    2602 EXAMPLE: example mDegPartition; shows an example
     2596EXAMPLE: example multiDegPartition; shows an example
    26032597"
    26042598{ // TODO: What about an ideal or module???
     
    26462640        // TODO: we do not cache matrices (M,T,H,V), which remain the same :(
    26472641        // TODO: we need some low-level procedure with all these arguments...!
    2648         if( equalMDeg( leadexp(tt), m, V  ) )
     2642        if( equalMultiDeg( leadexp(tt), m, V  ) )
    26492643        {
    26502644          mp = mp + lead(tt); // "mp", mp;
     
    26922686  poly f = x10yz+x8y2z-x4z2+y5+x2y2-z2+x17z3-y6;
    26932687
    2694   mDegPartition(f);
     2688  multiDegPartition(f);
    26952689
    26962690  vector v = xy*gen(1)-x3y2*gen(2)+x4y*gen(3);
     
    26992693  getModuleGrading(v);
    27002694
    2701   mDegPartition(v, B);
     2695  multiDegPartition(v, B);
    27022696}
    27032697
     
    30543048
    30553049/******************************************************/
    3056 proc mDegBasis(intvec d)
     3050proc multiDegBasis(intvec d)
    30573051"
    30583052USAGE: multidegree d
    30593053ASSUME: current ring is multigraded, monomial ordering is global
    30603054PURPOSE: compute all monomials of multidegree d
    3061 EXAMPLE: example mDegBasis; shows an example
     3055EXAMPLE: example multiDegBasis; shows an example
    30623056"
    30633057{
     
    31893183  intvec v3=4:1;
    31903184  v3;
    3191   mDegBasis(v3);
     3185  multiDegBasis(v3);
    31923186
    31933187  setBaseMultigrading(g1,l);
    3194   mDegBasis(v1);
     3188  multiDegBasis(v1);
    31953189  setBaseMultigrading(g2);
    3196   mDegBasis(v2);
     3190  multiDegBasis(v2);
    31973191
    31983192  intmat M[2][2] = 1, -1, -1, 1;
     
    32013195  setBaseMultigrading(M);
    32023196
    3203   mDegBasis(d);
     3197  multiDegBasis(d);
    32043198  attrib(_, "ZeroPart");
    32053199
    3206   kill R;
     3200  kill R, M, d;
    32073201  ring R = 0, (x, y, z), dp;
    32083202
     
    32153209  setBaseMultigrading(M, L);
    32163210
    3217   mDegBasis(d);
     3211  multiDegBasis(d);
    32183212  attrib(_, "ZeroPart");
    32193213
    32203214
    3221   kill R;
     3215  kill R, M, d;
    32223216
    32233217  ring R = 0, (x, y, z), dp;
     
    32283222  //  intmat T[2][1] = 0, 2;
    32293223
    3230   setBaseMultigrading(M);
     3224  setBaseMultigrading(M); // BUG????
    32313225
    32323226  intvec d = 6, 6;
    3233   mDegBasis(d);
     3227  multiDegBasis(d);
    32343228  attrib(_, "ZeroPart");
    32353229
    32363230
    32373231
    3238   kill R;
     3232  kill R, Q, M, d;
    32393233  ring R = 0, (x, y, z), dp;
    32403234  qring Q = std(ideal( x*z^3 - y *z^6, x*y*z  - x^4*y^2 ));
     
    32463240  intvec d = 4, 1;
    32473241
    3248   setBaseMultigrading(M, T);
    3249 
    3250   mDegBasis(d);
     3242  setBaseMultigrading(M, T); // BUG????
     3243
     3244  multiDegBasis(d);
    32513245  attrib(_, "ZeroPart");
    32523246}
    32533247
    32543248
    3255 proc mDegSyzygy(def I)
    3256 "USAGE: mDegSyzygy(I); I is a ideal or a module
     3249proc multiDegSyzygy(def I)
     3250"USAGE: multiDegSyzygy(I); I is a ideal or a module
    32573251PURPOSE: computes the multigraded syzygy module of I
    32583252RETURNS: module, the syzygy module of I
    32593253NOTE: generators of I must be multigraded homogeneous
    3260 EXAMPLE: example mDegSyzygy; shows an example
     3254EXAMPLE: example multiDegSyzygy; shows an example
    32613255"
    32623256{
     
    32663260  }
    32673261  module S = syz(I);
    3268   S = setModuleGrading(S, mDeg(I));
     3262  S = setModuleGrading(S, multiDeg(I));
    32693263  return (S);
    32703264}
     
    32893283
    32903284  isHomogeneous(M);
    3291   "Multidegrees: "; print(mDeg(M));
     3285  "Multidegrees: "; print(multiDeg(M));
    32923286  // Let's compute syzygies!
    3293   def S = mDegSyzygy(M); S;
     3287  def S = multiDegSyzygy(M); S;
    32943288  "Module Units Multigrading: "; print( getModuleGrading(S) );
    3295   "Multidegrees: "; print(mDeg(S));
     3289  "Multidegrees: "; print(multiDeg(S));
    32963290
    32973291  isHomogeneous(S);
     
    33003294
    33013295
    3302 proc mDegModulo(def I, def J)
    3303 "USAGE: mDegModulo(I); I, J are ideals or modules
     3296proc multiDegModulo(def I, def J)
     3297"USAGE: multiDegModulo(I); I, J are ideals or modules
    33043298PURPOSE: computes the multigraded 'modulo' module of I and J
    33053299RETURNS: module, see 'modulo' command
    33063300NOTE: I and J should have the same multigrading, and their
    33073301generators must be multigraded homogeneous
    3308 EXAMPLE: example mDegModulo; shows an example
     3302EXAMPLE: example multiDegModulo; shows an example
    33093303"
    33103304{
     
    33143308  }
    33153309  module K = modulo(I, J);
    3316   K = setModuleGrading(K, mDeg(I));
     3310  K = setModuleGrading(K, multiDeg(I));
    33173311  return (K);
    33183312}
     
    33303324  ideal h2 = x;
    33313325
    3332   "Multidegrees: "; print(mDeg(h1));
     3326  "Multidegrees: "; print(multiDeg(h1));
    33333327
    33343328  // Let's compute modulo(h1, h2):
    3335   def K = mDegModulo(h1, h2); K;
     3329  def K = multiDegModulo(h1, h2); K;
    33363330
    33373331  "Module Units Multigrading: "; print( getModuleGrading(K) );
    3338   "Multidegrees: "; print(mDeg(K));
     3332  "Multidegrees: "; print(multiDeg(K));
    33393333
    33403334  isHomogeneous(K);
     
    33423336
    33433337
    3344 proc mDegGroebner(def I)
    3345 "USAGE: mDegGroebner(I); I is a poly/vector/ideal/module
     3338proc multiDegGroebner(def I)
     3339"USAGE: multiDegGroebner(I); I is a poly/vector/ideal/module
    33463340PURPOSE: computes the multigraded standard/groebner basis of I
    33473341NOTE: I must be multigraded homogeneous
    33483342RETURNS: ideal/module, the computed basis
    3349 EXAMPLE: example mDegGroebner; shows an example
     3343EXAMPLE: example multiDegGroebner; shows an example
    33503344"
    33513345{
     
    33893383  /////////////////////////////////////////////////////////////////////////////
    33903384  // GB:
    3391   M = mDegGroebner(M); M;
     3385  M = multiDegGroebner(M); M;
    33923386  "Module Units Multigrading: "; print( getModuleGrading(M) );
    3393   "Multidegrees: "; print(mDeg(M));
     3387  "Multidegrees: "; print(multiDeg(M));
    33943388
    33953389  isHomogeneous(M);
     
    33973391  /////////////////////////////////////////////////////////////////////////////
    33983392  // Let's compute Syzygy!
    3399   def S = mDegSyzygy(M); S;
     3393  def S = multiDegSyzygy(M); S;
    34003394  "Module Units Multigrading: "; print( getModuleGrading(S) );
    3401   "Multidegrees: "; print(mDeg(S));
     3395  "Multidegrees: "; print(multiDeg(S));
    34023396
    34033397  isHomogeneous(S);
     
    34053399  /////////////////////////////////////////////////////////////////////////////
    34063400  // GB:
    3407   S = mDegGroebner(S); S;
     3401  S = multiDegGroebner(S); S;
    34083402  "Module Units Multigrading: "; print( getModuleGrading(S) );
    3409   "Multidegrees: "; print(mDeg(S));
     3403  "Multidegrees: "; print(multiDeg(S));
    34103404
    34113405  isHomogeneous(S);
     
    34143408
    34153409/******************************************************/
    3416 proc mDegResolution(def I, int ll, list #)
    3417 "USAGE: mDegResolution(I,l,[f]); I is poly/vector/ideal/module; l,f are integers
     3410proc multiDegResolution(def I, int ll, list #)
     3411"USAGE: multiDegResolution(I,l,[f]); I is poly/vector/ideal/module; l,f are integers
    34183412PURPOSE: computes the multigraded resolution of I of the length l,
    34193413or the whole resolution if l is zero. Returns minimal resolution if an optional
     
    34223416The returned list is truncated beginning with the first zero differential.
    34233417RETURNS: list, the computed resolution
    3424 EXAMPLE: example mDegResolution; shows an example
     3418EXAMPLE: example multiDegResolution; shows an example
    34253419"
    34263420{
     
    34423436    if( size(L[i]) > 0 )
    34433437    {
    3444       L[i] = setModuleGrading( L[i], mDeg(L[i-1]) );
     3438      L[i] = setModuleGrading( L[i], multiDeg(L[i-1]) );
    34453439    } else
    34463440    {
     
    34763470  for(j=1; j<=ncols(A); j++)
    34773471  {
    3478     mDegPartition(A[j]);
     3472    multiDegPartition(A[j]);
    34793473  }
    34803474
     
    34863480
    34873481  // Let's compute Syzygy!
    3488   def S = mDegSyzygy(m); S;
     3482  def S = multiDegSyzygy(m); S;
    34893483  "Module Units Multigrading: "; print( getModuleGrading(S) );
    3490   "Multidegrees: "; print(mDeg(S));
     3484  "Multidegrees: "; print(multiDeg(S));
    34913485
    34923486  /////////////////////////////////////////////////////////////////////////////
    34933487
    3494   S = mDegGroebner(S); S;
     3488  S = multiDegGroebner(S); S;
    34953489  "Module Units Multigrading: "; print( getModuleGrading(S) );
    3496   "Multidegrees: "; print(mDeg(S));
     3490  "Multidegrees: "; print(multiDeg(S));
    34973491
    34983492  /////////////////////////////////////////////////////////////////////////////
    34993493
    3500   def L = mDegResolution(m, 0, 1);
     3494  def L = multiDegResolution(m, 0, 1);
    35013495
    35023496  for( j =1; j<=size(L); j++)
     
    35053499    L[j];
    35063500    "Module Multigrading: "; print( getModuleGrading(L[j]) );
    3507     "Multigrading: "; print(mDeg(L[j]));
     3501    "Multigrading: "; print(multiDeg(L[j]));
    35083502  }
    35093503
    35103504  /////////////////////////////////////////////////////////////////////////////
    35113505
    3512   L = mDegResolution(maxideal(1), 0, 1);
     3506  L = multiDegResolution(maxideal(1), 0, 1);
    35133507
    35143508  for( j =1; j<=size(L); j++)
     
    35173511    L[j];
    35183512    "Module Multigrading: "; print( getModuleGrading(L[j]) );
    3519     "Multigrading: "; print(mDeg(L[j]));
     3513    "Multigrading: "; print(multiDeg(L[j]));
    35203514  }
    35213515
     
    35423536proc hilbertSeries(def I)
    35433537"USAGE: hilbertSeries(I); I is poly/vector/ideal/module
    3544 PURPOSE: computes the multigraded Hilbert Series of M
     3538PURPOSE: computes the multigraded Hilbert Series of I
    35453539NOTE: input must have multigraded-homogeneous generators.
    35463540Multigrading should be positive.
    35473541RETURNS: a ring in variables t_(i), s_(i), with polynomials
    3548 numerator1 and denominator1 and muturally prime numerator2
     3542numerator1 and denominator1 and mutually prime numerator2
    35493543and denominator2, quotients of which give the series.
    35503544EXAMPLE: example hilbertSeries; shows an example
     
    35703564  }
    35713565
    3572   list RES = mDegResolution(I,0,1);
     3566  list RES = multiDegResolution(I,0,1);
    35733567
    35743568  int l = size(RES);
     
    35883582  for( j = 1; j <= l; j++)
    35893583  {
    3590     L[j + 1] = mDeg(RES[j]);
     3584    L[j + 1] = multiDeg(RES[j]);
    35913585  }
    35923586
     
    37353729  ideal I = x^2, y, z^3;
    37363730  I = std(I);
    3737   def L = mDegResolution(I, 0, 1);
     3731  def L = multiDegResolution(I, 0, 1);
    37383732
    37393733  for( int j = 1; j<=size(L); j++)
     
    37423736    L[j];
    37433737    "Module Multigrading: "; print( getModuleGrading(L[j]) );
    3744     "Multigrading: "; print(mDeg(L[j]));
    3745   }
    3746 
    3747   mDeg(I);
     3738    "Multigrading: "; print(multiDeg(L[j]));
     3739  }
     3740
     3741  multiDeg(I);
    37483742  def h = hilbertSeries(I); setring h;
    37493743
     
    40974091"
    40984092{
    4099 ideal I = mDegBasis(0);
     4093ideal I = multiDegBasis(0);
    41004094ideal J = attrib(I,"ZeroPart");
    41014095/*
     
    41144108  isPositive();
    41154109
    4116   intmat A[1][2]=1,1;
    4117   setBaseMultigrading(A);
    4118   isPositive(A);
     4110  intmat B[1][2]=1,1;
     4111  setBaseMultigrading(B);
     4112  isPositive(B);
    41194113}
    41204114
     
    41324126
    41334127
    4134   example mDeg;
    4135   example mDegPartition;
     4128  example multiDeg;
     4129  example multiDegPartition;
    41364130
    41374131
     
    41424136  example defineHomogeneous;
    41434137
    4144   example equalMDeg;
     4138  example equalMultiDeg;
    41454139  example isZeroElement;
    41464140
    4147   example mDegResolution;
     4141  example multiDegResolution;
    41484142
    41494143  "// ******************* example hilbertSeries ************************//";
     
    41514145
    41524146
    4153 // example mDegBasis; // needs 4ti2!
     4147// example multiDegBasis; // needs 4ti2!
    41544148
    41554149  "The End!";
     
    41574151
    41584152
    4159 proc mDegTruncate(def M, intvec md)
     4153static proc multiDegTruncate(def M, intvec md)
    41604154{
    41614155  "d: ";
     
    41654159  module LL = M; // + L for d+1
    41664160  LL;
    4167   print(mDeg(LL));
     4161  print(multiDeg(LL));
    41684162
    41694163
     
    41804174    "v[i]: "; vi;
    41814175
    4182     B = mDegBasis(md - vi); // ZeroPart is always the same...
     4176    B = multiDegBasis(md - vi); // ZeroPart is always the same...
    41834177    "B: "; B;
    41844178
     
    41894183
    41904184  "L: "; L;
    4191   print(mDeg(L));
    4192 
    4193   L = mDegModulo(L, LL);
    4194   L = mDegGroebner(L);
     4185  print(multiDeg(L));
     4186
     4187  L = multiDegModulo(L, LL);
     4188  L = multiDegGroebner(L);
    41954189//  L = minbase(prune(L));
    41964190
    41974191  "??????????";
    41984192  print(L);
    4199   print(mDeg(L));
     4193  print(multiDeg(L));
    42004194
    42014195  V = getModuleGrading(L);
     
    42044198  for(i = ncols(L); i > 0; i-- )
    42054199  {
    4206     if( !equalMDeg( mDeg(getGradedGenerator(L, i)), md ) )
     4200    if( !equalMultiDeg( multiDeg(getGradedGenerator(L, i)), md ) )
    42074201    {
    42084202      L[i] = 0;
     
    42134207  L = setModuleGrading(L, V);
    42144208  print(L);
    4215   print(mDeg(L));
     4209  print(multiDeg(L));
    42164210
    42174211  return(L);
     
    42374231  module h1 = x;
    42384232  h1 = setModuleGrading(h1, V);
    4239   mDegTruncate(h1, mDeg(x));
    4240   mDegTruncate(h1, mDeg(y));
     4233  multiDegTruncate(h1, multiDeg(x));
     4234  multiDegTruncate(h1, multiDeg(y));
    42414235
    42424236  "XY:";
    42434237  module h2 = ideal(x, y);
    42444238  h2 = setModuleGrading(h2, V);
    4245   mDegTruncate(h2, mDeg(x));
    4246   mDegTruncate(h2, mDeg(y));
    4247   mDegTruncate(h2, mDeg(xy));
     4239  multiDegTruncate(h2, multiDeg(x));
     4240  multiDegTruncate(h2, multiDeg(y));
     4241  multiDegTruncate(h2, multiDeg(xy));
    42484242}
    42494243
     
    42674261{
    42684262  intmat Mul = Q*L;
    4269   intmat L = latticeBasis(Mul);
    4270 
    4271   return(L);
     4263  intmat LL = latticeBasis(Mul);
     4264
     4265  return(LL);
    42724266}
    42734267example
     
    45324526    3,6,12;
    45334527
    4534   intmat B = latticeBasis(B); // should be a matrix with columns [1,2,3] and [0,3,6]
     4528  intmat B = latticeBasis(B);
     4529  print(B); // should be a matrix with columns [1,2,3] and [0,3,6]
    45354530
    45364531  kill B,L;
     
    46414636
    46424637
    4643   print(Con);
     4638//  print(Con);
    46444639
    46454640  intmat L = kernelLattice(Con);
    4646 
     4641/*
    46474642  print(L);
    46484643  print(ncols(P));
    46494644  print(ncols(L));
    4650 
     4645*/
    46514646  // delete rows ncols(P)+1 to nrows(L) out of L
    46524647  intmat Del[ncols(P)][ncols(L)];
     
    46794674    0;
    46804675
    4681   // should be a 2x2 matrix with columns
    4682   // [1,1,-1] and [-2,1,0]
    46834676  intmat L = preimageLattice(P,B);
    46844677
     4678  print(L); // should be a 2x2? matrix with columns [1,1,-1] and [-2,1,0]?
     4679 
    46854680  kill B, P, L;
    46864681
     
    47234718  // should be 0
    47244719  int b = isPrimitiveSublattice(A);
     4720  b;
     4721
     4722  if( b != 0 ){ ERROR("Sorry, something went wrong..."); }
    47254723
    47264724  kill A,b;
     
    49164914    8,11;
    49174915
     4916  intmat U = intersectLattices(A,B);
     4917
    49184918  // should result in a (2x4)-matrix with columns
    49194919  // [3, 3, 3], [0, 3, 6]
    4920   intmat U = intersectLattices(A,B);
    4921 
     4920  print(U);
    49224921}
    49234922
     
    52425241    intmat P = intInverse(L[1]);
    52435242
    5244     print(L);
     5243//    print(L);
    52455244
    52465245    if ( r < m )
Note: See TracChangeset for help on using the changeset viewer.