diff --git a/src/Approximations/template_directions.jl b/src/Approximations/template_directions.jl index 7b158011ae..6bd0135c74 100644 --- a/src/Approximations/template_directions.jl +++ b/src/Approximations/template_directions.jl @@ -500,8 +500,12 @@ Cartesian components of each direction are obtained with The integer passed as an argument is used to discretize ``φ``: ```jldoctest; filter = r"2246[0-9]*e-16" -julia> pd = PolarDirections(2) -PolarDirections{Float64,Array{Float64,1}}(2, Array{Float64,1}[[1.0, 0.0], [-1.0, 1.2246467991473532e-16]]) +julia> pd = PolarDirections(2); + +julia> pd.stack +2-element Array{Array{Float64,1},1}: + [1.0, 0.0] + [-1.0, 1.2246467991473532e-16] julia> length(pd) 2 @@ -685,8 +689,14 @@ passed (in which case the optional argument `n` needs to be specified). Creating a template with box directions in dimension two: ```jldoctest -julia> dirs = CustomDirections([[1.0, 0.0], [-1.0, 0.0], [0.0, 1.0], [0.0, -1.0]]) -CustomDirections{Float64,Array{Float64,1}}(Array{Float64,1}[[1.0, 0.0], [-1.0, 0.0], [0.0, 1.0], [0.0, -1.0]], 2, true, true) +julia> dirs = CustomDirections([[1.0, 0.0], [-1.0, 0.0], [0.0, 1.0], [0.0, -1.0]]); + +julia> dirs.directions +4-element Array{Array{Float64,1},1}: + [1.0, 0.0] + [-1.0, 0.0] + [0.0, 1.0] + [0.0, -1.0] julia> LazySets.Approximations.isbounding(dirs) true diff --git a/src/LazyOperations/CartesianProductArray.jl b/src/LazyOperations/CartesianProductArray.jl index d25a3ab5bb..c3909907ef 100644 --- a/src/LazyOperations/CartesianProductArray.jl +++ b/src/LazyOperations/CartesianProductArray.jl @@ -472,8 +472,17 @@ julia> using LazySets: block_to_dimension_indices julia> cpa = CartesianProductArray([BallInf(zeros(n), 1.0) for n in [1, 3, 2, 3]]); -julia> block_to_dimension_indices(cpa, [2, 4, 8]) -(Tuple{Int64,Int64}[(-1, -1), (2, 4), (-1, -1), (7, 9)], 2) +julia> m, k = block_to_dimension_indices(cpa, [2, 4, 8]); + +julia> m +4-element Array{Tuple{Int64,Int64},1}: + (-1, -1) + (2, 4) + (-1, -1) + (7, 9) + +julia> k +2 ``` This vector represents the mapping "second block from dimension 2 to dimension 4, fourth block from dimension 7 to dimension 9." diff --git a/src/Sets/VPolygon.jl b/src/Sets/VPolygon.jl index c99e9521d7..98335ce319 100644 --- a/src/Sets/VPolygon.jl +++ b/src/Sets/VPolygon.jl @@ -34,8 +34,13 @@ A polygon in vertex representation can be constructed by passing the list of vertices. For example, we can build the right triangle ```jldoctest polygon_vrep -julia> P = VPolygon([[0, 0], [1, 0], [0, 1]]) -VPolygon{Int64,Array{Int64,1}}(Array{Int64,1}[[0, 0], [1, 0], [0, 1]]) +julia> P = VPolygon([[0, 0], [1, 0], [0, 1]]); + +julia> P.vertices +3-element Array{Array{Int64,1},1}: + [0, 0] + [1, 0] + [0, 1] ``` Alternatively, a `VPolygon` can be constructed passing a matrix of vertices, @@ -47,8 +52,13 @@ julia> M = [0 1 0; 0 0 1.] 0.0 1.0 0.0 0.0 0.0 1.0 -julia> VPolygon(M) -VPolygon{Float64,Array{Float64,1}}(Array{Float64,1}[[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]]) +julia> P = VPolygon(M); + +julia> P.vertices +3-element Array{Array{Float64,1},1}: + [0.0, 0.0] + [1.0, 0.0] + [0.0, 1.0] ``` """ struct VPolygon{N<:Real, VN<:AbstractVector{N}} <: AbstractPolygon{N} diff --git a/src/Sets/VPolytope.jl b/src/Sets/VPolytope.jl index 881ca3d4b0..b28df3b853 100644 --- a/src/Sets/VPolytope.jl +++ b/src/Sets/VPolytope.jl @@ -25,23 +25,34 @@ Type that represents a convex polytope in V-representation. A polytope in vertex representation can be constructed by passing the list of vertices. For example, we can build the tetrahedron: -```jldoctest polytope_vrep -julia> P = VPolytope([0 0 0; 1 0 0; 0 1 0; 0 0 1]) -VPolytope{Int64,Array{Int64,1}}(Array{Int64,1}[[0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) +```jldoctest +julia> P = VPolytope([0 0 0; 1 0 0; 0 1 0; 0 0 1]); + +julia> P.vertices +3-element Array{Array{Int64,1},1}: + [0, 1, 0, 0] + [0, 0, 1, 0] + [0, 0, 0, 1] ``` Alternatively, a `VPolytope` can be constructed passing a matrix of vertices, where each *column* represents a vertex: -```jldoctest polytope_vrep +```jldoctest julia> M = [0 0 0; 1 0 0; 0 1 0; 0 0 1]' 3×4 LinearAlgebra.Adjoint{Int64,Array{Int64,2}}: 0 1 0 0 0 0 1 0 0 0 0 1 -julia> VPolytope(M) -VPolytope{Int64,Array{Int64,1}}(Array{Int64,1}[[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]]) +julia> P = VPolytope(M); + +julia> P.vertices +4-element Array{Array{Int64,1},1}: + [0, 0, 0] + [1, 0, 0] + [0, 1, 0] + [0, 0, 1] ``` """ struct VPolytope{N<:Real, VN<:AbstractVector{N}} <: AbstractPolytope{N} @@ -91,14 +102,19 @@ If it is empty, the result is ``-1``. ### Examples ```jldoctest -julia> v = VPolytope() -VPolytope{Float64,Array{Float64,1}}(Array{Float64,1}[]) +julia> v = VPolytope(); + +julia> v.vertices +0-element Array{Array{Float64,1},1} julia> dim(v) -1 -julia> v = VPolytope([ones(3)]) -VPolytope{Float64,Array{Float64,1}}(Array{Float64,1}[[1.0, 1.0, 1.0]]) +julia> v = VPolytope([ones(3)]); + +julia> v.vertices +1-element Array{Array{Float64,1},1}: + [1.0, 1.0, 1.0] julia> dim(v) == 3 true