Skip to content

Commit

Permalink
Merge pull request #3558 from JuliaReach/schillic/Singleton
Browse files Browse the repository at this point in the history
Outsource `Singleton` to its own module
  • Loading branch information
schillic committed Jul 9, 2024
2 parents 96097b8 + c27a595 commit f951c92
Show file tree
Hide file tree
Showing 16 changed files with 313 additions and 225 deletions.
89 changes: 73 additions & 16 deletions docs/src/lib/sets/Singleton.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,111 @@
```@meta
CurrentModule = LazySets
CurrentModule = LazySets.SingletonModule
```

# [Singleton](@id def_Singleton)

```@docs
Singleton
rand(::Type{Singleton})
```

## Operations

```@docs
element(::Singleton)
translate!(::Singleton, ::AbstractVector)
rand(::Type{Singleton})
rectify(S::Singleton)
project(::Singleton, ::AbstractVector{Int})
permute(::Singleton, ::AbstractVector{Int})
singleton_list(::Singleton)
linear_map(::AbstractMatrix, ::Singleton)
permute(::Singleton, ::AbstractVector{Int})
project(::Singleton, ::AbstractVector{Int})
translate!(::Singleton, ::AbstractVector)
```

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

* [`isoperationtype`](@ref isoperationtype(::Type{LazySet}))
* [`scale!`](@ref scale!(::Real, ::LazySet))

```@meta
CurrentModule = LazySets
```

Inherited from [`LazySet`](@ref):
* [`complement`](@ref complement(::LazySet))
* [`concretize`](@ref concretize(::LazySet))
* [`constraints`](@ref constraints(::LazySet))
* [`convex_hull`](@ref convex_hull(::LazySet))
* [`diameter`](@ref diameter(::LazySet, ::Real))
* [`eltype`](@ref eltype(::Type{<:LazySet}))
* [`eltype`](@ref eltype(::LazySet))
* [`isoperation`](@ref isoperation(::LazySet))
* [`surface`](@ref surface(::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))
* [`sample`](@ref sample(::LazySet))
* [`scale`](@ref scale(::Real, ::LazySet))
* [`translate`](@ref translate(::LazySet, ::AbstractVector))
* [``](@ref ≈(::LazySet, ::LazySet))
* [`==`](@ref ==(::LazySet, ::LazySet))
* [``](@ref ⊂(::LazySet, ::LazySet))

Inherited from [`ConvexSet`](@ref):
* [`linear_combination`](@ref linear_combination(::ConvexSet, ::ConvexSet))

Inherited from [`AbstractPolyhedron`](@ref):
* [`is_polyhedral`](@ref is_polyhedral(::AbstractPolyhedron))

Inherited from [`AbstractPolytope`](@ref):
* [`isbounded`](@ref isbounded(::AbstractPolytope))
* [`isuniversal`](@ref isuniversal(::AbstractPolytope{N}, ::Bool=false) where {N})
* [`isboundedtype`](@ref isboundedtype(::Type{AbstractPolytope}))

Inherited from [`AbstractCentrallySymmetricPolytope`](@ref):
* [`an_element`](@ref an_element(::AbstractCentrallySymmetricPolytope))
* [`dim`](@ref dim(::AbstractCentrallySymmetricPolytope))
* [`isempty`](@ref isempty(::AbstractCentrallySymmetricPolytope))
* [`an_element`](@ref an_element(::AbstractCentrallySymmetricPolytope))
* [`isuniversal`](@ref isuniversal(::AbstractCentrallySymmetricPolytope))

Inherited from [`AbstractZonotope`](@ref):
* [`order`](@ref order(::AbstractZonotope))
* [`togrep`](@ref togrep(::AbstractZonotope))

Inherited from [`AbstractHyperrectangle`](@ref):
* [`area`](@ref area(::AbstractHyperrectangle))
* [`extrema`](@ref extrema(::AbstractHyperrectangle))
* [`extrema`](@ref extrema(::AbstractHyperrectangle, ::Int))
* [`norm`](@ref norm(::AbstractHyperrectangle, ::Real))
* [`radius`](@ref radius(::AbstractHyperrectangle, ::Real))
* [`constraints_list`](@ref constraints_list(::AbstractHyperrectangle{N}) where {N})
* [`volume`](@ref volume(::AbstractHyperrectangle))
* [`difference`](@ref difference(::AbstractHyperrectangle, ::AbstractHyperrectangle))

Inherited from [`AbstractSingleton`](@ref):
* [`σ`](@ref σ(::AbstractVector, ::AbstractSingleton))
* [`ρ`](@ref σ(::AbstractVector, ::AbstractSingleton))
* [``](@ref ∈(::AbstractVector, ::AbstractSingleton))
* [`center`](@ref center(::AbstractSingleton))
* [`vertices`](@ref vertices(::AbstractSingleton{N}) where {N})
* [`vertices_list`](@ref vertices_list(::AbstractSingleton))
* [`radius_hyperrectangle`](@ref radius_hyperrectangle(::AbstractSingleton{N}) where {N})
* [`radius_hyperrectangle`](@ref radius_hyperrectangle(::AbstractSingleton{N}, ::Int) where {N})
* [`center`](@ref center(::AbstractSingleton, ::Int))
* [`constraints_list`](@ref constraints_list(::AbstractSingleton))
* [`generators`](@ref generators(::AbstractSingleton{N}) where {N})
* [`genmat`](@ref genmat(::AbstractSingleton{N}) where {N})
* [`ngens`](@ref ngens(::AbstractSingleton))
* [`high`](@ref high(::AbstractSingleton))
* [`high`](@ref high(::AbstractSingleton, ::Int))
* [`isboundedtype`](@ref isboundedtype(::Type{AbstractSingleton}))
* [`low`](@ref low(::AbstractSingleton))
* [`low`](@ref low(::AbstractSingleton, ::Int))
* [`ngens`](@ref ngens(::AbstractSingleton))
* [`radius_hyperrectangle`](@ref radius_hyperrectangle(::AbstractSingleton{N}) where {N})
* [`radius_hyperrectangle`](@ref radius_hyperrectangle(::AbstractSingleton{N}, ::Int) where {N})
* [`reflect`](@ref reflect(::AbstractSingleton))
* [`vertices`](@ref vertices(::AbstractSingleton{N}) where {N})
* [`vertices_list`](@ref vertices_list(::AbstractSingleton))
* [``](@ref ∈(::AbstractVector, ::AbstractSingleton))
* [`ρ`](@ref σ(::AbstractVector, ::AbstractSingleton))
* [`σ`](@ref σ(::AbstractVector, ::AbstractSingleton))
* [`cartesian_product`](@ref cartesian_product(::AbstractSingleton, ::AbstractSingleton))
* [`distance`](@ref distance(::AbstractSingleton, ::AbstractSingleton))
* [`intersection`](@ref intersection(::AbstractSingleton, ::AbstractSingleton))
* [`isdisjoint`](@ref isdisjoint(::AbstractSingleton, ::AbstractSingleton))
* [`isequivalent`](@ref isequivalent(::AbstractSingleton, ::AbstractSingleton))
* [``](@ref ⊆(::AbstractSingleton, ::AbstractSingleton))
* [`minkowski_difference`](@ref minkowski_difference(::AbstractSingleton, ::AbstractSingleton))
* [`minkowski_sum`](@ref minkowski_sum(::AbstractSingleton, ::AbstractSingleton))
4 changes: 3 additions & 1 deletion src/LazySets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ include("Sets/Line2D.jl")
include("Sets/Line.jl")
include("Sets/Polygon.jl")
include("Sets/RotatedHyperrectangle.jl")
include("Sets/Singleton.jl")

include("Sets/Singleton/SingletonModule.jl")
@reexport using ..SingletonModule: Singleton

include("Sets/LineSegment/LineSegmentModule.jl")
@reexport using ..LineSegmentModule: LineSegment
Expand Down
208 changes: 0 additions & 208 deletions src/Sets/Singleton.jl

This file was deleted.

26 changes: 26 additions & 0 deletions src/Sets/Singleton/Singleton.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
Singleton{N, VN<:AbstractVector{N}} <: AbstractSingleton{N}
Type that represents a singleton, that is, a set with a single element.
### Fields
- `element` -- the only element of the set
### Examples
```jldoctest
julia> Singleton([1.0, 2.0])
Singleton{Float64, Vector{Float64}}([1.0, 2.0])
julia> Singleton(1.0, 2.0) # convenience constructor from numbers
Singleton{Float64, Vector{Float64}}([1.0, 2.0])
```
"""
struct Singleton{N,VN<:AbstractVector{N}} <: AbstractSingleton{N}
element::VN
end

function Singleton(args::Real...)
return Singleton(collect(args))
end
Loading

0 comments on commit f951c92

Please sign in to comment.