Closed mforets closed 5 years ago
Just to mention that i would add in the docs that space_dimension
is an integer, but not necessarily a non-negative integer: there are some special cases and each library may have different conventions, i guess.
For example:
julia> using LazySets
julia> dim(∅) # the empty set
-1
julia> dim(HPolyhedron()) # the polyhedron with no constraints
-1
I agree that the empty set has dimension
-1 but the dimension
of the polyhedron should be equal to the space_dimension
.
For the space_dimension
on the other hand, I don't see how it can be lower than 0.
For this reason, I ended up disallowing creating an hrep
without a dimension:
julia> hrep(HalfSpace{Int, Vector{Int}}[])
ERROR: Cannot infer dimension of polyhedron constructed from no element.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] FullDim_rec() at /home/blegat/.julia/dev/Polyhedra/src/fulldim.jl:1
[3] FullDim_rec at /home/blegat/.julia/dev/Polyhedra/src/fulldim.jl:6 [inlined] (repeats 2 times)
[4] hrep(::Array{HyperPlane{Int64,Array{Int64,1}},1}, ::Array{HalfSpace{Int64,Array{Int64,1}},1}) at /home/blegat/.julia/dev/Polyhedra/src/vecrep.jl:30
[5] #hrep#68 at /home/blegat/.julia/dev/Polyhedra/src/vecrep.jl:54 [inlined]
[6] hrep(::Array{HalfSpace{Int64,Array{Int64,1}},1}) at /home/blegat/.julia/dev/Polyhedra/src/vecrep.jl:54
[7] top-level scope at none:0
julia> hrep(HalfSpace{Int, Vector{Int}}[], d=2)
H-representation Polyhedra.Intersection{Int64,Array{Int64,1},Int64}
julia> hrep(HalfSpace{Int, SVector{2, Int}}[])
H-representation Polyhedra.Intersection{Int64,SArray{Tuple{2},Int64,1,2},Size{(2,)}}
Brought from the original post here:
space_dimension(::AbstractSet)
refers to the ambient dimension of the given set.dimension(::AbstractSet)
refers to the affine dimension of the set. See here for definitions.