diff --git a/docs/src/assets/interfaces.graphml b/docs/src/assets/interfaces.graphml index 5c599430e8..5b14bdb273 100644 --- a/docs/src/assets/interfaces.graphml +++ b/docs/src/assets/interfaces.graphml @@ -18,10 +18,10 @@ - + - LazySet + LazySet @@ -60,10 +60,10 @@ - + - AbstractPointSymmetric + AbstractCentrallySymmetric @@ -81,10 +81,10 @@ - + - AbstractPointSymmetricPolytope + AbstractCentrallySymmetricPolytope diff --git a/docs/src/assets/interfaces.png b/docs/src/assets/interfaces.png index 1bdf296289..3d27c9505b 100644 Binary files a/docs/src/assets/interfaces.png and b/docs/src/assets/interfaces.png differ diff --git a/docs/src/lib/interfaces.md b/docs/src/lib/interfaces.md index 21d223a7c5..7c8f664b5a 100644 --- a/docs/src/lib/interfaces.md +++ b/docs/src/lib/interfaces.md @@ -58,22 +58,22 @@ diameter(::LazySet, ::Real) an_element(::LazySet{Real}) ``` -## Point symmetric set +## Centrally symmetric set -Point symmetric sets such as balls of different norms are characterized by a +Centrally symmetric sets such as balls of different norms are characterized by a center. Note that there is a special interface combination -[Point symmetric polytope](@ref). +[Centrally symmetric polytope](@ref). ```@docs -AbstractPointSymmetric +AbstractCentrallySymmetric ``` This interface defines the following functions: ```@docs -dim(::AbstractPointSymmetric) -an_element(::AbstractPointSymmetric{N}) where {N<:Real} +dim(::AbstractCentrallySymmetric) +an_element(::AbstractCentrallySymmetric{N}) where {N<:Real} ``` ## Polytope @@ -81,7 +81,7 @@ an_element(::AbstractPointSymmetric{N}) where {N<:Real} A polytope has finitely many vertices (*V-representation*) resp. facets (*H-representation*). Note that there is a special interface combination -[Point symmetric polytope](@ref). +[Centrally symmetric polytope](@ref). ```@docs AbstractPolytope @@ -128,25 +128,26 @@ addconstraint!(::AbstractHPolygon{Real}, ::LinearConstraint{Real}) constraints_list(::AbstractHPolygon{Real}) ``` -### Point symmetric polytope +### Centrally symmetric polytope -A point symmetric polytope is a combination of two other interfaces: -[Point symmetric set](@ref) and [Polytope](@ref). +A centrally symmetric polytope is a combination of two other interfaces: +[Centrally symmetric set](@ref) and [Polytope](@ref). ```@docs -AbstractPointSymmetricPolytope +AbstractCentrallySymmetricPolytope ``` This interface defines the following functions: ```@docs -dim(::AbstractPointSymmetricPolytope) -an_element(::AbstractPointSymmetricPolytope{N}) where {N<:Real} +dim(::AbstractCentrallySymmetricPolytope) +an_element(::AbstractCentrallySymmetricPolytope{N}) where {N<:Real} ``` #### Hyperrectangle -A hyperrectangle is a special point symmetric polytope with axis-aligned facets. +A hyperrectangle is a special centrally symmetric polytope with axis-aligned +facets. ```@docs AbstractHyperrectangle diff --git a/docs/src/lib/operations.md b/docs/src/lib/operations.md index 2a27257f82..9c54afe8c5 100644 --- a/docs/src/lib/operations.md +++ b/docs/src/lib/operations.md @@ -234,8 +234,8 @@ Inherited from [`AbstractPolytope`](@ref): * [`singleton_list`](@ref singleton_list(::AbstractPolytope)) * [`linear_map`](@ref linear_map(::AbstractMatrix, ::AbstractPolytope)) -Inherited from [`AbstractPointSymmetricPolytope`](@ref): -* [`dim`](@ref dim(::AbstractPointSymmetricPolytope)) +Inherited from [`AbstractCentrallySymmetricPolytope`](@ref): +* [`dim`](@ref dim(::AbstractCentrallySymmetricPolytope)) * `an_element` Inherited from [`AbstractHyperrectangle`](@ref): diff --git a/docs/src/lib/representations.md b/docs/src/lib/representations.md index d30cb53847..5033268141 100644 --- a/docs/src/lib/representations.md +++ b/docs/src/lib/representations.md @@ -30,8 +30,8 @@ Inherited from [`LazySet`](@ref): * [`radius`](@ref radius(::LazySet, ::Real)) * [`diameter`](@ref diameter(::LazySet, ::Real)) -Inherited from [`AbstractPointSymmetric`](@ref): -* [`dim`](@ref dim(::AbstractPointSymmetric)) +Inherited from [`AbstractCentrallySymmetric`](@ref): +* [`dim`](@ref dim(::AbstractCentrallySymmetric)) * `an_element` ### Infinity norm ball @@ -50,8 +50,8 @@ Inherited from [`AbstractPolytope`](@ref): * [`singleton_list`](@ref singleton_list(::AbstractPolytope)) * [`linear_map`](@ref linear_map(::AbstractMatrix, ::AbstractPolytope)) -Inherited from [`AbstractPointSymmetricPolytope`](@ref): -* [`dim`](@ref dim(::AbstractPointSymmetricPolytope)) +Inherited from [`AbstractCentrallySymmetricPolytope`](@ref): +* [`dim`](@ref dim(::AbstractCentrallySymmetricPolytope)) * `an_element` Inherited from [`AbstractHyperrectangle`](@ref): @@ -78,8 +78,8 @@ Inherited from [`AbstractPolytope`](@ref): * [`singleton_list`](@ref singleton_list(::AbstractPolytope)) * [`linear_map`](@ref linear_map(::AbstractMatrix, ::AbstractPolytope)) -Inherited from [`AbstractPointSymmetricPolytope`](@ref): -* [`dim`](@ref dim(::AbstractPointSymmetricPolytope)) +Inherited from [`AbstractCentrallySymmetricPolytope`](@ref): +* [`dim`](@ref dim(::AbstractCentrallySymmetricPolytope)) * `an_element` ### p-norm ball @@ -95,8 +95,8 @@ Inherited from [`LazySet`](@ref): * [`radius`](@ref radius(::LazySet, ::Real)) * [`diameter`](@ref diameter(::LazySet, ::Real)) -Inherited from [`AbstractPointSymmetric`](@ref): -* [`dim`](@ref dim(::AbstractPointSymmetric)) +Inherited from [`AbstractCentrallySymmetric`](@ref): +* [`dim`](@ref dim(::AbstractCentrallySymmetric)) * `an_element` ## Ellipsoid @@ -112,8 +112,8 @@ Inherited from [`LazySet`](@ref): * [`radius`](@ref radius(::LazySet, ::Real)) * [`diameter`](@ref diameter(::LazySet, ::Real)) -Inherited from [`AbstractPointSymmetric`](@ref): -* [`dim`](@ref dim(::AbstractPointSymmetric)) +Inherited from [`AbstractCentrallySymmetric`](@ref): +* [`dim`](@ref dim(::AbstractCentrallySymmetric)) * `an_element` ## Empty set @@ -182,8 +182,8 @@ Inherited from [`AbstractPolytope`](@ref): * [`singleton_list`](@ref singleton_list(::AbstractPolytope)) * [`linear_map`](@ref linear_map(::AbstractMatrix, ::AbstractPolytope)) -Inherited from [`AbstractPointSymmetricPolytope`](@ref): -* [`dim`](@ref dim(::AbstractPointSymmetricPolytope)) +Inherited from [`AbstractCentrallySymmetricPolytope`](@ref): +* [`dim`](@ref dim(::AbstractCentrallySymmetricPolytope)) * `an_element` Inherited from [`AbstractHyperrectangle`](@ref): @@ -389,8 +389,8 @@ Inherited from [`LazySet`](@ref): Inherited from [`AbstractPolytope`](@ref): * [`singleton_list`](@ref singleton_list(::AbstractPolytope)) -Inherited from [`AbstractPointSymmetricPolytope`](@ref): -* [`dim`](@ref dim(::AbstractPointSymmetricPolytope)) +Inherited from [`AbstractCentrallySymmetricPolytope`](@ref): +* [`dim`](@ref dim(::AbstractCentrallySymmetricPolytope)) Inherited from [`AbstractHyperrectangle`](@ref): * [`norm`](@ref norm(::AbstractHyperrectangle, ::Real)) @@ -457,6 +457,6 @@ Inherited from [`LazySet`](@ref): Inherited from [`AbstractPolytope`](@ref): * [`singleton_list`](@ref singleton_list(::AbstractPolytope)) -Inherited from [`AbstractPointSymmetricPolytope`](@ref): -* [`dim`](@ref dim(::AbstractPointSymmetricPolytope)) +Inherited from [`AbstractCentrallySymmetricPolytope`](@ref): +* [`dim`](@ref dim(::AbstractCentrallySymmetricPolytope)) * `an_element` diff --git a/docs/src/man/set_operations.md b/docs/src/man/set_operations.md index c10fc85dfb..e3917a2a23 100644 --- a/docs/src/man/set_operations.md +++ b/docs/src/man/set_operations.md @@ -67,8 +67,8 @@ The table entries have the following meaning. | `LazySet` | | | | | | | `AHPolygon` | | | | x | x | | `AHyperrectangle` | x | x | x | (x) | x | -| `APointSymmetric` | | | | x | | -| `APointSymmetricPolytope` | | | | x | | +| `ACentrallySymmetric` | | | | x | | +| `ACentrallySymmetricPolytope`| | | | x | | | `APolygon` | | | | | | | `APolytope` | | | | | | | `ASingleton` | (x) | (x) | (x) | x | x | @@ -198,8 +198,8 @@ The table entries consist of subsets of the following list of operations. | `LazySet` | | | ⊆ | | | | |(⊆),∩=∅| | | (⊆) | | | | | | (⊆) | (⊆) | | (⊆) | | | | | | | | | | | | | | (⊆) | | `AHPolygon` | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) |(⊆,∩=∅)| (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) |(⊆,∩=∅)| (⊆) |(⊆,∩=∅)| (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | | `AHyperrectangle` | (⊆) | (⊆) |{⊆},∩=∅|(⊆)| (⊆) | (⊆) | (⊆) |[⊆,∩=∅]| (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) |(⊆,∩=∅)|(⊆,∩=∅)|(⊆) |(⊆,∩=∅)| (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | -| `APointSymmetric` | | | (⊆) | | | | |(⊆,∩=∅)| | | | | | | | | |(⊆,∩=∅)| |(⊆,∩=∅)| | | | | | | | | | | | | | | -| `APointSymmetricPolytope` | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) |(⊆,∩=∅)| (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) |(⊆,∩=∅)| (⊆) |(⊆,∩=∅)| (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | +| `ACentrallySymmetric` | | | (⊆) | | | | |(⊆,∩=∅)| | | | | | | | | |(⊆,∩=∅)| |(⊆,∩=∅)| | | | | | | | | | | | | | | +| `ACentrallySymmetricPolytope`| (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) |(⊆,∩=∅)| (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) |(⊆,∩=∅)| (⊆) |(⊆,∩=∅)| (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | | `APolygon` | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) |(⊆,∩=∅)| (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) |(⊆,∩=∅)| (⊆) |(⊆,∩=∅)| (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | | `APolytope` | ⊆ | (⊆) | [⊆] | (⊆) | (⊆) | (⊆) | (⊆) |(⊆,∩=∅)| (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) |(⊆,∩=∅)| (⊆) |(⊆,∩=∅)| (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | (⊆) | | `ASingleton` |{⊆},∩=∅|(⊆,∩=∅)|[⊆,∩=∅]|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|[⊆,∩=∅]|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|((⊆,∩=∅))|(⊆,∩=∅)|((⊆,∩=∅))|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)|(⊆,∩=∅)| diff --git a/src/AbstractCentrallySymmetric.jl b/src/AbstractCentrallySymmetric.jl new file mode 100644 index 0000000000..d4880f494b --- /dev/null +++ b/src/AbstractCentrallySymmetric.jl @@ -0,0 +1,60 @@ +export AbstractCentrallySymmetric, + center, + an_element + +""" + AbstractCentrallySymmetric{N<:Real} <: LazySet{N} + +Abstract type for centrally symmetric sets. + +### Notes + +Every concrete `AbstractCentrallySymmetric` must define the following functions: + +- `center(::AbstractCentrallySymmetric{N})::Vector{N}` -- return the center + point + +```jldoctest +julia> subtypes(AbstractCentrallySymmetric) +3-element Array{Any,1}: + Ball2 + Ballp + Ellipsoid +``` +""" +abstract type AbstractCentrallySymmetric{N<:Real} <: LazySet{N} end + + +""" + dim(S::AbstractCentrallySymmetric)::Int + +Return the ambient dimension of a centrally symmetric set. + +### Input + +- `S` -- set + +### Output + +The ambient dimension of the set. +""" +@inline function dim(S::AbstractCentrallySymmetric)::Int + return length(center(S)) +end + +""" + an_element(S::AbstractCentrallySymmetric{N})::Vector{N} where {N<:Real} + +Return some element of a centrally symmetric set. + +### Input + +- `S` -- centrally symmetric set + +### Output + +The center of the centrally symmetric set. +""" +function an_element(S::AbstractCentrallySymmetric{N})::Vector{N} where {N<:Real} + return center(S) +end diff --git a/src/AbstractCentrallySymmetricPolytope.jl b/src/AbstractCentrallySymmetricPolytope.jl new file mode 100644 index 0000000000..486f62af48 --- /dev/null +++ b/src/AbstractCentrallySymmetricPolytope.jl @@ -0,0 +1,78 @@ +export AbstractCentrallySymmetricPolytope, + center, + an_element, + vertices_list, + singleton_list + +""" + AbstractCentrallySymmetricPolytope{N<:Real} <: AbstractPolytope{N} + +Abstract type for centrally symmetric, polytopic sets. +It combines the `AbstractCentrallySymmetric` and `AbstractPolytope` interfaces. +Such a type combination is necessary as long as Julia does not support +[multiple inheritance](https://github.com/JuliaLang/julia/issues/5). + +### Notes + +Every concrete `AbstractCentrallySymmetricPolytope` must define the following +functions: +- from `AbstractCentrallySymmetric`: + - `center(::AbstractCentrallySymmetricPolytope{N})::Vector{N}` -- return the + center point +- from `AbstractPolytope`: + - `vertices_list(::AbstractCentrallySymmetricPolytope{N})::Vector{Vector{N}}` + -- return a list of all vertices + +```jldoctest +julia> subtypes(AbstractCentrallySymmetricPolytope) +5-element Array{Any,1}: + AbstractHyperrectangle + Ball1 + Interval + LineSegment + Zonotope +``` +""" +abstract type AbstractCentrallySymmetricPolytope{N<:Real} <: AbstractPolytope{N} +end + + +# --- common AbstractCentrallySymmetric functions (copy-pasted) --- + + +""" + dim(P::AbstractCentrallySymmetricPolytope)::Int + +Return the ambient dimension of a centrally symmetric set. + +### Input + +- `P` -- set + +### Output + +The ambient dimension of the set. +""" +@inline function dim(P::AbstractCentrallySymmetricPolytope)::Int + return length(center(P)) +end + + +""" + an_element(P::AbstractCentrallySymmetricPolytope{N})::Vector{N} + where {N<:Real} + +Return some element of a centrally symmetric polytope. + +### Input + +- `P` -- centrally symmetric polytope + +### Output + +The center of the centrally symmetric polytope. +""" +function an_element(P::AbstractCentrallySymmetricPolytope{N} + )::Vector{N} where {N<:Real} + return center(P) +end diff --git a/src/AbstractHyperrectangle.jl b/src/AbstractHyperrectangle.jl index 972dbe8791..45b317ac7a 100644 --- a/src/AbstractHyperrectangle.jl +++ b/src/AbstractHyperrectangle.jl @@ -4,7 +4,7 @@ export AbstractHyperrectangle, radius_hyperrectangle """ - AbstractHyperrectangle{N<:Real} <: AbstractPointSymmetricPolytope{N} + AbstractHyperrectangle{N<:Real} <: AbstractCentrallySymmetricPolytope{N} Abstract type for hyperrectangular sets. @@ -25,7 +25,7 @@ julia> subtypes(AbstractHyperrectangle) SymmetricIntervalHull ``` """ -abstract type AbstractHyperrectangle{N<:Real} <: AbstractPointSymmetricPolytope{N} +abstract type AbstractHyperrectangle{N<:Real} <: AbstractCentrallySymmetricPolytope{N} end diff --git a/src/AbstractPointSymmetric.jl b/src/AbstractPointSymmetric.jl deleted file mode 100644 index 528196e3d7..0000000000 --- a/src/AbstractPointSymmetric.jl +++ /dev/null @@ -1,59 +0,0 @@ -export AbstractPointSymmetric, - center, - an_element - -""" - AbstractPointSymmetric{N<:Real} <: LazySet{N} - -Abstract type for point symmetric sets. - -### Notes - -Every concrete `AbstractPointSymmetric` must define the following functions: - -- `center(::AbstractPointSymmetric{N})::Vector{N}` -- return the center point - -```jldoctest -julia> subtypes(AbstractPointSymmetric) -3-element Array{Any,1}: - Ball2 - Ballp - Ellipsoid -``` -""" -abstract type AbstractPointSymmetric{N<:Real} <: LazySet{N} end - - -""" - dim(S::AbstractPointSymmetric)::Int - -Return the ambient dimension of a point symmetric set. - -### Input - -- `S` -- set - -### Output - -The ambient dimension of the set. -""" -@inline function dim(S::AbstractPointSymmetric)::Int - return length(center(S)) -end - -""" - an_element(S::AbstractPointSymmetric{N})::Vector{N} where {N<:Real} - -Return some element of a point symmetric set. - -### Input - -- `S` -- point symmetric set - -### Output - -The center of the point symmetric set. -""" -function an_element(S::AbstractPointSymmetric{N})::Vector{N} where {N<:Real} - return center(S) -end diff --git a/src/AbstractPointSymmetricPolytope.jl b/src/AbstractPointSymmetricPolytope.jl deleted file mode 100644 index f8666ccb1b..0000000000 --- a/src/AbstractPointSymmetricPolytope.jl +++ /dev/null @@ -1,76 +0,0 @@ -export AbstractPointSymmetricPolytope, - center, - an_element, - vertices_list, - singleton_list - -""" - AbstractPointSymmetricPolytope{N<:Real} <: AbstractPolytope{N} - -Abstract type for point symmetric, polytopic sets. -It combines the `AbstractPointSymmetric` and `AbstractPolytope` interfaces. -Such a type combination is necessary as long as Julia does not support -[multiple inheritance](https://github.com/JuliaLang/julia/issues/5). - -### Notes - -Every concrete `AbstractPointSymmetricPolytope` must define the following -functions: -- from `AbstractPointSymmetric`: - - `center(::AbstractPointSymmetricPolytope{N})::Vector{N}` -- return the - center point -- from `AbstractPolytope`: - - `vertices_list(::AbstractPointSymmetricPolytope{N})::Vector{Vector{N}}` - -- return a list of all vertices - -```jldoctest -julia> subtypes(AbstractPointSymmetricPolytope) -5-element Array{Any,1}: - AbstractHyperrectangle - Ball1 - Interval - LineSegment - Zonotope -``` -""" -abstract type AbstractPointSymmetricPolytope{N<:Real} <: AbstractPolytope{N} end - - -# --- common AbstractPointSymmetric functions (copy-pasted) --- - - -""" - dim(P::AbstractPointSymmetricPolytope)::Int - -Return the ambient dimension of a point symmetric set. - -### Input - -- `P` -- set - -### Output - -The ambient dimension of the set. -""" -@inline function dim(P::AbstractPointSymmetricPolytope)::Int - return length(center(P)) -end - - -""" - an_element(P::AbstractPointSymmetricPolytope{N})::Vector{N} where {N<:Real} - -Return some element of a point symmetric polytope. - -### Input - -- `P` -- point symmetric polytope - -### Output - -The center of the point symmetric polytope. -""" -function an_element(P::AbstractPointSymmetricPolytope{N} - )::Vector{N} where {N<:Real} - return center(P) -end diff --git a/src/AbstractPolytope.jl b/src/AbstractPolytope.jl index 2ee0dcda68..9fd77dac7d 100644 --- a/src/AbstractPolytope.jl +++ b/src/AbstractPolytope.jl @@ -19,7 +19,7 @@ Every concrete `AbstractPolytope` must define the following functions: ```jldoctest julia> subtypes(AbstractPolytope) 4-element Array{Any,1}: - AbstractPointSymmetricPolytope + AbstractCentrallySymmetricPolytope AbstractPolygon HPolytope VPolytope diff --git a/src/AbstractSingleton.jl b/src/AbstractSingleton.jl index 14eaf77bfa..3ab82f2e84 100644 --- a/src/AbstractSingleton.jl +++ b/src/AbstractSingleton.jl @@ -68,7 +68,7 @@ function radius_hyperrectangle(S::AbstractSingleton{N} end -# --- AbstractPointSymmetric interface functions --- +# --- AbstractCentrallySymmetric interface functions --- """ diff --git a/src/Ball1.jl b/src/Ball1.jl index 292f5bc17e..18f0f6afe6 100644 --- a/src/Ball1.jl +++ b/src/Ball1.jl @@ -3,7 +3,7 @@ import Base.∈ export Ball1 """ - Ball1{N<:Real} <: AbstractPointSymmetricPolytope{N} + Ball1{N<:Real} <: AbstractCentrallySymmetricPolytope{N} Type that represents a ball in the 1-norm, also known as Manhattan or Taxicab norm. @@ -40,7 +40,7 @@ julia> σ([0.,1], B) 1.0 ``` """ -struct Ball1{N<:Real} <: AbstractPointSymmetricPolytope{N} +struct Ball1{N<:Real} <: AbstractCentrallySymmetricPolytope{N} center::Vector{N} radius::N @@ -55,7 +55,7 @@ end Ball1(center::Vector{N}, radius::N) where {N<:Real} = Ball1{N}(center, radius) -# --- AbstractPointSymmetric interface functions --- +# --- AbstractCentrallySymmetric interface functions --- """ diff --git a/src/Ball2.jl b/src/Ball2.jl index cbebc75603..69b7ff7aa0 100644 --- a/src/Ball2.jl +++ b/src/Ball2.jl @@ -3,7 +3,7 @@ import Base.∈ export Ball2 """ - Ball2{N<:AbstractFloat} <: AbstractPointSymmetric{N} + Ball2{N<:AbstractFloat} <: AbstractCentrallySymmetric{N} Type that represents a ball in the 2-norm. @@ -48,7 +48,7 @@ julia> σ([1.,2.,3.,4.,5.], B) 0.3370999312316211 ``` """ -struct Ball2{N<:AbstractFloat} <: AbstractPointSymmetric{N} +struct Ball2{N<:AbstractFloat} <: AbstractCentrallySymmetric{N} center::Vector{N} radius::N @@ -63,7 +63,7 @@ end Ball2(center::Vector{N}, radius::N) where {N<:AbstractFloat} = Ball2{N}(center, radius) -# --- AbstractPointSymmetric interface functions --- +# --- AbstractCentrallySymmetric interface functions --- """ diff --git a/src/BallInf.jl b/src/BallInf.jl index 741fe6e3e4..023cde7fed 100644 --- a/src/BallInf.jl +++ b/src/BallInf.jl @@ -90,7 +90,7 @@ function radius_hyperrectangle(B::BallInf{N})::Vector{N} where {N<:Real} end -# --- AbstractPointSymmetric interface functions --- +# --- AbstractCentrallySymmetric interface functions --- """ diff --git a/src/Ballp.jl b/src/Ballp.jl index dc8183f7c9..1c70ee216e 100644 --- a/src/Ballp.jl +++ b/src/Ballp.jl @@ -3,7 +3,7 @@ import Base.∈ export Ballp """ - Ballp{N<:AbstractFloat} <: AbstractPointSymmetric{N} + Ballp{N<:AbstractFloat} <: AbstractCentrallySymmetric{N} Type that represents a ball in the p-norm, for ``1 ≤ p ≤ ∞``. @@ -52,7 +52,7 @@ julia> σ([1., 2, 3, 4, 5], B) 0.33790011086518895 ``` """ -struct Ballp{N<:AbstractFloat} <: AbstractPointSymmetric{N} +struct Ballp{N<:AbstractFloat} <: AbstractCentrallySymmetric{N} p::N center::Vector{N} radius::N @@ -78,7 +78,7 @@ end Ballp(p::N, center::Vector{N}, radius::N) where {N<:AbstractFloat} = Ballp{N}(p, center, radius) -# --- AbstractPointSymmetric interface functions --- +# --- AbstractCentrallySymmetric interface functions --- """ diff --git a/src/Ellipsoid.jl b/src/Ellipsoid.jl index bb62a4bd3f..14acd69c76 100644 --- a/src/Ellipsoid.jl +++ b/src/Ellipsoid.jl @@ -1,7 +1,7 @@ export Ellipsoid """ - Ellipsoid{N<:AbstractFloat} <: AbstractPointSymmetric{N} + Ellipsoid{N<:AbstractFloat} <: AbstractCentrallySymmetric{N} Type that represents an ellipsoid. @@ -60,7 +60,7 @@ julia> E = Ellipsoid(ones(2), Diagonal([2.0, 0.5])) Ellipsoid{Float64}([1.0, 1.0], [2.0 0.0; 0.0 0.5]) ``` """ -struct Ellipsoid{N<:AbstractFloat} <: AbstractPointSymmetric{N} +struct Ellipsoid{N<:AbstractFloat} <: AbstractCentrallySymmetric{N} center::AbstractVector{N} shape_matrix::AbstractMatrix{N} diff --git a/src/Hyperrectangle.jl b/src/Hyperrectangle.jl index cce8311c26..b07c88a470 100644 --- a/src/Hyperrectangle.jl +++ b/src/Hyperrectangle.jl @@ -127,7 +127,7 @@ function radius_hyperrectangle(H::Hyperrectangle{N})::Vector{N} where {N<:Real} end -# --- AbstractPointSymmetric interface functions --- +# --- AbstractCentrallySymmetric interface functions --- """ diff --git a/src/Interval.jl b/src/Interval.jl index 77d4570417..7a0ff742d7 100644 --- a/src/Interval.jl +++ b/src/Interval.jl @@ -7,7 +7,8 @@ export Interval, low, high, vertices_list """ - Interval{N<:Real, IN <: AbstractInterval{N}} <: AbstractPointSymmetricPolytope{N} + Interval{N<:Real, IN <: AbstractInterval{N}} + <: AbstractCentrallySymmetricPolytope{N} Type representing an interval on the real line. Mathematically, it is of the form @@ -22,7 +23,8 @@ form ### Notes -This type relies on the [IntervalArithmetic.jl](https://juliaintervals.github.io/IntervalArithmetic.jl/stable/) +This type relies on the +[IntervalArithmetic.jl](https://juliaintervals.github.io/IntervalArithmetic.jl/stable/) library for representation of intervals and arithmetic operations. ### Examples @@ -73,7 +75,7 @@ julia> Interval(0//1, 2//1) Interval{Rational{Int64},IntervalArithmetic.AbstractInterval{Rational{Int64}}}([0//1, 2//1]) ``` """ -struct Interval{N<:Real, IN <: AbstractInterval{N}} <: AbstractPointSymmetricPolytope{N} +struct Interval{N<:Real, IN <: AbstractInterval{N}} <: AbstractCentrallySymmetricPolytope{N} dat::IN end diff --git a/src/LazySet.jl b/src/LazySet.jl index fb8da1bfc0..fc9b1caef7 100644 --- a/src/LazySet.jl +++ b/src/LazySet.jl @@ -31,7 +31,7 @@ Every concrete `LazySet` must define the following functions: ```jldoctest julia> subtypes(LazySet) 18-element Array{Any,1}: - AbstractPointSymmetric + AbstractCentrallySymmetric AbstractPolytope CacheMinkowskiSum CartesianProduct diff --git a/src/LazySets.jl b/src/LazySets.jl index 952ce28373..8cd784863c 100644 --- a/src/LazySets.jl +++ b/src/LazySets.jl @@ -20,8 +20,8 @@ include("helper_functions.jl") include("LazySet.jl") include("HalfSpace.jl") # must be here to make LinearConstraint available include("AbstractPolytope.jl") -include("AbstractPointSymmetric.jl") -include("AbstractPointSymmetricPolytope.jl") +include("AbstractCentrallySymmetric.jl") +include("AbstractCentrallySymmetricPolytope.jl") include("AbstractHyperrectangle.jl") include("AbstractPolygon.jl") include("AbstractSingleton.jl") diff --git a/src/LineSegment.jl b/src/LineSegment.jl index 7e50502b34..81df945baf 100644 --- a/src/LineSegment.jl +++ b/src/LineSegment.jl @@ -4,7 +4,7 @@ export LineSegment, halfspace_left, halfspace_right """ - LineSegment{N<:Real} <: AbstractPointSymmetricPolytope{N} + LineSegment{N<:Real} <: AbstractCentrallySymmetricPolytope{N} Type that represents a line segment in 2D between two points ``p`` and ``q``. @@ -45,7 +45,7 @@ julia> is_intersection_empty(s, sn, true) (false, [0.5, 0.5]) ``` """ -struct LineSegment{N<:Real} <: AbstractPointSymmetricPolytope{N} +struct LineSegment{N<:Real} <: AbstractCentrallySymmetricPolytope{N} p::AbstractVector{N} q::AbstractVector{N} @@ -168,7 +168,7 @@ function ∈(x::AbstractVector{N}, L::LineSegment{N})::Bool where {N<:Real} end -# --- AbstractPointSymmetric interface functions --- +# --- AbstractCentrallySymmetric interface functions --- """ diff --git a/src/SymmetricIntervalHull.jl b/src/SymmetricIntervalHull.jl index 5c2feeb5a2..9415007432 100644 --- a/src/SymmetricIntervalHull.jl +++ b/src/SymmetricIntervalHull.jl @@ -111,7 +111,7 @@ function radius_hyperrectangle(sih::SymmetricIntervalHull{N} end -# --- AbstractPointSymmetric interface functions --- +# --- AbstractCentrallySymmetric interface functions --- """ diff --git a/src/Zonotope.jl b/src/Zonotope.jl index 688c5e4ac8..3463ec1eed 100644 --- a/src/Zonotope.jl +++ b/src/Zonotope.jl @@ -9,7 +9,7 @@ export Zonotope, reduce_order """ - Zonotope{N<:Real} <: AbstractPointSymmetricPolytope{N} + Zonotope{N<:Real} <: AbstractCentrallySymmetricPolytope{N} Type that represents a zonotope. @@ -81,7 +81,7 @@ julia> Z.generators 0.0 1.0 1.0 ``` """ -struct Zonotope{N<:Real} <: AbstractPointSymmetricPolytope{N} +struct Zonotope{N<:Real} <: AbstractCentrallySymmetricPolytope{N} center::AbstractVector{N} generators::AbstractMatrix{N} end @@ -92,7 +92,7 @@ Zonotope(center::AbstractVector{N}, generators_list::AbstractVector{T} Zonotope(center, hcat(generators_list...)) -# --- AbstractPointSymmetric interface functions --- +# --- AbstractCentrallySymmetric interface functions --- """ diff --git a/test/check_method_ambiguity_binary.jl b/test/check_method_ambiguity_binary.jl index 98cdd13318..ab7c4c5080 100644 --- a/test/check_method_ambiguity_binary.jl +++ b/test/check_method_ambiguity_binary.jl @@ -38,22 +38,24 @@ function check_method_ambiguity_binary(op; print_results::Bool=false, print_warnings::Bool=print_results)::Bool types = [AbstractHPolygon{Float64}, AbstractHyperrectangle{Float64}, - AbstractPointSymmetric{Float64}, - AbstractPointSymmetricPolytope{Float64}, AbstractPolygon{Float64}, - AbstractPolytope{Float64}, AbstractSingleton{Float64}] + AbstractCentrallySymmetric{Float64}, + AbstractCentrallySymmetricPolytope{Float64}, + AbstractPolygon{Float64}, AbstractPolytope{Float64}, + AbstractSingleton{Float64}] polytope_constraints = [LinearConstraint(ones(2), 1.), LinearConstraint([1., -1.], 1.)] type2instance = Dict{Type, Vector{LazySet{Float64}}}([ - (AbstractHPolygon{Float64}, [HPolygon{Float64}(polytope_constraints), - HPolygonOpt{Float64}(polytope_constraints, 1)]), - (AbstractHyperrectangle{Float64}, [BallInf(zeros(2), 1.), - Hyperrectangle(zeros(2), ones(2))]), - (AbstractPointSymmetric{Float64}, [Ball2(zeros(2), 1.), - Ballp(1.5, zeros(2), 1.), - Ellipsoid([1. 0.; 0. 1.])]), - (AbstractPointSymmetricPolytope{Float64}, [Ball1(zeros(2), 1.), - Zonotope(zeros(2), [1. 0.; 0. 1.])]), + (AbstractHPolygon{Float64}, + [HPolygon{Float64}(polytope_constraints), + HPolygonOpt{Float64}(polytope_constraints, 1)]), + (AbstractHyperrectangle{Float64}, + [BallInf(zeros(2), 1.), Hyperrectangle(zeros(2), ones(2))]), + (AbstractCentrallySymmetric{Float64}, + [Ball2(zeros(2), 1.), Ballp(1.5, zeros(2), 1.), + Ellipsoid([1. 0.; 0. 1.])]), + (AbstractCentrallySymmetricPolytope{Float64}, + [Ball1(zeros(2), 1.), Zonotope(zeros(2), [1. 0.; 0. 1.])]), (AbstractPolygon{Float64}, [VPolygon([zeros(2)])]), (AbstractPolytope{Float64}, [HPolytope{Float64}(polytope_constraints)]), (AbstractSingleton{Float64}, [Singleton(zeros(2)), ZeroSet(2)]) diff --git a/test/unit_interfaces.jl b/test/unit_interfaces.jl index b7d80ef89f..189f1db05b 100644 --- a/test/unit_interfaces.jl +++ b/test/unit_interfaces.jl @@ -20,15 +20,15 @@ end @test check_method_implementation(AbstractPolytope, vertices_list, Function[S -> (S{Float64},)], ignore_types=exclusions) -@test check_method_implementation(AbstractPointSymmetricPolytope, vertices_list, +@test check_method_implementation(AbstractCentrallySymmetricPolytope, vertices_list, Function[S -> (S{Float64},)]) -# --- AbstractPointSymmetric --- +# --- AbstractCentrallySymmetric --- # center -@test check_method_implementation(AbstractPointSymmetric, center, +@test check_method_implementation(AbstractCentrallySymmetric, center, Function[S -> (S{Float64},)]) -@test check_method_implementation(AbstractPointSymmetricPolytope, center, +@test check_method_implementation(AbstractCentrallySymmetricPolytope, center, Function[S -> (S{Float64},)]) # --- AbstractHyperrectangle ---