Changeset 94cd93 in git


Ignore:
Timestamp:
Jan 19, 2015, 2:40:39 PM (9 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
a7c8b1fd065150adf6d6165eac463687c886eaae
Parents:
777f8bb0bd3e850c5c7084702f167df3c1b53113
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2015-01-19 14:40:39+01:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2015-01-19 15:05:24+01:00
Message:
Added basic operations with graded objects

fix: some minors
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/gradedModules.lib

    r777f8b r94cd93  
    55LIBRARY: gradedModules.lib     Operations with graded modules/matrices/resolutions
    66AUTHOR:  Oleksandr Motsak <U@D>, where U={motsak}, D={mathematik.uni-kl.de}
     7         Hanieh Keneshlou <hkeneshlou@yahoo.com>
    78KEYWORDS: graded modules, graded homomorphisms, syzygies
    89OVERVIEW:
    910    @* The library contains several procedures for operations with graded modules/matrices/resolutions
    10 
     11    @* TODO!
    1112NOTE:       
    12     @* try @code{example TestGRRes;} from examples
     13    @* try @code{example TestGRRes; example grsum; } from examples
    1314PROCEDURES:
    14        
     15
     16    grzero()        presentation of basering(0)^1
     17    grshift(M,d)    shift graded module M by d
     18    grtwist(r,d)    presentation of basering(d)^r
     19    grsum(M,N)      direct sum of two graded modules M \oplus N
     20    grpower(M,p)    direct p-th power of graded module M
    1521    grview(M)       view the graded structure of M
    1622    grdeg(M)        compute graded degrees of M   
     
    2228@*
    2329[MO]   Motsak, O.: Non-commutative Computer Algebra with applications: Graded commutative algebra and related
    24        structures in Singular with applications, Ph.D. thesis, TU Kaiserslautern, 2010?
     30       structures in Singular with applications, Ph.D. thesis, TU Kaiserslautern, 2010 TODO!?
    2531";
    26 
    2732
    2833//////////////////////////////////////////////////////////////////////////////////////////////////////////
     
    7782"
    7883{
    79   if( size(N) == 0 ) { return (); }
     84//  if( size(N) == 0 ) { return (); }
    8085 
    8186  if( typeof( N ) == "list" )
     
    107112    D[1, c+d] = c; // top row indeces
    108113    v = L[c];
    109     D[nr+2*d, c+d] = deg(v) + gr[ leadexp(v)[m] ]; // bottom row with computed column induced degrees
     114    if( v != 0 )
     115    {
     116      D[nr+2*d, c+d] = deg(v) + gr[ leadexp(v)[m] ]; // bottom row with computed column induced degrees
     117    } else
     118    {
     119      D[nr+2*d, c+d] = 0; // TODO: 0/-1 is valid :(
     120    }
    110121  }
    111122 
     
    115126    for( c = nc; c > 0; c-- )
    116127    {
    117       D[r+d, c+d] = deg(M[r, c]); // central block with degrees
    118 //      if( D[r+d, c+d] < 0 ) { D[r+d, c+d] = 0; }
     128      D[r+d, c+d] = deg(M[r, c]); // central block with degrees (-1 means zero entry)
    119129    }
    120130    D[r+d, nc+2*d] = r; // right-most block with indeces
     
    217227  def w = attrib(M, "isHomog"); // grading weights?
    218228  ASSUME(0, /* input must be correctly graded! */ nrows(M) == size(w) );   
    219  
     229
     230  if( size(M) == 0 )  {    return (w);  } // TODO???
     231
    220232  int m = ncols(M); // m > 0 in Singular!
    221   int n = nvars(basering) + 1; // index of mod. column in the leadexp 
     233  int n = nvars(basering) + 1; // index of mod. column in the leadexp
    222234
    223235  module L = lead(M[1..m]); // leading module-terms for input column vectors
     
    584596}
    585597
     598/////////////////////////////////////////////////////////
     599
     600// ????
     601proc grzero()
     602"presentation of S(0)^1
     603TODO: can we return this as an undefined value?????
     604"
     605{
     606 module Z = 0;
     607 attrib(Z,"isHomog",intvec(0));
     608 return (Z);
     609}
     610
     611proc grpower(def A, int p)
     612"
     613compute A \oplus ... \opuls A (p-times)
     614"
     615{
     616  if(p==0){ return ( grzero() ); } // just ERROR ???
     617
     618  ASSUME(0, p > 0);
     619
     620  if(p==1){ return(A); }
     621
     622  def N = grsum(A,A);
     623
     624  if(p==2){ return(N); }
     625
     626  // TODO: replace recursion with a loop!
     627  // see http://en.wikipedia.org/wiki/Exponentiation_by_squaring
     628  if((p%2)==0)
     629    { return ( grpower(N, p div 2) ); }
     630  else
     631    { return ( grsum( A, grpower(N, (p-1) div 2) )); }
     632
     633 
     634
     635proc grsum(def A,def B)
     636"
     637direct sum of graded modules
     638"
     639{
     640  intvec a = attrib(A, "isHomog");
     641  intvec b = attrib(B, "isHomog");
     642  intvec c = a,b;                       
     643  int r = nrows(A);
     644 
     645  ASSUME( 0, r == size(a) );
     646
     647  module T; T[r] = 0; T = T, module(transpose(B));
     648  module AB = module(A), transpose(T);
     649
     650  attrib(AB, "isHomog", c);
     651  return(AB);
     652}
     653example
     654{ "EXAMPLE:"; echo = 2; int assumeLevel = 5;
     655   
     656  ring r=32003,(x,y,z),dp;
     657
     658  grview(grpower( grshift(grzero(), 10), 5 ) );
     659 
     660  module A = [x+y, x, 0 ], [0, x+y, y];
     661  attrib(A,"isHomog", intvec(1,1,1));
     662  grview(A);
     663 
     664  matrix B[2][2] = z,0, 0,z;
     665  attrib(B,"isHomog", intvec(-2,-3));
     666  grview(B);
     667
     668  def C = grsum(A,B);
     669
     670  print(C);
     671  homog(C);
     672  grview(C);
     673
     674  def D = grsum(grpower(A, 2), grpower(B, 2));
     675
     676  print(D);
     677  homog(D);
     678  grview(D); 
     679
     680  def D10 = grshift(D, 10);
     681
     682  print(D10);
     683  homog(D10);
     684  grview(D10);
     685
     686  "";  def T = grtwist(5, 10);
     687 
     688  print(T);
     689  homog(T);
     690  grview(T);
     691 
     692  "";  def TT = grsum(grtwist(3, 0), grtwist(5,-1));
     693 
     694  print(TT);
     695  homog(TT);
     696  grview(TT);
     697}
     698
     699proc grshift( def M, int d)
     700"
     701shift graded module M by delta so that 1 is in M_d
     702"
     703{
     704  intvec a = attrib(M, "isHomog");
     705  attrib(M, "isHomog", intvec( a + intvec(d:size(a))) );
     706  return (M);
     707}
     708
     709proc grisequal (def A, def B)
     710"TODO"
     711{
     712  return (1==1); // TODO!
     713}
     714
     715proc grtwist(int a, int d)
     716"
     717matrix presentation for twisted polynomial ring S(d)^a
     718"
     719{
     720  matrix zero[a][a]; // TODO ???
     721  module Z = zero;
     722  attrib(Z, "isHomog", intvec(d:a));
     723
     724  ASSUME(2, grisequal(Z, grpower( grshift(grzero(), d), a ) )); // optional check
     725  return(Z);
     726
Note: See TracChangeset for help on using the changeset viewer.