Changeset 203f32 in git for Singular/LIB/sheafcoh.lib


Ignore:
Timestamp:
Jan 3, 2007, 12:58:22 AM (17 years ago)
Author:
Motsak Oleksandr <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
b50600e3954f0a0fb4f3ec92eb6511cb3b7dccd1
Parents:
6881a3917411ce8ae2352b62f115cbf182a7d528
Message:
*motsak: more efficient sheafCohBGG


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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/sheafcoh.lib

    r6881a39 r203f32  
    11S///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: sheafcoh.lib,v 1.10 2006-12-15 14:15:52 Singular Exp $";
     2version="$Id: sheafcoh.lib,v 1.11 2007-01-02 23:58:22 motsak Exp $";
    33category="Commutative Algebra";
    44info="
     
    3838   return(transpose(B));
    3939}
    40 ///////////////////////////////////////////////////////////////////////////////
    41 static proc max(int i,int j)
     40
     41// returns transposed Jacobian of M
     42static proc tJacobian(module M)
     43{
     44  M = transpose(M);
     45
     46  int N = nvars(basering);
     47  int k = ncols(M);
     48  int r = nrows(M);
     49
     50  module Result;
     51  Result[N*k] = 0;
     52
     53  int i, j;
     54  int l = 1;
     55
     56  for( j = 1; j <= N; j++ ) // for all variables
     57  {
     58    for( i = 1; i <= k; i++ ) // for every v \in transpose(M)
     59    {
     60      Result[l] = diff(M[i], var(j));
     61      l++;
     62    }
     63  }
     64
     65  return(Result);
     66}
     67
     68
     69/**
     70  let M = { w_1, ..., w_k }, k = size(M) == ncols(M), n = nvars(currRing).
     71  assuming that nrows(M) <= m*n;
     72  computes transpose(M) * transpose( var(1) I_m | ... | var(n) I_m ) :== transpose(module{f_1, ... f_k}),
     73  where f_i = \sum_{j=1}^{m} (w_i, v_j) gen(j),  (w_i, v_j) is a `scalar` multiplication.
     74  that is, if w_i = (a^1_1, ... a^1_m) | (a^2_1, ..., a^2_m) | ... | (a^n_1, ..., a^n_m) then
     75
     76  (a^1_1, ... a^1_m) | (a^2_1, ..., a^2_m) | ... | (a^n_1, ..., a^n_m)
     77*  var_1  ... var_1  |  var_2  ...  var_2  | ... |  var_n  ...  var(n)
     78*  gen_1  ... gen_m  |  gen_1  ...  gen_m  | ... |  gen_1  ...  gen_m
     79+ =>
     80  f_i =
     81 
     82   a^1_1 * var(1) * gen(1) + ... + a^1_m * var(1) * gen(m) +
     83   a^2_1 * var(2) * gen(1) + ... + a^2_m * var(2) * gen(m) +
     84                             ...
     85   a^n_1 * var(n) * gen(1) + ... + a^n_m * var(n) * gen(m);
     86
     87   NOTE: for every f_i we run only ONCE along w_i saving partial sums into a temporary array of polys of size m
     88
     89*/
     90static proc TensorModuleMult(int m, module M)
     91{
     92  int n = nvars(basering);
     93  int k = ncols(M);
     94 
     95  int g, cc, vv;
     96 
     97  poly h;
     98
     99  module Temp; // = {f_1, ..., f_k }
     100
     101  intvec exp;
     102  vector pTempSum, w;
     103 
     104  for( int i = k; i > 0; i-- ) // for every w \in M
     105  {
     106    pTempSum[m] = 0;
     107    w = M[i];
     108
     109    while(w != 0) // for each term of w...
     110    {
     111      exp = leadexp(w);
     112      g = exp[n+1]; // module component!
     113      h = w[g];
     114
     115      w = w - h * gen(g);
     116
     117      cc = g % m;
     118     
     119      if( cc == 0)
     120      {
     121        cc = m;
     122      }
     123     
     124      vv = 1 + (g - cc) / m;
     125     
     126      pTempSum = pTempSum + h * var(vv) * gen(cc);
     127    }
     128
     129    Temp[i] = pTempSum;
     130  }
     131
     132  Temp = transpose(Temp);
     133
     134  return(Temp);
     135}
     136
     137
     138///////////////////////////////////////////////////////////////////////////////
     139proc max(int i,int j)
    42140{
    43141  if(i>j){return(i);}
     
    226324
    227325///////////////////////////////////////////////////////////////////////////////
    228 
     326proc sheafCohBGG1(module M,int l,int h)
     327"USAGE:   sheafCohBGG1(M,l,h);    M module, l,h int
     328ASSUME:  @code{M} is graded, and it comes assigned with an admissible degree
     329         vector as an attribute, @code{h>=l}, and the basering has @code{n+1}
     330         variables.
     331RETURN:  intmat, cohomology of twists of the coherent sheaf F on P^n
     332         associated to coker(M). The range of twists is determined by @code{l},
     333         @code{h}.
     334DISPLAY: The intmat is displayed in a diagram of the following form: @*
     335  @format
     336                l            l+1                      h
     337  ----------------------------------------------------------
     338      n:     h^n(F(l))    h^n(F(l+1))   ......    h^n(F(h))
     339           ...............................................
     340      1:     h^1(F(l))    h^1(F(l+1))   ......    h^1(F(h))
     341      0:     h^0(F(l))    h^0(F(l+1))   ......    h^0(F(h))
     342  ----------------------------------------------------------
     343    chi:     chi(F(l))    chi(F(l+1))   ......    chi(F(h))
     344  @end format
     345         A @code{'-'} in the diagram refers to a zero entry; a @code{'*'}
     346         refers to a negative entry (= dimension not yet determined).
     347         refers to a not computed dimension. @*
     348NOTE:    This procedure is based on the Bernstein-Gel'fand-Gel'fand
     349         correspondence and on Tate resolution ( see [Eisenbud, Floystad,
     350         Schreyer: Sheaf cohomology and free resolutions over exterior
     351         algebras, Trans AMS 355 (2003)] ).@*
     352         @code{sheafCohBGG1(M,l,h)} does not compute all values in the above
     353         table. To determine all values of @code{h^i(F(d))}, @code{d=l..h},
     354         use @code{sheafCohBGG1(M,l-n,h+n)}.
     355         Previous inefficient implementation.
     356SEE ALSO: sheafCoh, sheafCohBGG, dimH
     357EXAMPLE: example sheafCohBGG; shows an example
     358"
     359{
     360  int i,j,k,row,col;
     361  if( typeof(attrib(M,"isHomog"))!="intvec" ) {
     362     if (size(M)==0) { attrib(M,"isHomog",0); }
     363     else { ERROR("No admissible degree vector assigned"); }
     364  }
     365  int n=nvars(basering)-1;
     366  int ell=l+n;
     367  def R=basering;
     368  int reg = CM_regularity(M);
     369  int bound=max(reg+1,h-1);
     370  module MT=truncate(M,bound);
     371  int m=nrows(MT);
     372  MT=transpose(jacobM(MT));
     373  MT=syz(MT);
     374  matrix ML[n+1][1]=maxideal(1);
     375  matrix S=transpose(outer(ML,unitmat(m)));
     376  matrix SS=transpose(S*MT);
     377  //--- to the exterior algebra
     378  def AR = Exterior();
     379  setring AR;
     380  option(redSB);
     381  option(redTail);
     382  module EM=imap(R,SS);
     383  intvec w;
     384  //--- here we are with our matrix
     385  int bound1=max(1,bound-ell+1);
     386  for (i=1; i<=nrows(EM); i++)
     387  {
     388     w[i]=-bound-1;
     389  }
     390  attrib(EM,"isHomog",w);
     391  resolution RE=mres(EM,bound1);
     392  intmat Betti=betti(RE);
     393  k=ncols(Betti);
     394  row=nrows(Betti);
     395  int shift=attrib(Betti,"rowShift")+(k+ell-1);
     396  intmat newBetti[n+1][h-l+1];
     397  for (j=1; j<=row; j++) {
     398    for (i=l; i<=h; i++) {
     399      if ((k+1-j-i+ell-shift>0) and (j+i-ell+shift>=1)) {
     400        newBetti[n+2-shift-j,i-l+1]=Betti[j,k+1-j-i+ell-shift];
     401      }
     402      else { newBetti[n+2-shift-j,i-l+1]=-1; }
     403    }
     404  }
     405  for (j=2; j<=n+1; j++) {
     406    for (i=1; i<j; i++) {
     407      newBetti[j,i]=-1;
     408    }
     409  }
     410  int d=k-h+ell-1;
     411  for (j=1; j<=n; j++) {
     412    for (i=h-l+1; i>=k+j; i--) {
     413      newBetti[j,i]=-1;
     414    }
     415  }
     416  displayCohom(newBetti,l,h,n);
     417  setring R;
     418  return(newBetti);
     419  option(noredSB);
     420  option(noredTail);
     421}
     422example
     423{"EXAMPLE:";
     424   echo = 2;
     425   // cohomology of structure sheaf on P^4:
     426   //-------------------------------------------
     427   ring r=0,x(1..5),dp;
     428   module M=0;
     429   def A=sheafCohBGG1(0,-9,4);
     430   // cohomology of cotangential bundle on P^3:
     431   //-------------------------------------------
     432   ring R=0,(x,y,z,u),dp;
     433   resolution T1=mres(maxideal(1),0);
     434   module M=T1[3];
     435   intvec v=2,2,2,2,2,2;
     436   attrib(M,"isHomog",v);
     437   def B=sheafCohBGG1(M,-8,4);
     438}
     439
     440///////////////////////////////////////////////////////////////////////////////
    229441proc sheafCohBGG(module M,int l,int h)
    230442"USAGE:   sheafCohBGG(M,l,h);    M module, l,h int
     
    256468         table. To determine all values of @code{h^i(F(d))}, @code{d=l..h},
    257469         use @code{sheafCohBGG(M,l-n,h+n)}.
     470         Optimized version.
    258471SEE ALSO: sheafCoh, dimH
    259472EXAMPLE: example sheafCohBGG; shows an example
     
    265478     else { ERROR("No admissible degree vector assigned"); }
    266479  }
     480  intvec ivOptionsSave = option(get);
     481  option(redSB); option(redTail);
     482 
    267483  int n=nvars(basering)-1;
    268484  int ell=l+n;
     
    272488  module MT=truncate(M,bound);
    273489  int m=nrows(MT);
    274   MT=transpose(jacobM(MT));
     490  MT = tJacobian(MT); // transpose(jacobM(MT));
    275491  MT=syz(MT);
    276   matrix ML[n+1][1]=maxideal(1);
    277   matrix S=transpose(outer(ML,unitmat(m)));
    278   matrix SS=transpose(S*MT);
     492
     493  module SS = TensorModuleMult(m, MT);
     494 
    279495  //--- to the exterior algebra
    280   def AR = Exterior();
    281   setring AR;
    282   option(redSB);
    283   option(redTail);
     496  def AR = Exterior(); setring AR;
     497 
    284498  module EM=imap(R,SS);
    285499  intvec w;
     
    291505  }
    292506  attrib(EM,"isHomog",w);
    293   resolution RE=mres(EM,bound1);
     507  resolution RE = minres(nres(EM,bound1));
    294508  intmat Betti=betti(RE);
    295509  k=ncols(Betti);
     
    317531  }
    318532  displayCohom(newBetti,l,h,n);
     533 
    319534  setring R;
     535  option(set, ivOptionsSave);
     536 
    320537  return(newBetti);
    321   option(noredSB);
    322   option(noredTail);
    323538}
    324539example
     
    339554   def B=sheafCohBGG(M,-8,4);
    340555}
     556
    341557
    342558///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.