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.
needsPackage "NormalToricVarieties" |
X = smoothFanoToricVariety(3,15) |
rays X |
max X |
S = ring X |
SR = dual monomialIdeal X |
KX = toricDivisor X |
assert isVeryAmple (-KX) |
cohoms1 = for i from 0 to 6 list X_i => cohomCalg X_i |
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))
) |
assert(cohoms1 === cohoms2) |
For efficiency reasons, it is better, if this works for your use, to call CohomCalg by batching together several cohomology requests.
needsPackage "ReflexivePolytopesDB" |
topes = kreuzerSkarke(21, Limit => 20); |
A = matrix topes_10 |
P = convexHull A |
X = normalToricVariety P |
SR = dual monomialIdeal X |
D2 = subsets(for i from 0 to #rays X - 1 list (-X_i), 2) |
D2 = D2/sum/degree |
elapsedTime hvecs = cohomCalg(X, D2) |
peek cohomCalg X |
degree(X_3 + X_7 + X_8) |
elapsedTime cohomvec1 = cohomCalg(X_3 + X_7 + X_8) |
elapsedTime cohomvec2 = for j from 0 to dim X list rank HH^j(X, OO_X(0,0,1,2,0,-1)) |
assert(cohomvec1 == cohomvec2) |
degree(X_3 + X_7 - X_8) |
elapsedTime cohomvec1 = cohomCalg(X_3 + X_7 - X_8) |
elapsedTime cohomvec2 = elapsedTime for j from 0 to dim X list rank HH^j(X, OO_X(0,0,1,2,-2,-1)) |
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.