Skip to content

Commit

Permalink
Sophisticated show method for normal toric varieties
Browse files Browse the repository at this point in the history
  • Loading branch information
HereAround committed Dec 22, 2021
1 parent 3332052 commit b699ba8
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 39 deletions.
2 changes: 1 addition & 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 Down
2 changes: 1 addition & 1 deletion src/ToricVarieties/LineBundles/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,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 toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> l = ToricLineBundle( v, [ 2 ] )
A line bundle on a normal toric variety corresponding to a polyhedral fan in ambient dimension 2
Expand Down
16 changes: 8 additions & 8 deletions src/ToricVarieties/NormalToricVarieties/attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ julia> C = positive_hull([1 0 0; 1 1 0; 1 0 1; 1 1 1])
A polyhedral cone in ambient dimension 3
julia> antv = AffineNormalToricVariety(C)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 3
A normal affine, non-complete, toric variety corresponding to a polyhedral fan in ambient dimension 3
julia> toric_ideal(antv)
ideal(-x[1]*x[2] + x[3]*x[4])
Expand Down Expand Up @@ -542,7 +542,7 @@ Computes the nef cone of the normal toric variety `v`.
# Examples
```jldoctest
julia> pp = 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 toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> nef = nef_cone(pp)
A polyhedral cone in ambient dimension 1
Expand All @@ -568,7 +568,7 @@ Computes the mori cone of the normal toric variety `v`.
# Examples
```jldoctest
julia> pp = 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 toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> mori = mori_cone(pp)
A polyhedral cone in ambient dimension 1
Expand All @@ -594,7 +594,7 @@ Computes the fan of an abstract normal toric variety `v`.
# Examples
```jdoctest
julia> p2 = 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 toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> fan(p2)
A polyhedral fan in ambient dimension 2
Expand Down Expand Up @@ -642,13 +642,13 @@ Computes an affine open cover of the normal toric variety `v`, i.e. returns a li
# Examples
```jldoctest
julia> p2 = 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 toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> affine_open_covering(p2)
3-element Vector{AffineNormalToricVariety}:
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal affine, non-complete, toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal affine, non-complete, toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal affine, non-complete, toric variety corresponding to a polyhedral fan in ambient dimension 2
```
"""
function affine_open_covering(v::AbstractNormalToricVariety)
Expand Down
98 changes: 98 additions & 0 deletions src/ToricVarieties/NormalToricVarieties/auxilliary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,101 @@ function toric_ideal(pts::Union{AbstractMatrix, fmpz_mat})
end

toric_ideal(pts::SubObjectIterator) = toric_ideal(matrix_for_polymake(pts))


############################
# Output string for display method
############################

function output_string(v::AbstractNormalToricVariety)
# initiate the output string
out_string = "A normal "

# affine?
if has_attribute(v, :isaffine)
if get_attribute(v, :isaffine)
out_string = out_string * "affine, "
else
out_string = out_string * "non-affine, "
end
end

# smooth/simplicial?
if has_attribute(v, :issmooth)
if get_attribute(v, :issmooth)
out_string = out_string * "smooth, "
else
if has_attribute(v, :issimplicial)
if get_attribute(v, :issimplicial)
out_string = out_string * "simplicial, "
else
out_string = out_string * "non-smooth, "
end
end
end
end

# complete/projective?
if has_attribute(v, :iscomplete)
if get_attribute(v, :iscomplete)
if has_attribute(v, :isprojective)
if get_attribute(v, :isprojective)
out_string = out_string * "projective, "
end
else
out_string = out_string * "complete, "
end
else
out_string = out_string * "non-complete, "
end
end

# gorenstein?
if has_attribute(v, :isgorenstein)
if get_attribute(v, :isgorenstein)
out_string = out_string * "gorenstein, "
else
out_string = out_string * "non-gorenstein, "
end
end

# q-gorenstein?
if has_attribute(v, :isq_gorenstein)
if get_attribute(v, :isq_gorenstein)
out_string = out_string * "q-gorenstein, "
else
out_string = out_string * "non-q-gorenstein, "
end
end

# fano?
if has_attribute(v, :isfano)
if get_attribute(v, :isfano)
out_string = out_string * "fano "
else
out_string = out_string * "non-fano "
end
end

# torusfactor?
if last(out_string) == ','
out_string = chop(out_string)
end
if has_attribute(v, :hastorusfactor)
if get_attribute(v, :hastorusfactor)
out_string = out_string * "toric variety with torusfactor"
else
out_string = out_string * "toric variety without torusfactor"
end
else
out_string = out_string * "toric variety"
end

# ambient dimension of the fan
pmntv = pm_object(v)
ambdim = pmntv.FAN_AMBIENT_DIM
out_string = out_string * " corresponding to a polyhedral fan in ambient dimension $(ambdim)"

# return result
return out_string
end
31 changes: 13 additions & 18 deletions src/ToricVarieties/NormalToricVarieties/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ julia> C = positive_hull([1 0; 0 1])
A polyhedral cone in ambient dimension 2
julia> antv = AffineNormalToricVariety(C)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal affine, non-complete, toric variety corresponding to a polyhedral fan in ambient dimension 2
```
"""
function AffineNormalToricVariety(C::Cone)
Expand Down Expand Up @@ -69,7 +69,7 @@ Set `C` to be the positive orthant in two dimensions.
julia> C = positive_hull([1 0; 0 1])
A polyhedral cone in ambient dimension 2
julia> ntv = NormalToricVariety(C)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal affine, non-complete, toric variety corresponding to a polyhedral fan in ambient dimension 2
```
"""
function NormalToricVariety(C::Cone)
Expand Down Expand Up @@ -159,10 +159,10 @@ this method turns it into an affine toric variety.
# Examples
```jldoctest
julia> v = NormalToricVariety(positive_hull([1 0; 0 1]))
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal affine, non-complete, toric variety corresponding to a polyhedral fan in ambient dimension 2
julia> affineVariety = AffineNormalToricVariety(v)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal affine, non-complete, toric variety corresponding to a polyhedral fan in ambient dimension 2
```
"""
function AffineNormalToricVariety(v::NormalToricVariety)
Expand All @@ -186,7 +186,7 @@ Construct the projective space of dimension `d`.
# Examples
```jldoctest
julia> 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 toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
```
"""
function toric_projective_space(d::Int)
Expand Down Expand Up @@ -235,7 +235,7 @@ Constructs the r-th Hirzebruch surface.
# Examples
```jldoctest
julia> hirzebruch_surface(5)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal non-affine, smooth, projective, gorenstein, q-gorenstein, non-fano toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
```
"""
function hirzebruch_surface(r::Int)
Expand Down Expand Up @@ -288,7 +288,7 @@ Constructs the delPezzo surface with b blowups for b at most 3.
# Examples
```jldoctest
julia> del_pezzo(3)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal non-affine, smooth, projective, gorenstein, q-gorenstein, fano toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
```
"""
function del_pezzo(b::Int)
Expand Down Expand Up @@ -398,7 +398,7 @@ Computes the blowup of the normal toric variety `v` on its i-th minimal torus or
# Examples
```jldoctest
julia> P2 = 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 toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> blowup_on_ith_minimal_torus_orbit(P2,1)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
Expand All @@ -418,7 +418,7 @@ Computes the Cartesian/direct product of two normal toric varieties `v` and `w`.
# Examples
```jldoctest
julia> P2 = 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 toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> P2 * P2
A normal toric variety corresponding to a polyhedral fan in ambient dimension 4
Expand All @@ -429,14 +429,9 @@ function Base.:*(v::AbstractNormalToricVariety, w::AbstractNormalToricVariety)
end


###############################################################################
###############################################################################
############################
### 5: Display
###############################################################################
###############################################################################
function Base.show(io::IO, ntv::AbstractNormalToricVariety)
# fan = get_polyhedral_fan(ntv)
pmntv = pm_object(ntv)
ambdim = pmntv.FAN_AMBIENT_DIM
print(io, "A normal toric variety corresponding to a polyhedral fan in ambient dimension $(ambdim)")
############################
function Base.show(io::IO, v::AbstractNormalToricVariety)
print(io, output_string(v))
end
2 changes: 1 addition & 1 deletion src/ToricVarieties/NormalToricVarieties/properties.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Decides if the normal toric varieties `v` is a projective space.
# Examples
```jldoctest
julia> H5 = hirzebruch_surface(5)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal non-affine, smooth, projective, gorenstein, q-gorenstein, non-fano toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> isprojective_space(H5)
false
Expand Down
20 changes: 10 additions & 10 deletions src/ToricVarieties/ToricDivisors/properties.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Checks if the divisor `td` is Cartier.
# Examples
```jldoctest
julia> H = hirzebruch_surface(4)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal non-affine, smooth, projective, gorenstein, q-gorenstein, non-fano toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> td = ToricDivisor(H, [1,0,0,0])
A torus invariant divisor on a normal toric variety
Expand All @@ -31,7 +31,7 @@ Determine whether the toric divisor `td` is principal.
# Examples
```jldoctest
julia> H = hirzebruch_surface(4)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal non-affine, smooth, projective, gorenstein, q-gorenstein, non-fano toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> td = ToricDivisor(H, [1,0,0,0])
A torus invariant divisor on a normal toric variety
Expand All @@ -56,7 +56,7 @@ Determine whether the toric divisor `td` is basepoint free.
# Examples
```jldoctest
julia> H = hirzebruch_surface(4)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal non-affine, smooth, projective, gorenstein, q-gorenstein, non-fano toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> td = ToricDivisor(H, [1,0,0,0])
A torus invariant divisor on a normal toric variety
Expand All @@ -81,7 +81,7 @@ Determine whether the toric divisor `td` is effective.
# Examples
```jldoctest
julia> H = hirzebruch_surface(4)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal non-affine, smooth, projective, gorenstein, q-gorenstein, non-fano toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> td = ToricDivisor(H, [1,0,0,0])
A torus invariant divisor on a normal toric variety
Expand All @@ -106,7 +106,7 @@ Determine whether the toric divisor `td` is integral.
# Examples
```jldoctest
julia> H = hirzebruch_surface(4)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal non-affine, smooth, projective, gorenstein, q-gorenstein, non-fano toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> td = ToricDivisor(H, [1,0,0,0])
A torus invariant divisor on a normal toric variety
Expand All @@ -131,7 +131,7 @@ Determine whether the toric divisor `td` is ample.
# Examples
```jldoctest
julia> H = hirzebruch_surface(4)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal non-affine, smooth, projective, gorenstein, q-gorenstein, non-fano toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> td = ToricDivisor(H, [1,0,0,0])
A torus invariant divisor on a normal toric variety
Expand All @@ -156,7 +156,7 @@ Determine whether the toric divisor `td` is very ample.
# Examples
```jldoctest
julia> H = hirzebruch_surface(4)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal non-affine, smooth, projective, gorenstein, q-gorenstein, non-fano toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> td = ToricDivisor(H, [1,0,0,0])
A torus invariant divisor on a normal toric variety
Expand All @@ -181,7 +181,7 @@ Determine whether the toric divisor `td` is nef.
# Examples
```jldoctest
julia> H = hirzebruch_surface(4)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal non-affine, smooth, projective, gorenstein, q-gorenstein, non-fano toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> td = ToricDivisor(H, [1,0,0,0])
A torus invariant divisor on a normal toric variety
Expand All @@ -206,7 +206,7 @@ Determine whether the toric divisor `td` is Q-Cartier.
# Examples
```jldoctest
julia> H = hirzebruch_surface(4)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal non-affine, smooth, projective, gorenstein, q-gorenstein, non-fano toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> td = ToricDivisor(H, [1,0,0,0])
A torus invariant divisor on a normal toric variety
Expand All @@ -232,7 +232,7 @@ Determine whether the toric divisor `td` is a prime divisor.
# Examples
```jldoctest
julia> H = hirzebruch_surface(4)
A normal toric variety corresponding to a polyhedral fan in ambient dimension 2
A normal non-affine, smooth, projective, gorenstein, q-gorenstein, non-fano toric variety without torusfactor corresponding to a polyhedral fan in ambient dimension 2
julia> td = ToricDivisor(H, [1,0,0,0])
A torus invariant divisor on a normal toric variety
Expand Down

0 comments on commit b699ba8

Please sign in to comment.