Skip to content

Commit

Permalink
Merge pull request #839 from HereAround/Cache
Browse files Browse the repository at this point in the history
Cache computed properties for toric varieties
  • Loading branch information
fingolfin authored Dec 29, 2021
2 parents a30bdc1 + aaee3c9 commit 5fa3a5c
Show file tree
Hide file tree
Showing 13 changed files with 874 additions and 397 deletions.
3 changes: 2 additions & 1 deletion docs/src/ToricVarieties/NormalToricVarieties.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ cartier_divisor_group(v::AbstractNormalToricVariety)
character_lattice(v::AbstractNormalToricVariety)
class_group(v::AbstractNormalToricVariety)
map_from_cartier_divisor_group_to_torus_invariant_divisor_group(v::AbstractNormalToricVariety)
map_from_cartier_divisor_group_to_picard_group(v::AbstractNormalToricVariety)
map_from_character_to_principal_divisors(v::AbstractNormalToricVariety)
map_from_weil_divisors_to_class_group(v::AbstractNormalToricVariety)
picard_group(v::AbstractNormalToricVariety)
Expand All @@ -108,7 +109,7 @@ nef_cone(v::NormalToricVariety)
dim(v::AbstractNormalToricVariety)
dim_of_torusfactor(v::AbstractNormalToricVariety)
euler_characteristic(v::AbstractNormalToricVariety)
ith_betti_number(v::AbstractNormalToricVariety, i::Int)
betti_number(v::AbstractNormalToricVariety, i::Int)
```

### Rings and ideals
Expand Down
1 change: 1 addition & 0 deletions docs/src/ToricVarieties/ToricDivisors.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ isvery_ample(td::ToricDivisor)
```@docs
coefficients(td::ToricDivisor)
polyhedron(td::ToricDivisor)
toricvariety(td::ToricDivisor)
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
################################################################################
################################################################################

struct CyclicQuotientSingularity <: AbstractNormalToricVariety
@attributes mutable struct CyclicQuotientSingularity <: AbstractNormalToricVariety
polymakeNTV::Polymake.BigObject
end
export CyclicQuotientSingularity
Expand All @@ -25,7 +25,7 @@ $0<q<n$ and $q,n$ coprime.
# Examples
```jldoctest
julia> cqs = CyclicQuotientSingularity(7,5)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal toric variety
julia> isaffine(cqs)
true
Expand All @@ -40,7 +40,7 @@ function CyclicQuotientSingularity(n::fmpz, q::fmpz)
q < n || error("q must be smaller than n (q=$(q) >= n=$(n))")
gcd(n,q)==1 || error("n and q must be coprime (gcd=$(gcd(n,q)))")
pmntv = Polymake.fulton.CyclicQuotient(N=convert(Polymake.Integer, n), Q=convert(Polymake.Integer, q))
return CyclicQuotientSingularity(pmntv)
return CyclicQuotientSingularity(pmntv, Dict())
end
CyclicQuotientSingularity(n::Int64, q::Int64) = CyclicQuotientSingularity(fmpz(n), fmpz(q))

Expand All @@ -60,7 +60,7 @@ differs in sign from what is commonly known as continued fraction.
# Examples
```jldoctest
julia> cqs = CyclicQuotientSingularity(7,5)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal toric variety
julia> cf = continued_fraction_hirzebruch_jung(cqs)
3-element Vector{fmpz}:
Expand All @@ -72,7 +72,11 @@ julia> ecf = cf[1]-1//(cf[2]-fmpq(1,cf[3]))
7//5
```
"""
continued_fraction_hirzebruch_jung(cqs::CyclicQuotientSingularity) = Vector{fmpz}(pm_object(cqs).CONTINUED_FRACTION)
function continued_fraction_hirzebruch_jung(cqs::CyclicQuotientSingularity)
return get_attribute!(cqs, :continued_fraction_hirzebruch_jung) do
return Vector{fmpz}(pm_object(cqs).CONTINUED_FRACTION)
end
end
export continued_fraction_hirzebruch_jung


Expand All @@ -91,7 +95,7 @@ differs in sign from what is commonly known as continued fraction.
# Examples
```jldoctest
julia> cqs = CyclicQuotientSingularity(7,5)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal toric variety
julia> dcf = dual_continued_fraction_hirzebruch_jung(cqs)
2-element Vector{fmpz}:
Expand All @@ -102,7 +106,11 @@ julia> edcf = dcf[1] - fmpq(1,dcf[2])
7//2
```
"""
dual_continued_fraction_hirzebruch_jung(cqs::CyclicQuotientSingularity) = Vector{fmpz}(pm_object(cqs).DUAL_CONTINUED_FRACTION)
function dual_continued_fraction_hirzebruch_jung(cqs::CyclicQuotientSingularity)
return get_attribute!(cqs, :dual_continued_fraction_hirzebruch_jung) do
return Vector{fmpz}(pm_object(cqs).DUAL_CONTINUED_FRACTION)
end
end
export dual_continued_fraction_hirzebruch_jung


Expand All @@ -120,7 +128,7 @@ differs in sign from what is commonly known as continued fraction.
# Examples
```jldoctest
julia> cqs = CyclicQuotientSingularity(7,5)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal toric variety
julia> v = continued_fraction_hirzebruch_jung(cqs)
3-element Vector{fmpz}:
Expand Down
3 changes: 2 additions & 1 deletion src/ToricVarieties/JToric.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include("NormalToricVarieties/auxilliary.jl")
include("NormalToricVarieties/constructors.jl")
include("NormalToricVarieties/auxilliary.jl")
include("NormalToricVarieties/properties.jl")
include("NormalToricVarieties/attributes.jl")
include("NormalToricVarieties/methods.jl")
Expand All @@ -8,6 +8,7 @@ include("CyclicQuotientSingularities/CyclicQuotientSingularities.jl")

include("ToricDivisors/constructors.jl")
include("ToricDivisors/properties.jl")
include("ToricDivisors/attributes.jl")

include("LineBundles/constructors.jl")
include("LineBundles/attributes.jl")
3 changes: 1 addition & 2 deletions src/ToricVarieties/LineBundles/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export ToricLineBundle
ToricLineBundle(v::AbstractNormalToricVariety, c::Vector{fmpz})
Construct the line bundle on the abstract normal toric variety `v` with class `c`.
```
"""
function ToricLineBundle(v::AbstractNormalToricVariety, input_class::Vector{fmpz})
class = picard_group(v)(input_class)
Expand All @@ -35,7 +34,7 @@ Convenience method for ToricLineBundle(v::AbstractNormalToricVariety, c::Vector{
# Examples
```jldoctest
julia> v = toric_projective_space(2)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal, non-affine, smooth, projective, gorenstein, q-gorenstein, fano, 2-dimensional toric variety without torusfactor
julia> l = ToricLineBundle( v, [ 2 ] )
A line bundle on a normal toric variety corresponding to a polyhedral fan in ambient dimension 2
Expand Down
Loading

0 comments on commit 5fa3a5c

Please sign in to comment.