Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion experimental/GITFans/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
@test n_rays(fanobj) == 20
@test dim(fanobj) == 5
@test n_maximal_cones(fanobj) == 76
@test n_cones(fanobj) == 671
@test n_cones(fanobj) == 672
@test !is_complete(fanobj)
@test is_pointed(fanobj)
@test !is_regular(fanobj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Rational equivalence class on a normal toric variety represented by 15V(x1,x3)+6
"""
function rational_equivalence_class(v::NormalToricVarietyType, coefficients::Vector{T}) where {T <: IntegerUnion}
@req (is_simplicial(v) && is_complete(v)) "Currently, algebraic cycles are only supported for toric varieties that are simplicial and complete"
@req length(coefficients) == n_cones(v) "The number of coefficients must match the number of all cones (but the trivial one) in the fan of the toric variety"
@req length(coefficients) == n_cones(v; trivial=false) "The number of coefficients must match the number of all cones (but the trivial one) in the fan of the toric variety"
mons = gens_of_rational_equivalence_classes(v)
return RationalEquivalenceClass(v, sum(coefficients[i]*mons[i] for i in 1:length(coefficients)))
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ julia> gens_of_rational_equivalence_classes(p2)
@attr Vector{MPolyQuoRingElem{QQMPolyRingElem}} function gens_of_rational_equivalence_classes(v::NormalToricVarietyType)
cr = chow_ring(v)
R = base_ring(cr)
cs = cones(v)
return [simplify(cr(R([1], [Vector{Int}(cs[k,:])]))) for k in 1:n_cones(v)]
cs = cones(v; trivial=false)
return [simplify(cr(R([1], [Vector{Int}(cs[k,:])]))) for k in 1:nrows(cs)]
end


Expand All @@ -115,7 +115,7 @@ Dict{QQMPolyRingElem, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}} with 2 ent
cr = chow_ring(v)
R = base_ring(cr)
co = cox_ring(v)
cs = cones(v)
cs = cones(v; trivial=false)
mapping = Dict{QQMPolyRingElem, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}()
for k in 1:nrows(cs)
p1 = simplify(cr(R([1], [Vector{Int}(cs[k,:])]))).f
Expand Down
32 changes: 19 additions & 13 deletions src/PolyhedralGeometry/PolyhedralFan/properties.jl
Original file line number Diff line number Diff line change
Expand Up @@ -250,18 +250,19 @@ _ray_indices(::Val{_cone_of_dim}, PF::_FanLikeType; c_dim::Int=0) =
_incidencematrix(::Val{_cone_of_dim}) = _ray_indices

@doc raw"""
cones(PF::PolyhedralFan)
cones(PF::PolyhedralFan; trivial=true)

Return the ray indices of all non-zero-dimensional
cones in a polyhedral fan.
Return the ray indices of all cones in a polyhedral fan.
If `trivial` is set to `false`, the trivial cone, i.e., the Minkowski sum of the origin
with the lineality space of the fan, will be omitted.

# Examples
```jldoctest
julia> PF = face_fan(cube(2))
Polyhedral fan in ambient dimension 2

julia> cones(PF)
8×4 IncidenceMatrix
9×4 IncidenceMatrix
[1, 3]
[2, 4]
[1, 2]
Expand All @@ -270,15 +271,18 @@ julia> cones(PF)
[3]
[2]
[4]
[]
```
"""
function cones(PF::_FanLikeType)
function cones(PF::_FanLikeType; trivial::Bool=true)
pmo = pm_object(PF)
ncones = pmo.HASSE_DIAGRAM.N_NODES
cones = [Polymake._get_entry(pmo.HASSE_DIAGRAM.FACES, i) for i in 0:(ncones - 1)]
cones = filter(x -> !(-1 in x) && length(x) > 0, cones)
n_maximal_cones(PF) == 0 && return IncidenceMatrix(0, 0)
ncones = pmo.HASSE_DIAGRAM.N_NODES - 1
cones = [Polymake._get_entry(pmo.HASSE_DIAGRAM.FACES, i) for i in 0:ncones]
filter!(x -> !(-1 in x), cones)
trivial || filter!(!isempty, cones)
cones = [Polymake.to_one_based_indexing(x) for x in cones]
return IncidenceMatrix([Vector{Int}(x) for x in cones])
return IncidenceMatrix(length(cones), pmo.N_RAYS, [Vector{Int}(x) for x in cones])
end

@doc raw"""
Expand Down Expand Up @@ -588,22 +592,24 @@ julia> n_maximal_cones(PF)
n_maximal_cones(PF::_FanLikeType) = pm_object(PF).N_MAXIMAL_CONES::Int

@doc raw"""
n_cones(PF::PolyhedralFan)
n_cones(PF::PolyhedralFan; trivial=true)

Return the number of cones of `PF`.
If `trivial` is set to `false`, the trivial cone, i.e., the Minkowski sum of the origin
with the lineality space of the fan, will be omitted.

# Examples
The cones given in this construction are non-redundant. There are six
The cones given in this construction are non-redundant. There are five
cones in this fan.
```jldoctest
julia> PF = polyhedral_fan(incidence_matrix([[1, 2], [3]]), [1 0; 0 1; -1 -1])
Polyhedral fan in ambient dimension 2

julia> n_cones(PF)
4
5
```
"""
n_cones(PF::_FanLikeType) = nrows(cones(PF))
n_cones(PF::_FanLikeType; trivial=true) = nrows(cones(PF; trivial))

@doc raw"""
ambient_dim(PF::PolyhedralFan)
Expand Down
4 changes: 2 additions & 2 deletions test/AlgebraicGeometry/ToricVarieties/toric_blowups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
# Now blowing up along an existing ray
g = blow_up(X, 2)
@test n_rays(domain(g)) == 2
@test n_cones(domain(g)) == 3
@test n_cones(domain(g)) == 4

# Quadratic cone, blowup along maximal cone
ray_generators = [[0, 0, 1], [1, 0, 1], [1, 1, 1], [0, 1, 1]]
Expand All @@ -108,6 +108,6 @@
# Now blowing up along an existing ray
g = blow_up(X, 6)
@test n_rays(domain(g)) == 4
@test n_cones(domain(g)) == 11
@test n_cones(domain(g)) == 12
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ julia> n_maximal_cones(fanobj)
76

julia> n_cones(fanobj)
671
672

julia> is_pointed(fanobj)
true
Expand Down