diff --git a/src/AlgebraicGeometry/ToricVarieties/Proj/constructors.jl b/src/AlgebraicGeometry/ToricVarieties/Proj/constructors.jl index b0343662ac2f..d64664e8178c 100644 --- a/src/AlgebraicGeometry/ToricVarieties/Proj/constructors.jl +++ b/src/AlgebraicGeometry/ToricVarieties/Proj/constructors.jl @@ -44,8 +44,12 @@ function _proj_and_total_space(is_proj::Bool, E::Vector{T}) where T <: Union{Tor @req all(i -> toric_variety(E[i]) == v, eachindex(E)) "The divisors are defined on different toric varieties." - PF_Pr = normal_fan(simplex(length(E) - 1)) - l = rays(PF_Pr) + if is_proj + PF_fiber = normal_fan(simplex(length(E) - 1)) + else + PF_fiber = polyhedral_fan(positive_hull(identity_matrix(ZZ, length(E)))) + end + l = rays(PF_fiber) modified_ray_gens = Dict{RayVector{QQFieldElem}, RayVector{QQFieldElem}}() @@ -63,8 +67,8 @@ function _proj_and_total_space(is_proj::Bool, E::Vector{T}) where T <: Union{Tor for a in 1:n_maximal_cones(v) first = [row(ray_indices(maximal_cones(v)), a)...] - for b in eachindex(E) - second = [row(ray_indices(maximal_cones(PF_Pr)), b)...] .+ nrays(v) + for b in 1:n_maximal_cones(PF_fiber) + second = [row(ray_indices(maximal_cones(PF_fiber)), b)...] .+ nrays(v) new_maximal_cones[index] = vcat(first, second) index += 1 end @@ -128,13 +132,13 @@ julia> degree(canonical_bundle(Y)) ``` """ function total_space(E::ToricLineBundle...) - return _proj_and_total_space(false, [E...]) + return _proj_and_total_space(false, [E...]) end function total_space(E::ToricDivisor...) - return _proj_and_total_space(false, [E...]) + return _proj_and_total_space(false, [E...]) end function total_space() - @req false "The direct sum is empty." + @req false "The direct sum is empty." end diff --git a/test/AlgebraicGeometry/ToricVarieties/proj.jl b/test/AlgebraicGeometry/ToricVarieties/proj.jl index 0f62ff137ef4..ea435f825f86 100644 --- a/test/AlgebraicGeometry/ToricVarieties/proj.jl +++ b/test/AlgebraicGeometry/ToricVarieties/proj.jl @@ -76,48 +76,46 @@ end @testset "Total space of direct sum of line bundles on toric space (set_attributes = $set_attributes)" for set_attributes in [true, false] - @testset "Test that some vb on P1 are Calabi-Yau" begin - P1 = projective_space(NormalToricVariety, 1; set_attributes) - for a in 0:5 - for b in 0:5 - la = toric_line_bundle(P1, [a]) - lb = toric_line_bundle(P1, [-b]) - X = total_space(la, lb) - @test is_smooth(X) == true - @test !is_fano(X) - @test !is_complete(X) - @test rank(picard_group(X)) == 1 - @test dim(X) == 3 - @test (degree(canonical_bundle(X)) == 0) == (a - b == -2) - end - end - end + @testset "Test that some vb on P1 are Calabi-Yau" begin + P1 = projective_space(NormalToricVariety, 1; set_attributes) + for a in 0:5, b in 0:5 + la = toric_line_bundle(P1, [a]) + lb = toric_line_bundle(P1, [-b]) + X = total_space(la, lb) + @test is_smooth(X) == true + @test !is_fano(X) + @test !is_complete(X) + @test rank(picard_group(X)) == 1 + @test dim(X) == 3 + @test (degree(canonical_bundle(X)) == 0) == (a - b == -2) + end + end - @testset "Test that omega_S is Calabi-Yau for any S smooth surface" begin - @testset "S is Hirzebruch" begin - for a in 0:10 - S = hirzebruch_surface(NormalToricVariety, a; set_attributes) - X = total_space(canonical_bundle(S)) - @test is_smooth(X) == true - @test !is_fano(X) + @testset "Test that omega_S is Calabi-Yau for any S smooth surface" begin + @testset "S is Hirzebruch" begin + for a in 0:10 + S = hirzebruch_surface(NormalToricVariety, a; set_attributes) + X = total_space(canonical_bundle(S)) + @test is_smooth(X) == true + @test !is_fano(X) @test !is_complete(X) - @test rank(picard_group(X)) == rank(picard_group(S)) - @test dim(X) == 3 - @test degree(canonical_bundle(X)) == 0 - end - end + @test rank(picard_group(X)) == rank(picard_group(S)) + @test dim(X) == 3 + @test degree(canonical_bundle(X)) == 0 + end + end - @testset "S is del Pezzo" begin - for a in 0:3 - S = del_pezzo_surface(NormalToricVariety, a; set_attributes) - X = total_space(canonical_divisor(S)) - @test is_smooth(X) == true - @test !is_fano(X) - @test rank(picard_group(X)) == rank(picard_group(S)) - @test dim(X) == 3 - @test degree(canonical_bundle(X)) == 0 - end - end - end + @testset "S is del Pezzo" begin + for a in 0:3 + S = del_pezzo_surface(NormalToricVariety, a; set_attributes) + X = total_space(canonical_divisor(S)) + @test is_smooth(X) == true + @test !is_fano(X) + @test rank(picard_group(X)) == rank(picard_group(S)) + @test dim(X) == 3 + @test degree(canonical_bundle(X)) == 0 + end + end + end end