Skip to content

Commit

Permalink
AbstractCentrallySymmetric: revise docs entries, shorten docs
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Dec 30, 2024
1 parent 569715c commit 35d8b5a
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 106 deletions.
118 changes: 108 additions & 10 deletions docs/src/lib/interfaces/AbstractCentrallySymmetric.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,138 @@ CurrentModule = LazySets

# [Centrally symmetric sets (AbstractCentrallySymmetric)](@id def_AbstractCentrallySymmetric)

Centrally symmetric sets such as balls of different norms are characterized by a
center.
Centrally symmetric convex sets such as balls of different norms are characterized by a center.
Note that there is a special interface combination
[Centrally symmetric polytope](@ref def_AbstractCentrallySymmetricPolytope).

```@docs
AbstractCentrallySymmetric
```

This interface requires to implement the following functions:
This interface requires to implement the following function:

```@meta
CurrentModule = LazySets.API
```
```@docs; canonical=false
center(::LazySet)
```
```@meta
CurrentModule = LazySets
```

This interface defines the following functions:

```@docs; canonical=false
an_element(::LazySet)
```
```@meta
CurrentModule = LazySets
```
```@docs
an_element(::AbstractCentrallySymmetric)
dim(::AbstractCentrallySymmetric)
center(::AbstractCentrallySymmetric, ::Int)
```
```@meta
CurrentModule = LazySets.API
```
```@docs; canonical=false
extrema(::LazySet)
```
```@meta
CurrentModule = LazySets
```
```@docs
extrema(::AbstractCentrallySymmetric)
```
```@meta
CurrentModule = LazySets.API
```
```@docs; canonical=false
extrema(::LazySet, ::Int)
```
```@meta
CurrentModule = LazySets
```
```@docs
extrema(::AbstractCentrallySymmetric, ::Int)
isbounded(::AbstractCentrallySymmetric)
isempty(::AbstractCentrallySymmetric)
```
```@meta
CurrentModule = LazySets.API
```
```@docs; canonical=false
isuniversal(::LazySet)
```
```@meta
CurrentModule = LazySets
```
```@docs
isuniversal(::AbstractCentrallySymmetric, ::Bool=false)
```

```@meta
CurrentModule = LazySets.API
```

Undocumented implementations:

* [`center`](@ref center(::LazySet, ::Int))
* [`dim`](@ref dim(::LazySet))
* [`isbounded`](@ref isbounded(::LazySet))
* [`isboundedtype`](@ref isboundedtype(::Type{LazySet}))
* [`isempty`](@ref isempty(::LazySet))

```@meta
CurrentModule = LazySets
```

Inherited from [`LazySet`](@ref):
* [`area`](@ref area(::LazySet))
* [`chebyshev_center_radius`](@ref chebyshev_center_radius(::LazySet))
* [`complement`](@ref complement(::LazySet))
* [`concretize`](@ref concretize(::LazySet))
* [`constraints`](@ref constraints(::LazySet))
* [`convex_hull`](@ref convex_hull(::LazySet))
* `copy(::Type{LazySet})`
* [`diameter`](@ref diameter(::LazySet, ::Real=Inf))
* [`eltype`](@ref eltype(::Type{<:LazySet}))
* [`eltype`](@ref eltype(::LazySet))
* [`high`](@ref high(::LazySet))
* [`high`](@ref high(::LazySet, ::Int))
* [`isoperation`](@ref isoperation(::LazySet))
* [`ispolyhedral`](@ref ispolyhedral(::LazySet))
* [`low`](@ref low(::LazySet))
* [`low`](@ref low(::LazySet, ::Int))
* [`norm`](@ref norm(::LazySet, ::Real=Inf))
* [`radius`](@ref radius(::LazySet, ::Real=Inf))
* [`rationalize`](@ref rationalize(::LazySet))
* [`rectify`](@ref rectify(::LazySet))
* [`reflect`](@ref reflect(::LazySet))
* [`singleton_list`](@ref singleton_list(::LazySet))
* [`surface`](@ref surface(::LazySet))
* [`triangulate`](@ref triangulate(::LazySet))
* [`vertices`](@ref vertices(::LazySet))
* [`affine_map`](@ref affine_map(::AbstractMatrix, ::LazySet, ::AbstractVector))
* [`exponential_map`](@ref exponential_map(::AbstractMatrix, ::LazySet))
* [`is_interior_point`](@ref is_interior_point(::AbstractVector, ::LazySet))
* [`linear_map`](@ref linear_map(::AbstractMatrix, ::LazySet))
* [`project`](@ref project(::LazySet, ::AbstractVector{Int}))
* [`sample`](@ref sample(::LazySet, ::Int=1))
* [`scale`](@ref scale(::Real, ::LazySet))
* [`ρ`](@ref ρ(::AbstractVector, ::LazySet))
* [`translate`](@ref translate(::LazySet, ::AbstractVector))
* [`cartesian_product`](@ref cartesian_product(::LazySet, ::LazySet))
* [`convex_hull`](@ref convex_hull(::LazySet, ::LazySet))
* [`exact_sum`](@ref exact_sum(::LazySet, ::LazySet))
* [``](@ref ≈(::LazySet, ::LazySet))
* [`isdisjoint`](@ref isdisjoint(::LazySet, ::LazySet))
* [`==`](@ref ==(::LazySet, ::LazySet))
* [`isequivalent`](@ref isequivalent(::LazySet, ::LazySet))
* [``](@ref ⊂(::LazySet, ::LazySet))
* [``](@ref ⊆(::LazySet, ::LazySet))
* [`minkowski_difference`](@ref minkowski_difference(::LazySet, ::LazySet))
* [`minkowski_sum`](@ref minkowski_sum(::LazySet, ::LazySet))

Inherited from [`ConvexSet`](@ref):
* [`isconvextype`](@ref isconvextype(::Type{ConvexSet}))
* [`linear_combination`](@ref linear_combination(::ConvexSet, ::ConvexSet))

## Implementations

* [Euclidean-norm ball (Ball2)](@ref def_Ball2)
Expand Down
106 changes: 10 additions & 96 deletions src/Interfaces/AbstractCentrallySymmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,52 +22,24 @@ julia> subtypes(AbstractCentrallySymmetric)
"""
abstract type AbstractCentrallySymmetric{N} <: ConvexSet{N} end

"""
dim(S::AbstractCentrallySymmetric)
Return the ambient dimension of a centrally symmetric set.
### Input
- `S` -- centrally symmetric set
### Output
The ambient dimension of the set.
"""
@inline function dim(S::AbstractCentrallySymmetric)
return length(center(S))
end

# a set with a unique center must be bounded
function isboundedtype(::Type{<:AbstractCentrallySymmetric})
return true
end

"""
isbounded(S::AbstractCentrallySymmetric)
Check whether a centrally symmetric set is bounded.
### Input
- `S` -- centrally symmetric set
### Output
`true` (since a set with a unique center must be bounded).
"""
# a set with a unique center must be bounded
function isbounded(::AbstractCentrallySymmetric)
return true
end

"""
an_element(S::AbstractCentrallySymmetric)
Return some element of a centrally symmetric set.
### Input
# Extended help
- `S` -- centrally symmetric set
an_element(S::AbstractCentrallySymmetric)
### Output
Expand All @@ -77,41 +49,17 @@ function an_element(S::AbstractCentrallySymmetric)
return center(S)
end

"""
isempty(S::AbstractCentrallySymmetric)
Check whether a centrally symmetric set is empty.
### Input
- `S` -- centrally symmetric set
### Output
`false`.
"""
function isempty(::AbstractCentrallySymmetric)
return false
end

"""
isuniversal(S::AbstractCentrallySymmetric, [witness]::Bool=false)
# Extended help
Check whether a centrally symmetric set is universal.
### Input
- `S` -- centrally symmetric set
- `witness` -- (optional, default: `false`) compute a witness if activated
### Output
* If `witness` option is deactivated: `false`
* If `witness` option is activated: `(false, v)` where ``v ∉ S``
isuniversal(S::AbstractCentrallySymmetric, [witness]::Bool=false)
### Algorithm
Centrally symmetric sets are bounded.
A witness is obtained by computing the support vector in direction
`d = [1, 0, …, 0]` and adding `d` on top.
"""
Expand All @@ -126,37 +74,14 @@ function isuniversal(S::AbstractCentrallySymmetric, witness::Bool=false)
end
end

"""
center(H::AbstractCentrallySymmetric, i::Int)
Return the center of a centrally symmetric set along a given dimension.
### Input
- `S` -- centrally symmetric set
- `i` -- dimension of interest
### Output
The center along the given dimension.
"""
@inline function center(S::AbstractCentrallySymmetric, i::Int)
return center(S)[i]
end

"""
extrema(S::AbstractCentrallySymmetric)
Return two vectors with the lowest and highest coordinate of a centrally
symmetric set.
### Input
- `S` -- centrally symmetric set
# Extended help
### Output
Two vectors with the lowest and highest coordinates of `S`.
extrema(S::AbstractCentrallySymmetric)
### Notes
Expand All @@ -176,20 +101,9 @@ function extrema(S::AbstractCentrallySymmetric)
end

"""
extrema(S::AbstractCentrallySymmetric, i::Int)
Return the lower and higher coordinate of a centrally symmetric set in a given
dimension.
### Input
- `S` -- centrally symmetric set
- `i` -- dimension of interest
# Extended help
### Output
The lower and higher coordinate of the centrally symmetric set in the given
dimension.
extrema(S::AbstractCentrallySymmetric, i::Int)
### Notes
Expand Down

0 comments on commit 35d8b5a

Please sign in to comment.