CohomCalg is software written by Benjamin Jurke and Thorsten Rahn (in collaboration with Ralph Blumenhagen and Helmut Roschy) for computing the cohomology vectors of torus invariant divisors on a (normal) toric variety (see https://github.com/BenjaminJurke/cohomCalg for more information).
CohomCalg is an efficient and careful implementation. One limitation is that the number of rays in the fan and the number of generators of the Stanley-Reisner ideal of the fan must both be no larger than 64.
Here is a sample usage of this package in Macaulay2. Let's compute the cohomology of some divisors on a smooth Fano toric variety.
i1 : needsPackage "NormalToricVarieties" o1 = NormalToricVarieties o1 : Package |
i2 : X = smoothFanoToricVariety(3,15) o2 = X o2 : NormalToricVariety |
i3 : rays X o3 = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}, {0, -1, -1}, {0, -1, 0}, {-1, 0, 0}, ------------------------------------------------------------------------ {-1, 1, 0}} o3 : List |
i4 : max X o4 = {{0, 1, 2}, {0, 1, 3}, {0, 2, 4}, {0, 3, 4}, {1, 2, 6}, {1, 3, 6}, {2, ------------------------------------------------------------------------ 4, 5}, {2, 5, 6}, {3, 4, 5}, {3, 5, 6}} o4 : List |
i5 : S = ring X o5 = S o5 : PolynomialRing |
i6 : SR = dual monomialIdeal X o6 = monomialIdeal (x x , x x , x x , x x , x x , x x ) 2 3 1 4 0 5 1 5 0 6 4 6 o6 : MonomialIdeal of S |
i7 : KX = toricDivisor X o7 = - X - X - X - X - X - X - X 0 1 2 3 4 5 6 o7 : ToricDivisor on X |
i8 : assert isVeryAmple (-KX) |
i9 : cohoms1 = for i from 0 to 6 list X_i => cohomCalg X_i o9 = {X => {2, 0, 0, 0}, X => {1, 0, 0, 0}, X => {2, 0, 0, 0}, X => {2, 0 1 2 3 ------------------------------------------------------------------------ 0, 0, 0}, X => {1, 0, 0, 0}, X => {1, 0, 0, 0}, X => {1, 0, 0, 0}} 4 5 6 o9 : List |
i10 : cohoms2 = for i from 0 to 6 list X_i => ( for j from 0 to dim X list rank HH^j(X, OO_X(toSequence degree X_i)) ) o10 = {X => {2, 0, 0, 0}, X => {1, 0, 0, 0}, X => {2, 0, 0, 0}, X => {2, 0 1 2 3 ----------------------------------------------------------------------- 0, 0, 0}, X => {1, 0, 0, 0}, X => {1, 0, 0, 0}, X => {1, 0, 0, 0}} 4 5 6 o10 : List |
i11 : assert(cohoms1 === cohoms2) |
For efficiency reasons, it is better, if this works for your use, to call CohomCalg by batching together several cohomology requests.
i12 : needsPackage "ReflexivePolytopesDB" o12 = ReflexivePolytopesDB o12 : Package |
i13 : topes = kreuzerSkarke(21, Limit => 20); using offline data file: ks21-n100.txt |
i14 : A = matrix topes_10 o14 = | 1 0 0 -1 2 0 0 -3 -2 1 | | 0 1 0 1 -1 1 0 1 0 -1 | | 0 0 1 1 -1 -1 0 4 2 -2 | | 0 0 0 0 0 0 1 -1 -1 1 | 4 10 o14 : Matrix ZZ <--- ZZ |
i15 : P = convexHull A o15 = P o15 : Polyhedron |
i16 : X = normalToricVariety P o16 = X o16 : NormalToricVariety |
i17 : SR = dual monomialIdeal X o17 = monomialIdeal (x x , x x x , x x , x x x , x x x , x x x x , x x x , 1 2 0 1 3 0 4 0 2 6 0 3 6 1 3 5 6 1 3 7 ----------------------------------------------------------------------- x x x , x x x x , x x x , x x x , x x x x , x x x x , x x x , x x x x , 1 4 7 0 3 5 7 2 4 8 2 6 8 3 5 6 8 4 5 6 8 4 7 8 2 5 7 8 ----------------------------------------------------------------------- x x x x , x x x x , x x x , x x x , x x , x x x , x x x , x x x , 3 5 7 8 3 6 7 8 0 1 9 2 4 9 5 9 0 6 9 2 6 9 1 7 9 ----------------------------------------------------------------------- x x x ) 4 7 9 o17 : MonomialIdeal of QQ[x ..x ] 0 9 |
i18 : D2 = subsets(for i from 0 to #rays X - 1 list (-X_i), 2) o18 = {{- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, 0 1 0 2 1 2 0 3 1 3 ----------------------------------------------------------------------- {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, 2 3 0 4 1 4 2 4 3 4 ----------------------------------------------------------------------- {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, 0 5 1 5 2 5 3 5 4 5 ----------------------------------------------------------------------- {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, 0 6 1 6 2 6 3 6 4 6 ----------------------------------------------------------------------- {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, 5 6 0 7 1 7 2 7 3 7 ----------------------------------------------------------------------- {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, 4 7 5 7 6 7 0 8 1 8 ----------------------------------------------------------------------- {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, 2 8 3 8 4 8 5 8 6 8 ----------------------------------------------------------------------- {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, 7 8 0 9 1 9 2 9 3 9 ----------------------------------------------------------------------- {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }, {- X , - X }} 4 9 5 9 6 9 7 9 8 9 o18 : List |
i19 : D2 = D2/sum/degree o19 = {{0, 1, -2, -2, 4, 0}, {0, 1, -1, 1, 0, -2}, {2, 2, 3, 1, -4, -6}, {-1, ----------------------------------------------------------------------- 0, -4, -2, 5, 3}, {1, 1, 0, -2, 1, -1}, {1, 1, 1, 1, -3, -3}, {-2, 0, ----------------------------------------------------------------------- -3, -1, 4, 2}, {0, 1, 1, -1, 0, -2}, {0, 1, 2, 2, -4, -4}, {-1, 0, -1, ----------------------------------------------------------------------- -1, 1, 1}, {-1, -1, -3, -1, 4, 2}, {1, 0, 1, -1, 0, -2}, {1, 0, 2, 2, ----------------------------------------------------------------------- -4, -4}, {0, -1, -1, -1, 1, 1}, {-1, -1, 0, 0, 0, 0}, {-1, 0, -4, -1, ----------------------------------------------------------------------- 4, 2}, {1, 1, 0, -1, 0, -2}, {1, 1, 1, 2, -4, -4}, {0, 0, -2, -1, 1, ----------------------------------------------------------------------- 1}, {-1, 0, -1, 0, 0, 0}, {0, -1, -1, 0, 0, 0}, {-1, 0, -3, -2, 4, 2}, ----------------------------------------------------------------------- {1, 1, 1, -2, 0, -2}, {1, 1, 2, 1, -4, -4}, {0, 0, -1, -2, 1, 1}, {-1, ----------------------------------------------------------------------- 0, 0, -1, 0, 0}, {0, -1, 0, -1, 0, 0}, {0, 0, -1, -1, 0, 0}, {-1, 0, ----------------------------------------------------------------------- -3, -1, 3, 2}, {1, 1, 1, -1, -1, -2}, {1, 1, 2, 2, -5, -4}, {0, 0, -1, ----------------------------------------------------------------------- -1, 0, 1}, {-1, 0, 0, 0, -1, 0}, {0, -1, 0, 0, -1, 0}, {0, 0, -1, 0, ----------------------------------------------------------------------- -1, 0}, {0, 0, 0, -1, -1, 0}, {-1, 0, -3, -1, 4, 1}, {1, 1, 1, -1, 0, ----------------------------------------------------------------------- -3}, {1, 1, 2, 2, -4, -5}, {0, 0, -1, -1, 1, 0}, {-1, 0, 0, 0, 0, -1}, ----------------------------------------------------------------------- {0, -1, 0, 0, 0, -1}, {0, 0, -1, 0, 0, -1}, {0, 0, 0, -1, 0, -1}, {0, ----------------------------------------------------------------------- 0, 0, 0, -1, -1}} o19 : List |
i20 : elapsedTime hvecs = cohomCalg(X, D2) -- 3.84058 seconds elapsed o20 = {{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 0, 0, 0}, ----------------------------------------------------------------------- {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, ----------------------------------------------------------------------- 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, ----------------------------------------------------------------------- 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, ----------------------------------------------------------------------- 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, ----------------------------------------------------------------------- 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, ----------------------------------------------------------------------- {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, ----------------------------------------------------------------------- 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, ----------------------------------------------------------------------- 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, ----------------------------------------------------------------------- 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 1, 0, 0, ----------------------------------------------------------------------- 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}} o20 : List |
i21 : peek cohomCalg X o21 = MutableHashTable{{-1, -1, -3, -1, 4, 2} => {{0, 0, 0, 0, 0}, {}} } {-1, -1, 0, 0, 0, 0} => {{0, 0, 0, 0, 0}, {}} {-1, 0, -1, -1, 1, 1} => {{0, 0, 0, 0, 0}, {}} {-1, 0, -1, 0, 0, 0} => {{0, 0, 0, 0, 0}, {}} {-1, 0, -3, -1, 3, 2} => {{0, 0, 0, 0, 0}, {}} {-1, 0, -3, -1, 4, 1} => {{0, 0, 0, 0, 0}, {}} {-1, 0, -3, -2, 4, 2} => {{0, 0, 0, 0, 0}, {}} {-1, 0, -4, -1, 4, 2} => {{0, 0, 0, 0, 0}, {}} {-1, 0, -4, -2, 5, 3} => {{0, 0, 0, 0, 0}, {}} {-1, 0, 0, -1, 0, 0} => {{0, 0, 0, 0, 0}, {}} {-1, 0, 0, 0, -1, 0} => {{0, 0, 0, 0, 0}, {}} {-1, 0, 0, 0, 0, -1} => {{0, 0, 0, 0, 0}, {}} {-2, 0, -3, -1, 4, 2} => {{0, 1, 0, 0, 0}, {{1, 1x0*x4}}} {0, -1, -1, -1, 1, 1} => {{0, 0, 0, 0, 0}, {}} {0, -1, -1, 0, 0, 0} => {{0, 0, 0, 0, 0}, {}} {0, -1, 0, -1, 0, 0} => {{0, 0, 0, 0, 0}, {}} {0, -1, 0, 0, -1, 0} => {{0, 0, 0, 0, 0}, {}} {0, -1, 0, 0, 0, -1} => {{0, 1, 0, 0, 0}, {{1, 1x5*x9}}} {0, 0, -1, -1, 0, 0} => {{0, 0, 0, 0, 0}, {}} {0, 0, -1, -1, 0, 1} => {{0, 0, 0, 0, 0}, {}} {0, 0, -1, -1, 1, 0} => {{0, 0, 0, 0, 0}, {}} {0, 0, -1, -2, 1, 1} => {{0, 0, 0, 0, 0}, {}} {0, 0, -1, 0, -1, 0} => {{0, 0, 0, 0, 0}, {}} {0, 0, -1, 0, 0, -1} => {{0, 0, 0, 0, 0}, {}} {0, 0, -2, -1, 1, 1} => {{0, 0, 0, 0, 0}, {}} {0, 0, 0, -1, -1, 0} => {{0, 0, 0, 0, 0}, {}} {0, 0, 0, -1, 0, -1} => {{0, 0, 0, 0, 0}, {}} {0, 0, 0, 0, -1, -1} => {{0, 0, 0, 0, 0}, {}} {0, 1, -1, 1, 0, -2} => {{0, 0, 0, 0, 0}, {}} {0, 1, -2, -2, 4, 0} => {{0, 0, 0, 0, 0}, {}} {0, 1, 1, -1, 0, -2} => {{0, 0, 0, 0, 0}, {}} {0, 1, 2, 2, -4, -4} => {{0, 0, 0, 0, 0}, {}} {1, 0, 1, -1, 0, -2} => {{0, 0, 0, 0, 0}, {}} {1, 0, 2, 2, -4, -4} => {{0, 0, 0, 0, 0}, {}} {1, 1, 0, -1, 0, -2} => {{0, 0, 0, 0, 0}, {}} {1, 1, 0, -2, 1, -1} => {{0, 0, 0, 0, 0}, {}} {1, 1, 1, -1, -1, -2} => {{0, 0, 0, 0, 0}, {}} {1, 1, 1, -1, 0, -3} => {{0, 0, 0, 0, 0}, {}} {1, 1, 1, -2, 0, -2} => {{0, 0, 0, 0, 0}, {}} {1, 1, 1, 1, -3, -3} => {{0, 0, 0, 0, 0}, {}} {1, 1, 1, 2, -4, -4} => {{0, 0, 0, 0, 0}, {}} {1, 1, 2, 1, -4, -4} => {{0, 0, 0, 0, 0}, {}} {1, 1, 2, 2, -4, -5} => {{0, 0, 0, 0, 0}, {}} {1, 1, 2, 2, -5, -4} => {{0, 0, 0, 0, 0}, {}} {2, 2, 3, 1, -4, -6} => {{0, 1, 0, 0, 0}, {{1, 1x1*x2}}} |
i22 : degree(X_3 + X_7 + X_8) o22 = {0, 0, 1, 2, 0, -1} o22 : List |
i23 : elapsedTime cohomvec1 = cohomCalg(X_3 + X_7 + X_8) -- 1.14544 seconds elapsed o23 = {1, 0, 0, 0, 0} o23 : List |
i24 : elapsedTime cohomvec2 = for j from 0 to dim X list rank HH^j(X, OO_X(0,0,1,2,0,-1)) -- 30.9008 seconds elapsed o24 = {1, 0, 0, 0, 0} o24 : List |
i25 : assert(cohomvec1 == cohomvec2) |
i26 : degree(X_3 + X_7 - X_8) o26 = {0, 0, 1, 2, -2, -1} o26 : List |
i27 : elapsedTime cohomvec1 = cohomCalg(X_3 + X_7 - X_8) -- 1.14852 seconds elapsed o27 = {0, 0, 0, 0, 0} o27 : List |
i28 : elapsedTime cohomvec2 = elapsedTime for j from 0 to dim X list rank HH^j(X, OO_X(0,0,1,2,-2,-1)) -- 1.54107 seconds elapsed -- 1.54111 seconds elapsed o28 = {0, 0, 0, 0, 0} o28 : List |
i29 : assert(cohomvec1 == cohomvec2) |
cohomCalg computes cohomology vectors by calling CohomCalg. It also stashes it's results in the toric variety's cache table, so computations need not be performed twice.
This documentation describes version 0.8 of CohomCalg.
The source code from which this documentation is derived is in the file CohomCalg.m2. The auxiliary files accompanying it are in the directory CohomCalg/.