source: git/Singular/LIB/sheafcoh.lib @ 821b26

spielwiese
Last change on this file since 821b26 was 821b26, checked in by Motsak Oleksandr <motsak@…>, 14 years ago
*motsak: new experimental sheaf-cohomology-related stuff git-svn-id: file:///usr/local/Singular/svn/trunk@11680 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 37.0 KB
Line 
1///////////////////////////////////////////////////////////////////////////////
2version="$Id: sheafcoh.lib,v 1.17 2009-04-10 19:28:58 motsak Exp $";
3category="Commutative Algebra";
4info="
5LIBRARY:  sheafcoh.lib   Procedures for Computing Sheaf Cohomology
6AUTHORS:  Wolfram Decker, decker@math.uni-sb.de,
7@*        Christoph Lossen,  lossen@mathematik.uni-kl.de
8@*        Gerhard Pfister,  pfister@mathematik.uni-kl.de
9
10PROCEDURES:
11 truncate(phi,d);        truncation of coker(phi) at d
12 truncateFast(phi,d);    truncation of coker(phi) at d (fast+ experimental)
13 CM_regularity(M);       Castelnuovo-Mumford regularity of coker(M)
14 sheafCohBGG(M,l,h);     cohomology of sheaf associated to coker(M)
15 sheafCohBGG2(M,l,h);    cohomology of sheaf associated to coker(M), experimental version
16 sheafCoh(M,l,h);        cohomology of sheaf associated to coker(M)
17 dimH(i,M,d);            compute h^i(F(d)), F sheaf associated to coker(M)
18 dimGradedPart()
19
20AUXILIARY PROCEDURES:
21 displayCohom(B,l,h,n);  display intmat as Betti diagram (with zero rows)
22
23KEYWORDS: sheaf cohomology
24";
25
26///////////////////////////////////////////////////////////////////////////////
27LIB "matrix.lib";
28LIB "nctools.lib";
29LIB "homolog.lib";
30
31
32///////////////////////////////////////////////////////////////////////////////
33// testing for consistency of the library:
34proc testSheafCohLibrary()
35{
36  printlevel = printlevel + 1;
37  example truncate;
38  example truncateFast;
39  example CM_regularity;
40  example sheafCoh;
41  example sheafCohBGG;
42  example dimH;
43  example dimGradedPart;
44  example sheafCohBGG2;
45  example getStructureSheaf;
46  printlevel = printlevel - 1;
47}
48
49
50
51///////////////////////////////////////////////////////////////////////////////
52static proc jacobM(matrix M)
53{
54   int n=nvars(basering);
55   matrix B=transpose(diff(M,var(1)));
56   int i;
57   for(i=2;i<=n;i++)
58   {
59     B=concat(B,transpose(diff(M,var(i))));
60   }
61   return(transpose(B));
62}
63
64
65///////////////////////////////////////////////////////////////////////////////
66/**
67  let M = { w_1, ..., w_k }, k = size(M) == ncols(M), n = nvars(currRing).
68  assuming that nrows(M) <= m*n;
69  computes transpose(M) * transpose( var(1) I_m | ... | var(n) I_m ) :== transpose(module{f_1, ... f_k}),
70  where f_i = \sum_{j=1}^{m} (w_i, v_j) gen(j),  (w_i, v_j) is a `scalar` multiplication.
71  that is, if w_i = (a^1_1, ... a^1_m) | (a^2_1, ..., a^2_m) | ... | (a^n_1, ..., a^n_m) then
72
73  (a^1_1, ... a^1_m) | (a^2_1, ..., a^2_m) | ... | (a^n_1, ..., a^n_m)
74*  var_1  ... var_1  |  var_2  ...  var_2  | ... |  var_n  ...  var(n)
75*  gen_1  ... gen_m  |  gen_1  ...  gen_m  | ... |  gen_1  ...  gen_m
76+ =>
77  f_i =
78
79   a^1_1 * var(1) * gen(1) + ... + a^1_m * var(1) * gen(m) +
80   a^2_1 * var(2) * gen(1) + ... + a^2_m * var(2) * gen(m) +
81                             ...
82   a^n_1 * var(n) * gen(1) + ... + a^n_m * var(n) * gen(m);
83
84   NOTE: for every f_i we run only ONCE along w_i saving partial sums into a temporary array of polys of size m
85
86*/
87static proc TensorModuleMult(int m, module M)
88{
89  return( system("tensorModuleMult", m, M) ); // trick!
90
91  int n = nvars(basering);
92  int k = ncols(M);
93
94  int g, cc, vv;
95
96  poly h;
97
98  module Temp; // = {f_1, ..., f_k }
99
100  intvec exp;
101  vector pTempSum, w;
102
103  for( int i = k; i > 0; i-- ) // for every w \in M
104  {
105    pTempSum[m] = 0;
106    w = M[i];
107
108    while(w != 0) // for each term of w...
109    {
110      exp = leadexp(w);
111      g = exp[n+1]; // module component!
112      h = w[g];
113
114      w = w - h * gen(g);
115
116      cc = g % m;
117
118      if( cc == 0)
119      {
120        cc = m;
121      }
122
123      vv = 1 + (g - cc) / m;
124
125      pTempSum = pTempSum + h * var(vv) * gen(cc);
126    }
127
128    Temp[i] = pTempSum;
129  }
130
131  Temp = transpose(Temp);
132
133  return(Temp);
134}
135
136///////////////////////////////////////////////////////////////////////////////
137static proc max(int i,int j)
138{
139  if(i>j){return(i);}
140  return(j);
141}
142
143///////////////////////////////////////////////////////////////////////////////
144static proc min(int i,int j)
145{
146  if(i>j){return(j);}
147  return(i);
148}
149
150
151///////////////////////////////////////////////////////////////////////////////
152proc truncate(module phi, int d)
153"USAGE:   truncate(M,d);  M module, d int
154ASSUME:  @code{M} is graded, and it comes assigned with an admissible degree
155         vector as an attribute
156RETURN:  module
157NOTE:    Output is a presentation matrix for the truncation of coker(M)
158         at degree d.
159EXAMPLE: example truncate; shows an example
160KEYWORDS: truncated module
161"
162{
163  if ( typeof(attrib(phi,"isHomog"))=="string" ) {
164    if (size(phi)==0) {
165      // assign weights 0 to generators of R^n (n=nrows(phi))
166      intvec v;
167      v[nrows(phi)]=0;
168      attrib(phi,"isHomog",v);
169    }
170    else {
171      ERROR("No admissible degree vector assigned");
172    }
173  }
174  else {
175   intvec v=attrib(phi,"isHomog");
176  }
177  int i,m,dummy;
178  int s = nrows(phi);
179  module L; // TOO BIG!!!
180  for (i=1; i<=s; i++) {
181    if (d>v[i]) {
182      L = L+maxideal(d-v[i])*gen(i);
183    }
184    else {
185      L = L+gen(i);
186    }
187  }
188  L = modulo(L,phi);
189  L = minbase(prune(L));
190  if (size(L)==0) {return(L);}
191
192  // it only remains to set the degrees for L:
193  // ------------------------------------------
194  m = v[1];
195  for(i=2; i<=size(v); i++) {  if(v[i]<m) { m = v[i]; } }
196  dummy = homog(L);
197  intvec vv = attrib(L,"isHomog");
198  if (d>m) { vv = vv+d; }
199  else     { vv = vv+m; }
200  attrib(L,"isHomog",vv);
201  return(L);
202}
203example
204{"EXAMPLE:";
205   echo = 2;
206   ring R=0,(x,y,z),dp;
207   module M=maxideal(3);
208   homog(M);
209   // compute presentation matrix for truncated module (R/<x,y,z>^3)_(>=2)
210   module M2=truncate(M,2);
211   print(M2);
212   dimGradedPart(M2,1);
213   dimGradedPart(M2,2);
214   // this should coincide with:
215   dimGradedPart(M,2);
216   // shift grading by 1:
217   intvec v=1;
218   attrib(M,"isHomog",v);
219   M2=truncate(M,2);
220   print(M2);
221   dimGradedPart(M2,3);
222}
223
224///////////////////////////////////////////////////////////////////////////////
225
226proc truncateFast(module M, int d)
227"USAGE:   truncateFast(M,d);  M module, d int
228ASSUME:  @code{M} is graded, and it comes assigned with an admissible degree
229         vector as an attribute 'isHomog'
230RETURN:  module
231NOTE:    Output is a presentation matrix for the truncation of coker(M)
232         at d.
233         Fast + experimental version. M shoud be a SB!
234DISPLAY: If @code{printlevel}>=1, step-by step timings will be printed.
235         If @code{printlevel}>=2 we add progress debug messages
236         if @code{printlevel}>=3, even all intermediate results...
237EXAMPLE: example truncateFast; shows an example
238KEYWORDS: truncated module
239"
240{
241//  int PL = printlevel + 1;
242  int PL = printlevel - voice + 2;
243
244  dbprint(PL-1, "// truncateFast(M: "+ string(nrows(M)) + " x " + string(ncols(M)) +", " + string(d) + "):");
245  dbprint(PL-2, M);
246 
247  intvec save = option(get);
248  if( PL >= 2 )
249  {
250    option(prot);   
251    option(mem);   
252  }
253
254  int tTruncateBegin=timer;
255
256  if (attrib(M,"isSB")!=1)
257  {
258    ERROR("M must be a standard basis!");
259  };
260
261  dbprint(PL-1, "// M is a SB! ");
262
263  if ( typeof(attrib(M,"isHomog"))=="string" ) {
264    if (size(M)==0) {
265      // assign weights 0 to generators of R^n (n=nrows(M))
266      intvec v;
267      v[nrows(M)]=0;
268      attrib(M,"isHomog",v);
269    }
270    else {
271      ERROR("No admissible degree vector assigned");
272    }
273  }
274  else {
275   intvec v=attrib(M,"isHomog");
276  }
277
278  dbprint(PL-1, "// weighting(M): ["+ string(v) + "]");
279
280  int i,m,dummy;
281  int s = nrows(M);
282
283   int tKBaseBegin = timer;
284    module L = kbase(M, d); // TODO: check whether this is always correct!?!
285
286
287    dbprint(PL-1, "// L = kbase(M,d): "+string(nrows(L)) + " x " + string(ncols(L)) +"");
288    dbprint(PL-2, L);
289    dbprint(PL-1, "// weighting(L): ["+ string(attrib(L, "isHomog")) + "]");
290
291   int tModuloBegin = timer;
292    L = modulo(L,M);
293
294    dbprint(PL-1, "// L = modulo(L,M): "+string(nrows(L)) + " x " + string(ncols(L)) +"");
295    dbprint(PL-2, L);
296    dbprint(PL-1, "// weighting(L): ["+ string(attrib(L, "isHomog")) + "]");
297
298   int tPruneBegin = timer;
299    L = prune(L);
300
301    dbprint(PL-1, "// L = prune(L): "+string(nrows(L)) + " x " + string(ncols(L)) +"");
302    dbprint(PL-2, L);
303    dbprint(PL-1, "// weighting(L): ["+ string(attrib(L, "isHomog")) + "]");
304
305   int tPruneEnd = timer;
306    L = minbase(L);
307   int tMinBaseEnd = timer;
308
309    dbprint(PL-1, "// L = minbase(L): "+string(nrows(L)) + " x " + string(ncols(L)) +"");
310    dbprint(PL-2, L);
311    dbprint(PL-1, "// weighting(L): ["+ string(attrib(L, "isHomog")) + "]");
312
313
314
315
316  if (size(L)!=0)
317  {
318
319    // it only remains to set the degrees for L:
320    // ------------------------------------------
321    m = v[1];
322    for(i=2; i<=size(v); i++) {  if(v[i]<m) { m = v[i]; } }
323    dummy = homog(L);
324    intvec vv = attrib(L,"isHomog");
325    if (d>m) { vv = vv+d; }
326    else     { vv = vv+m; }
327    attrib(L,"isHomog",vv);
328  }
329
330  int tTruncateEnd=timer;
331 
332  dbprint(PL-1, "// corrected weighting(L): ["+ string(attrib(L, "isHomog")) + "]");
333
334
335  if(PL > 0)
336  {
337  "
338  -------------- TIMINGS --------------
339  Trunc        Time: ", tTruncateEnd - tTruncateBegin, "
340    :: Before .Time: ", tKBaseBegin - tTruncateBegin, "
341    :: kBase   Time: ", tModuloBegin - tKBaseBegin, "
342    :: Modulo  Time: ", tPruneBegin - tModuloBegin, "
343    :: Prune   Time: ", tPruneEnd - tPruneBegin, "
344    :: Minbase Time: ", tMinBaseEnd - tPruneEnd, "
345    :: After  .Time: ", tTruncateEnd - tMinBaseEnd;
346  }
347 
348  option(set, save);
349
350  return(L);
351}
352example
353{"EXAMPLE:";
354   echo = 2;
355   ring R=0,(x,y,z,u,v),dp;
356   module M=maxideal(3);
357   homog(M);
358   // compute presentation matrix for truncated module (R/<x,y,z,u>^3)_(>=2)
359   int t=timer;
360   module M2t=truncate(M,2);
361   t = timer - t;
362   "// Simple truncate: ", t;
363   t=timer;
364   module M2=truncateFast(std(M),2);
365   t = timer - t;
366   "// Fast truncate: ", t;
367   print(M2);
368   "// Check: M2t == M2?: ", size(NF(M2, std(M2t))) + size(NF(M2t, std(M2)));
369
370   dimGradedPart(M2,1);
371   dimGradedPart(M2,2);
372   // this should coincide with:
373   dimGradedPart(M,2);
374   // shift grading by 1:
375   intvec v=1;
376   attrib(M,"isHomog",v);
377   t=timer;
378   M2t=truncate(M,2);
379   t = timer - t;
380   "// Simple truncate: ", t;
381   t=timer;
382   M2=truncateFast(std(M),2);
383   t = timer - t;
384   "// Fast truncate: ", t;
385   print(M2);
386   "// Check: M2t == M2?: ", size(NF(M2, std(M2t))) + size(NF(M2t, std(M2))); //?
387   dimGradedPart(M2,3);
388}
389
390///////////////////////////////////////////////////////////////////////////////
391
392
393
394
395
396proc dimGradedPart(module phi, int d)
397"USAGE:   dimGradedPart(M,d);  M module, d int
398ASSUME:  @code{M} is graded, and it comes assigned with an admissible degree
399         vector as an attribute
400RETURN:  int
401NOTE:    Output is the vector space dimension of the graded part of degree d
402         of coker(M).
403EXAMPLE: example dimGradedPart; shows an example
404KEYWORDS: graded module, graded piece
405"
406{
407  if ( typeof(attrib(phi,"isHomog"))=="string" ) {
408    if (size(phi)==0) {
409      // assign weights 0 to generators of R^n (n=nrows(phi))
410      intvec v;
411      v[nrows(phi)]=0;
412    }
413    else { ERROR("No admissible degree vector assigned"); }
414  }
415  else {
416    intvec v=attrib(phi,"isHomog");
417  }
418  int s = nrows(phi);
419  int i,m,dummy;
420  module L,LL;
421  for (i=1; i<=s; i++) {
422    if (d>v[i]) {
423      L = L+maxideal(d-v[i])*gen(i);
424      LL = LL+maxideal(d+1-v[i])*gen(i);
425    }
426    else {
427      L = L+gen(i);
428      if (d==v[i]) {
429        LL = LL+maxideal(1)*gen(i);
430      }
431      else {
432        LL = LL+gen(i);
433      }
434    }
435  }
436  LL=LL,phi;
437  L = modulo(L,LL);
438  L = std(prune(L));
439  if (size(L)==0) {return(0);}
440  return(vdim(L));
441}
442example
443{"EXAMPLE:";
444   echo = 2;
445   ring R=0,(x,y,z),dp;
446   module M=maxideal(3);
447   // assign compatible weight vector (here: 0)
448   homog(M);
449   // compute dimension of graded pieces of R/<x,y,z>^3 :
450   dimGradedPart(M,0);
451   dimGradedPart(M,1);
452   dimGradedPart(M,2);
453   dimGradedPart(M,3);
454   // shift grading:
455   attrib(M,"isHomog",intvec(2));
456   dimGradedPart(M,2);
457}
458
459///////////////////////////////////////////////////////////////////////////////
460
461proc CM_regularity (module M)
462"USAGE:   CM_regularity(M);    M module
463ASSUME:   @code{M} is graded, and it comes assigned with an admissible degree
464         vector as an attribute
465RETURN:  integer, the Castelnuovo-Mumford regularity of coker(M)
466NOTE:    procedure calls mres
467EXAMPLE: example CM_regularity; shows an example
468KEYWORDS: Castelnuovo-Mumford regularity
469"
470{
471  if ( typeof(attrib(M,"isHomog"))=="string" ) {
472    if (size(M)==0) {
473      // assign weights 0 to generators of R^n (n=nrows(M))
474      intvec v;
475      v[nrows(M)]=0;
476      attrib(M,"isHomog",v);
477    }
478    else {
479      ERROR("No admissible degree vector assigned");
480    }
481  }
482 
483  if( attrib(CM_regularity,"Algorithm") != "mres" )
484  {
485    def L = minres( res(M,0) ); // let's try it out!
486  } else
487  {
488    def L = mres(M,0);
489  }
490 
491  intmat BeL = betti(L);
492  int r = nrows(module(matrix(BeL)));  // last non-zero row
493  if (typeof(attrib(BeL,"rowShift"))!="string") {
494    int shift = attrib(BeL,"rowShift");
495  }
496  return(r+shift-1);
497}
498example
499{"EXAMPLE:";
500   echo = 2;
501   ring R=0,(x,y,z,u),dp;
502   resolution T1=mres(maxideal(1),0);
503   module M=T1[3];
504   intvec v=2,2,2,2,2,2;
505   attrib(M,"isHomog",v);
506   CM_regularity(M);
507}
508
509///////////////////////////////////////////////////////////////////////////////
510proc sheafCohBGG(module M,int l,int h)
511"USAGE:   sheafCohBGG(M,l,h);    M module, l,h int
512ASSUME:  @code{M} is graded, and it comes assigned with an admissible degree
513         vector as an attribute, @code{h>=l}, and the basering has @code{n+1}
514         variables.
515RETURN:  intmat, cohomology of twists of the coherent sheaf F on P^n
516         associated to coker(M). The range of twists is determined by @code{l},
517         @code{h}.
518DISPLAY: The intmat is displayed in a diagram of the following form: @*
519  @format
520                l            l+1                      h
521  ----------------------------------------------------------
522      n:     h^n(F(l))    h^n(F(l+1))   ......    h^n(F(h))
523           ...............................................
524      1:     h^1(F(l))    h^1(F(l+1))   ......    h^1(F(h))
525      0:     h^0(F(l))    h^0(F(l+1))   ......    h^0(F(h))
526  ----------------------------------------------------------
527    chi:     chi(F(l))    chi(F(l+1))   ......    chi(F(h))
528  @end format
529         A @code{'-'} in the diagram refers to a zero entry; a @code{'*'}
530         refers to a negative entry (= dimension not yet determined).
531         refers to a not computed dimension. @*
532NOTE:    This procedure is based on the Bernstein-Gel'fand-Gel'fand
533         correspondence and on Tate resolution ( see [Eisenbud, Floystad,
534         Schreyer: Sheaf cohomology and free resolutions over exterior
535         algebras, Trans AMS 355 (2003)] ).@*
536         @code{sheafCohBGG(M,l,h)} does not compute all values in the above
537         table. To determine all values of @code{h^i(F(d))}, @code{d=l..h},
538         use @code{sheafCohBGG(M,l-n,h+n)}.
539SEE ALSO: sheafCoh, dimH
540EXAMPLE: example sheafCohBGG; shows an example
541"
542{
543  int i,j,k,row,col;
544  if( typeof(attrib(M,"isHomog"))!="intvec" )
545  {
546     if (size(M)==0) { attrib(M,"isHomog",0); }
547     else { ERROR("No admissible degree vector assigned"); }
548  }
549  int n=nvars(basering)-1;
550  int ell=l+n;
551  def R=basering;
552  int reg = CM_regularity(M);
553  int bound=max(reg+1,h-1);
554  module MT=truncate(M,bound);
555  int m=nrows(MT);
556  MT=transpose(jacobM(MT));
557  MT=syz(MT);
558  matrix ML[n+1][1]=maxideal(1);
559  matrix S=transpose(outer(ML,unitmat(m)));
560  matrix SS=transpose(S*MT);
561  //--- to the exterior algebra
562  def AR = Exterior();
563  setring AR;
564  option(redSB);
565  option(redTail);
566  module EM=imap(R,SS);
567  intvec w;
568  //--- here we are with our matrix
569  int bound1=max(1,bound-ell+1);
570  for (i=1; i<=nrows(EM); i++)
571  {
572     w[i]=-bound-1;
573  }
574  attrib(EM,"isHomog",w);
575  resolution RE=mres(EM,bound1);
576  intmat Betti=betti(RE);
577  k=ncols(Betti);
578  row=nrows(Betti);
579  int shift=attrib(Betti,"rowShift")+(k+ell-1);
580  intmat newBetti[n+1][h-l+1];
581  for (j=1; j<=row; j++)
582  {
583    for (i=l; i<=h; i++)
584    {
585      if ((k+1-j-i+ell-shift>0) and (j+i-ell+shift>=1))
586      {
587        newBetti[n+2-shift-j,i-l+1]=Betti[j,k+1-j-i+ell-shift];
588      }
589      else { newBetti[n+2-shift-j,i-l+1]=-1; }
590    }
591  }
592  for (j=2; j<=n+1; j++)
593  {
594    for (i=1; i<j; i++)
595    {
596      newBetti[j,i]=-1;
597    }
598  }
599  int d=k-h+ell-1;
600  for (j=1; j<=n; j++)
601  {
602    for (i=h-l+1; i>=k+j; i--)
603    {
604      newBetti[j,i]=-1;
605    }
606  }
607  displayCohom(newBetti,l,h,n);
608  setring R;
609  return(newBetti);
610  option(noredSB);
611  option(noredTail);
612}
613example
614{"EXAMPLE:";
615   echo = 2;
616   // cohomology of structure sheaf on P^4:
617   //-------------------------------------------
618   ring r=0,x(1..5),dp;
619   module M=0;
620   def A=sheafCohBGG(0,-9,4);
621   // cohomology of cotangential bundle on P^3:
622   //-------------------------------------------
623   ring R=0,(x,y,z,u),dp;
624   resolution T1=mres(maxideal(1),0);
625   module M=T1[3];
626   intvec v=2,2,2,2,2,2;
627   attrib(M,"isHomog",v);
628   def B=sheafCohBGG(M,-8,4);
629}
630
631
632///////////////////////////////////////////////////////////////////////////////
633static proc showResult( def R, int l, int h )
634{
635  int PL = printlevel - voice + 2;
636// int PL = printlevel + 1;
637
638  intmat Betti;
639  if(typeof(R)=="resolution")
640  {
641    Betti = betti(R);
642  } else
643  {
644    if(typeof(R)!="intmat")
645    {
646      ERROR("Wrong input!!!");
647    };
648
649    Betti = R; 
650  } 
651
652  int n=nvars(basering)-1;
653  int ell = l + n;
654
655  int k     = ncols(Betti);
656  int row   = nrows(Betti);
657  int shift = attrib(Betti,"rowShift") + (k + ell - 1);
658
659  intmat newBetti[ n + 1 ][ h - l + 1 ];
660
661  int i, j;
662
663  for (j=1; j<=row; j++) {
664    for (i=l; i<=h; i++) {
665      if( (n+2-shift-j)>0 ) {
666
667        if (  (k+1-j-i+ell-shift>0) and (j+i-ell+shift>=1)) {
668          newBetti[n+2-shift-j,i-l+1]=Betti[j,k+1-j-i+ell-shift];
669        }
670        else { newBetti[n+2-shift-j,i-l+1]=-1; }
671
672      }
673    }
674  }
675
676  int iWTH = h-l+1;
677  for (j=2; j<=n+1; j++) {
678    for (i=1; i<min(j, iWTH); i++) {
679      newBetti[j,i]=-1;
680    }
681  }
682  int d = k - h + ell - 1;
683  for (j=1; j<=n; j++) {
684    for (i=iWTH; i>=k+j; i--) {
685      newBetti[j,i]=-1;
686    }
687  }
688
689  if( PL > 0 )
690  {
691    "Cohomology table:";
692    displayCohom(newBetti, l, h, n);
693  }
694
695  return(newBetti);
696}
697///////////////////////////////////////////////////////////////////////////////
698
699
700
701///////////////////////////////////////////////////////////////////////////////
702proc sheafCohBGG2(module M,int l,int h)
703"USAGE:   sheafCohBGG2(M,l,h);    M module, l,h int
704ASSUME:  @code{M} is graded, and it comes assigned with an admissible degree
705         vector as an attribute, @code{h>=l}, and the basering has @code{n+1}
706         variables.
707RETURN:  intmat, cohomology of twists of the coherent sheaf F on P^n
708         associated to coker(M). The range of twists is determined by @code{l},
709         @code{h}.
710DISPLAY: The intmat is displayed in a diagram of the following form: @*
711  @format
712                l            l+1                      h
713  ----------------------------------------------------------
714      n:     h^n(F(l))    h^n(F(l+1))   ......    h^n(F(h))
715           ...............................................
716      1:     h^1(F(l))    h^1(F(l+1))   ......    h^1(F(h))
717      0:     h^0(F(l))    h^0(F(l+1))   ......    h^0(F(h))
718  ----------------------------------------------------------
719    chi:     chi(F(l))    chi(F(l+1))   ......    chi(F(h))
720  @end format
721         A @code{'-'} in the diagram refers to a zero entry; a @code{'*'}
722         refers to a negative entry (= dimension not yet determined).
723         refers to a not computed dimension. @*
724         If @code{printlevel}>=1, step-by step timings will be printed.
725         If @code{printlevel}>=2 we add progress debug messages
726         if @code{printlevel}>=3, even all intermediate results...
727NOTE:    This procedure is based on the Bernstein-Gel'fand-Gel'fand
728         correspondence and on Tate resolution ( see [Eisenbud, Floystad,
729         Schreyer: Sheaf cohomology and free resolutions over exterior
730         algebras, Trans AMS 355 (2003)] ).@*
731         @code{sheafCohBGG(M,l,h)} does not compute all values in the above
732         table. To determine all values of @code{h^i(F(d))}, @code{d=l..h},
733         use @code{sheafCohBGG(M,l-n,h+n)}.
734         Experimental version. Should require less memory.
735SEE ALSO: sheafCohBGG
736EXAMPLE: example sheafCohBGG2; shows an example
737"
738{
739  int PL = printlevel - voice + 2;
740//  int PL = printlevel;
741
742  dbprint(PL-1, "// sheafCohBGG2(M: "+ string(nrows(M)) + " x " + string(ncols(M)) +", " + string(l) + ", " + string(h) + "):");
743  dbprint(PL-2, M);
744
745  intvec save = option(get);
746 
747  if( PL >= 2 )
748  {
749    option(prot);   
750    option(mem);   
751  }
752
753  def isCoker = attrib(M, "isCoker");
754  if( typeof(isCoker) == "int" )   
755  {
756    if( isCoker > 0 )
757    {
758      dbprint(PL-1, "We are going to assume that M is given by coker matrix (that is, M is not a submodule presentation!)");
759    }
760  }
761
762           
763  int i,j,k,row,col;
764 
765  if( typeof(attrib(M,"isHomog"))!="intvec" ) {
766     if (size(M)==0) { attrib(M,"isHomog",0); }
767     else { ERROR("No admissible degree vector assigned"); }
768  }
769
770  dbprint(PL-1, "// weighting(M): ["+ string(attrib(M, "isHomog")) + "]");
771 
772  option(redSB); option(redTail);
773
774  def R=basering;
775
776  int n = nvars(R) - 1;
777  int ell = l + n;
778
779 
780/////////////////////////////////////////////////////////////////////////////
781// computations
782
783  int tBegin=timer;
784  int reg   = CM_regularity(M);
785  int tCMEnd = timer;
786
787  dbprint(PL-1, "// CM_reg(M): "+ string(reg));
788
789  int bound = max(reg + 1, h - 1);
790
791  dbprint(PL-1, "// bound: "+ string(bound));
792
793  ///////////////////////////////////////////////////////////////
794  int tSTDBegin=timer;
795  M = std(M); // for kbase! // NOTE: this should be after CM_regularity, since otherwise CM_regularity computes JUST TOOOOOOO LONG sometimes (see Reg_Hard examples!)
796  int tSTDEnd = timer;
797
798  dbprint(PL-1, "// M = std(M: "+string(nrows(M)) + " x " + string(ncols(M))  + ")");
799  dbprint(PL-2, M);
800  dbprint(PL-1, "// weighting(M): ["+ string(attrib(M, "isHomog")) + "]"); 
801
802
803  printlevel = printlevel + 1;
804  int tTruncateBegin=timer;
805  module MT = truncateFast(M, bound);
806  int tTruncateEnd=timer;
807  printlevel = printlevel - 1;
808
809  dbprint(PL-1, "// MT = truncateFast(M: "+string(nrows(MT)) + " x " + string(ncols(MT)) +", " + string(bound) + ")");
810  dbprint(PL-2, MT);
811  dbprint(PL-1, "// weighting(MT): ["+ string(attrib(MT, "isHomog")) + "]"); 
812 
813  int m=nrows(MT);
814
815  ///////////////////////////////////////////////////////////////
816  int tTransposeJacobBegin=timer;
817  MT = jacob(MT); // ! :(
818  int tTransposeJacobEnd=timer;
819
820
821  dbprint(PL-1, "// MT = jacob(MT: "+string(nrows(MT)) + " x " + string(ncols(MT))  + ")");
822  dbprint(PL-2, MT);
823  dbprint(PL-1, "// weighting(MT): ["+ string(attrib(MT, "isHomog")) + "]"); 
824 
825
826  int tSyzBegin=timer;
827  MT = syz(MT);
828  int tSyzEnd=timer;
829
830
831  dbprint(PL-1, "// MT = syz(MT: "+string(nrows(MT)) + " x " + string(ncols(MT))  + ")");
832  dbprint(PL-2, MT);
833  dbprint(PL-1, "// weighting(MT): ["+ string(attrib(MT, "isHomog")) + "]"); 
834
835 
836  int tMatrixOppBegin=timer;
837  module SS = TensorModuleMult(m, MT);
838  int tMatrixOppEnd=timer; 
839
840  dbprint(PL-1, "// SS = TensorModuleMult("+ string(m)+ ", MT: "+string(nrows(MT)) + " x " + string(ncols(MT))  + ")");
841  dbprint(PL-2, SS);
842  dbprint(PL-1, "// weighting(SS): ["+ string(attrib(SS, "isHomog")) + "]"); 
843 
844 
845  //--- to the exterior algebra
846  def AR = Exterior(); setring AR;
847
848  dbprint(PL-1, "// Test: var(1) * var(1): "+ string(var(1) * var(1)));
849
850  int maxbound = max(1, bound - ell + 1);
851//  int maxbound = max(1, bound - l + 1); // As In M2!!!
852
853  dbprint(PL-1, "// maxbound: "+ string(maxbound));
854 
855  //--- here we are with our matrix
856  module EM=imap(R,SS);
857  intvec w;
858  for (i=1; i<=nrows(EM); i++)
859  {
860     w[i]=-bound-1;
861  }
862
863  attrib(EM,"isHomog",w);
864
865 
866
867  ///////////////////////////////////////////////////////////////
868
869  dbprint(PL-1, "// EM: "+string(nrows(EM)) + " x " + string(ncols(EM))  + ")");
870  dbprint(PL-2, EM);
871  dbprint(PL-1, "// weighting(EM): ["+ string(attrib(EM, "isHomog")) + "]"); 
872 
873
874  int tResulutionBegin=timer;
875  resolution RE = nres(EM, maxbound);
876  int tMinResBegin=timer;
877  RE = minres(RE);   
878  int tBettiBegin=timer;
879  intmat Betti = betti(RE); // betti(RE, 1);?
880  int tResulutionEnd=timer;
881 
882  int tEnd = tResulutionEnd;
883
884  if( PL > 0 )
885  {
886    "
887        ----      RESULTS  ---- 
888        Tate Resolution (Length: ", size(RE), "):
889    ";
890    RE;
891    "Betti numbers for Tate resolution (diagonal cohomology table):";
892    print(Betti, "betti"); // Diagonal form!
893  };
894
895 
896  printlevel = printlevel + 1;
897  Betti = showResult(Betti, l, h ); // Show usual form of cohomology table
898  printlevel = printlevel - 1;
899
900 
901  if(PL > 0)
902  {
903  "
904      ----      TIMINGS     -------
905      Trunc      Time: ", tTruncateEnd - tTruncateBegin, "
906      Reg        Time: ", tCMEnd - tBegin, "
907      kStd       Time: ", tSTDEnd - tSTDBegin, "
908      Jacob      Time: ", tTransposeJacobEnd - tTransposeJacobBegin, "
909      Syz        Time: ", tSyzEnd - tSyzBegin, "
910      Mat        Time: ", tMatrixOppEnd - tMatrixOppBegin, "
911      ------------------------------ 
912      Res        Time: ", tResulutionEnd - tResulutionBegin, "
913      :: NRes    Time: ", tMinResBegin - tResulutionBegin, "
914      :: MinRes .Time: ", tBettiBegin - tMinResBegin, "
915      :: Betti  .Time: ", tResulutionEnd - tBettiBegin, "
916      ---------------------------------------------------------
917      Total Time: ", tEnd - tBegin, "
918      ---------------------------------------------------------
919      ";
920  };
921 
922  setring R;
923
924  option(set, save);
925
926  return(Betti);
927}
928example
929{"EXAMPLE:";
930   echo = 2;
931   int pl = printlevel;
932   // cohomology of structure sheaf on P^4:
933   //-------------------------------------------
934   ring r=32001,x(1..5),dp;
935   module M= getStructureSheaf();
936
937   int t = timer;
938   def A=sheafCohBGG(0,-9,4);
939   timer - t;
940   
941   printlevel = voice; A=sheafCohBGG2(0,-9,4); printlevel = pl;
942   
943   // cohomology of cotangential bundle on P^3:
944   //-------------------------------------------
945   ring R=32001,(x,y,z,u),dp;
946
947   module M = getCotangentialBundle();
948   
949   int t = timer;
950   def B=sheafCohBGG(M,-8,4);
951   timer - t;
952   
953   printlevel = voice; B=sheafCohBGG2(M,-8,4); printlevel = pl;
954}
955
956
957///////////////////////////////////////////////////////////////////////////////
958
959proc dimH(int i,module M,int d)
960"USAGE:   dimH(i,M,d);    M module, i,d int
961ASSUME:  @code{M} is graded, and it comes assigned with an admissible degree
962         vector as an attribute, @code{h>=l}, and the basering @code{S} has
963         @code{n+1} variables.
964RETURN:  int,  vector space dimension of @math{H^i(F(d))} for F the coherent
965         sheaf on P^n associated to coker(M).
966NOTE:    The procedure is based on local duality as described in [Eisenbud:
967         Computing cohomology. In Vasconcelos: Computational methods in
968         commutative algebra and algebraic geometry. Springer (1998)].
969SEE ALSO: sheafCoh, sheafCohBGG
970EXAMPLE: example dimH; shows an example
971"
972{
973  if( typeof(attrib(M,"isHomog"))=="string" ) {
974    if (size(M)==0) {
975      // assign weights 0 to generators of R^n (n=nrows(M))
976      intvec v;
977      v[nrows(M)]=0;
978      attrib(M,"isHomog",v);
979    }
980    else {
981      ERROR("No admissible degree vector assigned");
982    }
983  }
984  int Result;
985  int n=nvars(basering)-1;
986  if ((i>0) and (i<=n)) {
987    list L=Ext_R(n-i,M,1)[2];
988    def N=L[1];
989    return(dimGradedPart(N,-n-1-d));
990  }
991  else {
992    if (i==0) {
993      list L=Ext_R(intvec(n+1,n+2),M,1)[2];
994      def N0=L[2];
995      def N1=L[1];
996      Result=dimGradedPart(M,d) - dimGradedPart(N0,-n-1-d)
997                                - dimGradedPart(N1,-n-1-d);
998      return(Result);
999    }
1000    else {
1001      return(0);
1002    }
1003  }
1004}
1005example
1006{"EXAMPLE:";
1007   echo = 2;
1008   ring R=0,(x,y,z,u),dp;
1009   resolution T1=mres(maxideal(1),0);
1010   module M=T1[3];
1011   intvec v=2,2,2,2,2,2;
1012   attrib(M,"isHomog",v);
1013   dimH(0,M,2);
1014   dimH(1,M,0);
1015   dimH(2,M,1);
1016   dimH(3,M,-5);
1017}
1018
1019
1020///////////////////////////////////////////////////////////////////////////////
1021
1022proc sheafCoh(module M,int l,int h,list #)
1023"USAGE:   sheafCoh(M,l,h);    M module, l,h int
1024ASSUME:  @code{M} is graded, and it comes assigned with an admissible degree
1025         vector as an attribute, @code{h>=l}. The basering @code{S} has
1026         @code{n+1} variables.
1027RETURN:  intmat, cohomology of twists of the coherent sheaf F on P^n
1028         associated to coker(M). The range of twists is determined by @code{l},
1029         @code{h}.
1030DISPLAY: The intmat is displayed in a diagram of the following form: @*
1031  @format
1032                l            l+1                      h
1033  ----------------------------------------------------------
1034      n:     h^n(F(l))    h^n(F(l+1))   ......    h^n(F(h))
1035           ...............................................
1036      1:     h^1(F(l))    h^1(F(l+1))   ......    h^1(F(h))
1037      0:     h^0(F(l))    h^0(F(l+1))   ......    h^0(F(h))
1038  ----------------------------------------------------------
1039    chi:     chi(F(l))    chi(F(l+1))   ......    chi(F(h))
1040  @end format
1041         A @code{'-'} in the diagram refers to a zero entry.
1042NOTE:    The procedure is based on local duality as described in [Eisenbud:
1043         Computing cohomology. In Vasconcelos: Computational methods in
1044         commutative algebra and algebraic geometry. Springer (1998)].@*
1045         By default, the procedure uses @code{mres} to compute the Ext
1046         modules. If called with the additional parameter @code{\"sres\"},
1047         the @code{sres} command is used instead.
1048SEE ALSO: dimH, sheafCohBGG
1049EXAMPLE: example sheafCoh; shows an example
1050"
1051{
1052  int use_sres;
1053  if( typeof(attrib(M,"isHomog"))!="intvec" ) {
1054     if (size(M)==0) { attrib(M,"isHomog",0); }
1055     else { ERROR("No admissible degree vector assigned"); }
1056  }
1057  if (size(#)>0) {
1058    if (#[1]=="sres") { use_sres=1; }
1059  }
1060  int i,j;
1061  module N,N0,N1;
1062  int n=nvars(basering)-1;
1063  intvec v=0..n+1;
1064  int col=h-l+1;
1065  intmat newBetti[n+1][col];
1066  if (use_sres) { list L=Ext_R(v,M,1,"sres")[2]; }
1067  else          { list L=Ext_R(v,M,1)[2]; }
1068  for (i=l; i<=h; i++) {
1069    N0=L[n+2];
1070    N1=L[n+1];
1071    newBetti[n+1,i-l+1]=dimGradedPart(M,i) - dimGradedPart(N0,-n-1-i)
1072                             - dimGradedPart(N0,-n-1-i);
1073  }
1074  for (j=1; j<=n; j++) {
1075     N=L[j];
1076     attrib(N,"isSB",1);
1077     if (dim(N)>=0) {
1078       for (i=l; i<=h; i++) {
1079         newBetti[j,i-l+1]=dimGradedPart(N,-n-1-i);
1080       }
1081     }
1082  }
1083  displayCohom(newBetti,l,h,n);
1084  return(newBetti);
1085}
1086example
1087{"EXAMPLE:";
1088   echo = 2;
1089   //
1090   // cohomology of structure sheaf on P^4:
1091   //-------------------------------------------
1092   ring r=0,x(1..5),dp;
1093   module M=0;
1094   def A=sheafCoh(0,-7,2);
1095   //
1096   // cohomology of cotangential bundle on P^3:
1097   //-------------------------------------------
1098   ring R=0,(x,y,z,u),dp;
1099   resolution T1=mres(maxideal(1),0);
1100   module M=T1[3];
1101   intvec v=2,2,2,2,2,2;
1102   attrib(M,"isHomog",v);
1103   def B=sheafCoh(M,-6,2);
1104}
1105
1106///////////////////////////////////////////////////////////////////////////////
1107proc displayCohom (intmat data, int l, int h, int n)
1108"USAGE:   displayCohom(data,l,h,n);  data intmat, l,h,n int
1109ASSUME:  @code{h>=l}, @code{data} is the return value of
1110         @code{sheafCoh(M,l,h)} or of @code{sheafCohBGG(M,l,h)}, and the
1111         basering has @code{n+1} variables.
1112RETURN:  none
1113NOTE:    The intmat is displayed in a diagram of the following form: @*
1114  @format
1115                l            l+1                      h
1116  ----------------------------------------------------------
1117      n:     h^n(F(l))    h^n(F(l+1))   ......    h^n(F(h))
1118           ...............................................
1119      1:     h^1(F(l))    h^1(F(l+1))   ......    h^1(F(h))
1120      0:     h^0(F(l))    h^0(F(l+1))   ......    h^0(F(h))
1121  ----------------------------------------------------------
1122    chi:     chi(F(l))    chi(F(l+1))   ......    chi(F(h))
1123  @end format
1124         where @code{F} refers to the associated sheaf of @code{M} on P^n.@*
1125         A @code{'-'} in the diagram refers to a zero entry,  a @code{'*'}
1126         refers to a negative entry (= dimension not yet determined).
1127"
1128{
1129  int i,j,k,dat,maxL;
1130  intvec notSumCol;
1131  notSumCol[h-l+1]=0;
1132  string s;
1133  maxL=4;
1134  for (i=1;i<=nrows(data);i++) {
1135    for (j=1;j<=ncols(data);j++) {
1136      if (size(string(data[i,j]))>=maxL-1) {
1137        maxL=size(string(data[i,j]))+2;
1138      }
1139    }
1140  }
1141  string Row="    ";
1142  string Row1="----";
1143  for (i=l; i<=h; i++) {
1144    for (j=1; j<=maxL-size(string(i)); j++) {
1145      Row=Row+" ";
1146    }
1147    Row=Row+string(i);
1148    for (j=1; j<=maxL; j++) { Row1 = Row1+"-"; }
1149  }
1150  print(Row);
1151  print(Row1);
1152  for (j=1; j<=n+1; j++) {
1153    s = string(n+1-j);
1154    Row = "";
1155    for(k=1; k<4-size(s); k++) { Row = Row+" "; }
1156    Row = Row + s+":";
1157    for (i=0; i<=h-l; i++) {
1158      dat = data[j,i+1];
1159      if (dat>0) { s = string(dat); }
1160      else {
1161        if (dat==0) { s="-"; }
1162        else        { s="*"; notSumCol[i+1]=1; }
1163      }
1164      for(k=1; k<=maxL-size(s); k++) { Row = Row+" "; }
1165      Row = Row + s;
1166    }
1167    print(Row);
1168  }
1169  print(Row1);
1170  Row="chi:";
1171  for (i=0; i<=h-l; i++) {
1172    dat = 0;
1173    if (notSumCol[i+1]==0) {
1174      for (j=0; j<=n; j++) { dat = dat + (-1)^j * data[n+1-j,i+1]; }
1175      s = string(dat);
1176    }
1177    else { s="*"; }
1178    for (k=1; k<=maxL-size(s); k++) { Row = Row+" "; }
1179    Row = Row + s;
1180  }
1181  print(Row);
1182}
1183///////////////////////////////////////////////////////////////////////////////
1184
1185proc getStructureSheaf(list #)
1186{
1187
1188  if( size(#) == 0 )
1189  {
1190
1191    module M = 0;
1192    intvec v = 0;
1193    attrib(M,"isHomog",v);
1194    homog(M);
1195
1196    attrib(M, "isCoker", 1);
1197
1198    attrib(M);   
1199    return(M);
1200  };
1201
1202 
1203
1204
1205 
1206  if( typeof(#[1]) == "ideal")
1207  {
1208
1209
1210    ideal I = #[1];
1211
1212    if( size(#) == 2 )
1213    {
1214      if( typeof(#[2]) == "int" )
1215      {
1216        if( #[2] != 0 )
1217        {
1218          qring @@@@QQ = std(I);
1219
1220          module M = getStructureSheaf();
1221         
1222          export M;
1223
1224//          keepring @@@@QQ; // This is a bad idea... :(
1225          return (@@@@QQ);
1226        }
1227      }
1228    }
1229
1230/*
1231    // This seems to be wrong!!!
1232    module M = I * gen(1);
1233    homog(M);
1234   
1235    M = modulo(gen(1), module(I * gen(1))); // basering^1 / I
1236
1237    homog(M);
1238   
1239    attrib(M, "isCoker", 1);
1240
1241    attrib(M);
1242    return(M);
1243*/   
1244  }   
1245 
1246  ERROR("Wrong argument");
1247 
1248}   
1249example
1250{"EXAMPLE:";
1251   echo = 2; int pl = printlevel;
1252   printlevel = voice;
1253
1254
1255   ////////////////////////////////////////////////////////////////////////////////
1256   ring r;
1257   module M = getStructureSheaf();
1258   "Basering: ";
1259   basering;
1260   "Module: ", string(M), ", grading is given by weights: ", attrib(M, "isHomog");
1261
1262   def A=sheafCohBGG2(M,-9,9);
1263   print(A);
1264   
1265   ////////////////////////////////////////////////////////////////////////////////
1266   setring r;
1267   module M = getStructureSheaf(ideal(var(1)), 0);
1268   
1269   "Basering: ";
1270   basering;
1271   "Module: ", string(M), ", grading is given by weights: ", attrib(M, "isHomog");
1272
1273   def A=sheafCohBGG2(M,-9,9);
1274   print(A);
1275
1276   ////////////////////////////////////////////////////////////////////////////////
1277   setring r;
1278   def Q = getStructureSheaf(ideal(var(1)), 1); // returns a new ring!
1279   setring Q; // M was exported in the new ring!
1280   
1281   "Basering: ";
1282   basering;
1283   "Module: ", string(M), ", grading is given by weights: ", attrib(M, "isHomog");
1284
1285   def A=sheafCohBGG2(M,-9,9);
1286   print(A);
1287
1288   printlevel = pl;
1289}
1290
1291
1292proc getCotangentialBundle()
1293{
1294  resolution T1=mres(maxideal(1),3);
1295  module M=T1[3];
1296  attrib(M,"isHomog");
1297  homog(M);
1298  attrib(M, "isCoker", 1);
1299  attrib(M);
1300  return (M);
1301};
1302
1303proc getIdealSheafPullback(ideal I, ideal pi)
1304{
1305  def save = basering;
1306  map P = save, pi;
1307  return( P(I) );
1308}
1309
1310// TODO: set attributes!
1311
1312
1313proc getIdealSheaf(ideal I)
1314{
1315  resolution FI = mres(I,2); // Syz + grading...
1316  module M = FI[2];
1317  attrib(M, "isCoker", 1);
1318  attrib(M);
1319  return(M);
1320};
1321
1322
1323
1324
1325
1326/*
1327Examples:
1328---------
1329 LIB "sheafcoh.lib";
1330
1331 ring S = 32003, x(0..4), dp;
1332 module MI=maxideal(1);
1333 attrib(MI,"isHomog",intvec(-1));
1334 resolution kos = nres(MI,0);
1335 print(betti(kos),"betti");
1336 LIB "random.lib";
1337 matrix alpha0 = random(32002,10,3);
1338 module pres = module(alpha0)+kos[3];
1339 attrib(pres,"isHomog",intvec(1,1,1,1,1,1,1,1,1,1));
1340 resolution fcokernel = mres(pres,0);
1341 print(betti(fcokernel),"betti");
1342 module dir = transpose(pres);
1343 attrib(dir,"isHomog",intvec(-1,-1,-1,-2,-2,-2,
1344                             -2,-2,-2,-2,-2,-2,-2));
1345 resolution fdir = mres(dir,2);
1346 print(betti(fdir),"betti");
1347 ideal I = groebner(flatten(fdir[2]));
1348 resolution FI = mres(I,0);
1349 print(betti(FI),"betti");
1350 module F=FI[2];
1351 int t=timer;
1352 def A1=sheafCoh(F,-8,8);
1353 timer-t;
1354 t=timer;
1355 def A2=sheafCohBGG(F,-8,8);
1356 timer-t;
1357
1358 LIB "sheafcoh.lib";
1359 LIB "random.lib";
1360 ring S = 32003, x(0..4), dp;
1361 resolution kos = nres(maxideal(1),0);
1362 betti(kos);
1363 matrix kos5 = kos[5];
1364 matrix tphi = transpose(dsum(kos5,kos5));
1365 matrix kos3 = kos[3];
1366 matrix psi = dsum(kos3,kos3);
1367 matrix beta1 = random(32002,20,2);
1368 matrix tbeta1tilde = transpose(psi*beta1);
1369 matrix tbeta0 = lift(tphi,tbeta1tilde);
1370 matrix kos4 = kos[4];
1371 matrix tkos4pluskos4 = transpose(dsum(kos4,kos4));
1372 matrix tgammamin1 = random(32002,20,1);
1373 matrix tgamma0 = tkos4pluskos4*tgammamin1;
1374 matrix talpha0 = concat(tbeta0,tgamma0);
1375 matrix zero[20][1];
1376 matrix tpsi = transpose(psi);
1377 matrix tpresg = concat(tpsi,zero);
1378 matrix pres = module(transpose(talpha0))
1379                    + module(transpose(tpresg));
1380 module dir = transpose(pres);
1381 dir = prune(dir);
1382 homog(dir);
1383 intvec deg_dir = attrib(dir,"isHomog");
1384 attrib(dir,"isHomog",deg_dir-2);        // set degrees
1385 resolution fdir = mres(prune(dir),2);
1386 print(betti(fdir),"betti");
1387 ideal I = groebner(flatten(fdir[2]));
1388 resolution FI = mres(I,0);
1389
1390 module F=FI[2];
1391 def A1=sheafCoh(F,-5,7);
1392 def A2=sheafCohBGG(F,-5,7);
1393
1394*/
Note: See TracBrowser for help on using the repository browser.