Skip to content

Commit

Permalink
[ToricVarieties] Introduce flags to switch off time consuming checks
Browse files Browse the repository at this point in the history
  • Loading branch information
HereAround committed Jul 24, 2024
1 parent 6724004 commit 718df0d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ polynomial(ring::MPolyQuoRing, c::CohomologyClass)
## Methods

```@docs
integrate(c::CohomologyClass)
integrate(c::CohomologyClass; check::Bool = true)
```


## Special attributes of toric varieties

```@docs
cohomology_ring(v::NormalToricVarietyType)
cohomology_ring(v::NormalToricVarietyType; check::Bool = true)
volume_form(v::NormalToricVariety)
intersection_form(v::NormalToricVariety)
```
15 changes: 11 additions & 4 deletions src/AlgebraicGeometry/ToricVarieties/CohomologyClasses/methods.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
@doc raw"""
integrate(c::CohomologyClass)
integrate(c::CohomologyClass; check::Bool = true)
Integrate the cohomolgy class `c` over the normal
toric variety `toric_variety(c)`.
The theory underlying this method requires that the toric variety
in question is simplicial and complete. The check of completeness
may take a long time to complete. If desired, this can be switched
off by setting the optional argument `check` to the value `false`.
# Examples
```jldoctest
julia> dP3 = del_pezzo_surface(NormalToricVariety, 3)
Expand Down Expand Up @@ -88,10 +93,12 @@ julia> integrate(cohomology_class(anticanonical_divisor_class(X))^3)
62
```
"""
function integrate(c::CohomologyClass)
function integrate(c::CohomologyClass; check::Bool = true)
# can only integrate if the variety is simplicial, complete
@req is_simplicial(toric_variety(c)) && is_complete(toric_variety(c)) "Integration only supported over complete and simplicial toric varieties"

if check
@req is_simplicial(toric_variety(c)) && is_complete(toric_variety(c)) "Integration only supported over complete and simplicial toric varieties"
end

# if the intersection form is known, we can use it
if has_attribute(toric_variety(c), :_intersection_form_via_exponents)
intersection_dict = _intersection_form_via_exponents(toric_variety(c))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
########################

@doc raw"""
cohomology_ring(v::NormalToricVarietyType)
cohomology_ring(v::NormalToricVarietyType; check::Bool = true)
Return the cohomology ring of the simplicial and complete toric variety `v`.
Expand All @@ -15,12 +15,18 @@ julia> ngens(cohomology_ring(p2))
3
```
"""
@attr MPolyQuoRing function cohomology_ring(v::NormalToricVarietyType)
function cohomology_ring(v::NormalToricVarietyType; check::Bool = false)
if has_attribute(v, :cohomology_ring)
return get_attribute(v, :cohomology_ring)
end
if check
@req is_simplicial(v) && is_complete(v) "The cohomology ring is only supported for simplicial and complete toric varieties"
R, _ = graded_polynomial_ring(coefficient_ring(v), coordinate_names(v), cached = false)
linear_relations = ideal_of_linear_relations(R, v)
stanley_reisner = stanley_reisner_ideal(R, v)
return quo(R, linear_relations + stanley_reisner)[1]
end
R, _ = graded_polynomial_ring(coefficient_ring(v), coordinate_names(v), cached = false)
linear_relations = ideal_of_linear_relations(R, v)
stanley_reisner = stanley_reisner_ideal(R, v)
set_attribute!(v, :cohomology_ring, quo(R, linear_relations + stanley_reisner)[1])
return get_attribute(v, :cohomology_ring)
end


Expand Down

0 comments on commit 718df0d

Please sign in to comment.