Skip to content

Commit

Permalink
Merge pull request #3682 from JuliaReach/schillic/N
Browse files Browse the repository at this point in the history
Remove type parameter from signatures
  • Loading branch information
schillic authored Dec 19, 2024
2 parents f55268b + 4f23458 commit b194b8b
Show file tree
Hide file tree
Showing 26 changed files with 75 additions and 67 deletions.
2 changes: 1 addition & 1 deletion docs/src/lib/interfaces/AbstractCentrallySymmetric.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extrema(::AbstractCentrallySymmetric)
extrema(::AbstractCentrallySymmetric, ::Int)
isbounded(::AbstractCentrallySymmetric)
isempty(::AbstractCentrallySymmetric)
isuniversal(::AbstractCentrallySymmetric{N}, ::Bool=false) where {N}
isuniversal(::AbstractCentrallySymmetric, ::Bool=false)
```

## Implementations
Expand Down
2 changes: 1 addition & 1 deletion docs/src/lib/interfaces/AbstractHyperrectangle.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This interface defines the following functions:

```@docs
□(c, r)
constraints_list(::AbstractHyperrectangle{N}) where {N}
constraints_list(::AbstractHyperrectangle)
extrema(::AbstractHyperrectangle)
extrema(::AbstractHyperrectangle, ::Int)
generators(::AbstractHyperrectangle)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/lib/interfaces/AbstractPolytope.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ This interface defines the following functions:
```@docs
isbounded(::AbstractPolytope)
isempty(::AbstractPolytope)
isuniversal(::AbstractPolytope{N}, ::Bool=false) where {N}
isuniversal(::AbstractPolytope, ::Bool=false)
volume(::AbstractPolytope)
```

Expand Down
10 changes: 5 additions & 5 deletions docs/src/lib/interfaces/AbstractSingleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ This interface defines the following functions:
center(::AbstractSingleton)
center(::AbstractSingleton, ::Int)
element(::AbstractSingleton, ::Int)
generators(::AbstractSingleton{N}) where {N}
genmat(::AbstractSingleton{N}) where {N}
generators(::AbstractSingleton)
genmat(::AbstractSingleton)
high(::AbstractSingleton)
high(::AbstractSingleton, ::Int)
low(::AbstractSingleton)
low(::AbstractSingleton, ::Int)
ngens(::AbstractSingleton)
radius_hyperrectangle(::AbstractSingleton{N}) where {N}
radius_hyperrectangle(::AbstractSingleton{N}, ::Int) where {N}
radius_hyperrectangle(::AbstractSingleton)
radius_hyperrectangle(::AbstractSingleton, ::Int)
reflect(::AbstractSingleton)
vertices(::AbstractSingleton{N}) where {N}
vertices(::AbstractSingleton)
vertices_list(::AbstractSingleton)
∈(::AbstractVector, ::AbstractSingleton)
ρ(::AbstractVector, ::AbstractSingleton)
Expand Down
4 changes: 2 additions & 2 deletions docs/src/lib/sets/Ball2.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ sample(::LazySet, ::Int)
CurrentModule = LazySets.Ball2Module
```
```@docs
sample(::Ball2{N}, ::Int) where {N}
sample(::Ball2, ::Int)
```
```@meta
CurrentModule = LazySets.API
Expand Down Expand Up @@ -187,7 +187,7 @@ CurrentModule = LazySets.API
CurrentModule = LazySets
```
* [`isempty`](@ref isempty(::AbstractCentrallySymmetric))
* [`isuniversal`](@ref isuniversal(::AbstractCentrallySymmetric{N}, ::Bool=false) where {N})
* [`isuniversal`](@ref isuniversal(::AbstractCentrallySymmetric, ::Bool=false))

Inherited from [`AbstractBallp`](@ref):
* [`high`](@ref high(::AbstractBallp, ::Int))
Expand Down
4 changes: 2 additions & 2 deletions docs/src/lib/sets/BallInf.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Inherited from [`AbstractCentrallySymmetricPolytope`](@ref):
* [`center`](@ref center(::LazySet, ::Int))
* [`dim`](@ref dim(::AbstractCentrallySymmetricPolytope))
* [`isempty`](@ref isempty(::AbstractCentrallySymmetricPolytope))
* [`isuniversal`](@ref isuniversal(::AbstractPolytope{N}, ::Bool=false) where {N})
* [`isuniversal`](@ref isuniversal(::AbstractPolytope, ::Bool=false))

Inherited from [`AbstractZonotope`](@ref):
* [`order`](@ref order(::AbstractZonotope))
Expand All @@ -163,7 +163,7 @@ CurrentModule = LazySets.API
```@meta
CurrentModule = LazySets
```
* [`constraints_list`](@ref constraints_list(::AbstractHyperrectangle{N}) where {N})
* [`constraints_list`](@ref constraints_list(::AbstractHyperrectangle))
* [`extrema`](@ref extrema(::AbstractHyperrectangle))
* [`extrema`](@ref extrema(::AbstractHyperrectangle, ::Int))
* [`generators`](@ref generators(::AbstractHyperrectangle))
Expand Down
2 changes: 1 addition & 1 deletion docs/src/lib/sets/Ballp.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Inherited from [`AbstractCentrallySymmetric`](@ref):
* [`isboundedtype`](@ref isboundedtype(::Type{AbstractCentrallySymmetric}))
* [`isconvextype`](@ref isconvextype(::Type{AbstractCentrallySymmetric}))
* [`isempty`](@ref isempty(::AbstractCentrallySymmetric))
* [`isuniversal`](@ref isuniversal(::AbstractCentrallySymmetric{N}, ::Bool=false) where {N})
* [`isuniversal`](@ref isuniversal(::AbstractCentrallySymmetric, ::Bool=false))

Inherited from [`AbstractBallp`](@ref):
* [`low`](@ref low(::AbstractBallp, ::Int))
Expand Down
2 changes: 1 addition & 1 deletion docs/src/lib/sets/Ellipsoid.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ CurrentModule = LazySets.API
CurrentModule = LazySets
```
* [`isempty`](@ref isempty(::AbstractCentrallySymmetric))
* [`isuniversal`](@ref isuniversal(::AbstractCentrallySymmetric{N}, ::Bool=false) where {N})
* [`isuniversal`](@ref isuniversal(::AbstractCentrallySymmetric, ::Bool=false))
2 changes: 1 addition & 1 deletion docs/src/lib/sets/HParallelotope.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Inherited from [`AbstractCentrallySymmetricPolytope`](@ref):
* [`an_element`](@ref an_element(::AbstractCentrallySymmetricPolytope))
* [`extrema`](@ref extrema(::AbstractCentrallySymmetricPolytope))
* [`extrema`](@ref extrema(::AbstractCentrallySymmetricPolytope, ::Int))
* [`isuniversal`](@ref isuniversal(::AbstractCentrallySymmetricPolytope, ::Bool=false))
* [`isuniversal`](@ref isuniversal(::AbstractPolytope, ::Bool=false))

Inherited from [`AbstractZonotope`](@ref):
* [`isempty`](@ref isempty(::AbstractZonotope))
Expand Down
2 changes: 1 addition & 1 deletion docs/src/lib/sets/HPolygon.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Inherited from [`LazySet`](@ref):

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

Inherited from [`AbstractPolygon`](@ref):
* [`dim`](@ref dim(::AbstractPolygon))
Expand Down
2 changes: 1 addition & 1 deletion docs/src/lib/sets/HPolygonOpt.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Inherited from [`LazySet`](@ref):

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

Inherited from [`AbstractPolygon`](@ref):
* [`dim`](@ref dim(::AbstractPolygon))
Expand Down
2 changes: 1 addition & 1 deletion docs/src/lib/sets/HPolytope.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ CurrentModule = LazySets
```

Inherited from [`AbstractPolytope`](@ref):
* [`isuniversal`](@ref isuniversal(::AbstractPolytope{N}, ::Bool=false) where {N})
* [`isuniversal`](@ref isuniversal(::AbstractPolytope, ::Bool=false))
* [`volume`](@ref volume(::AbstractPolytope))
2 changes: 1 addition & 1 deletion docs/src/lib/sets/Hyperrectangle.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Inherited from [`AbstractZonotope`](@ref):
* [`linear_map`](@ref linear_map(::AbstractMatrix, ::AbstractZonotope))

Inherited from [`AbstractHyperrectangle`](@ref):
* [`constraints_list`](@ref constraints_list(::AbstractHyperrectangle{N}) where {N})
* [`constraints_list`](@ref constraints_list(::AbstractHyperrectangle))
* [`extrema`](@ref extrema(::AbstractHyperrectangle))
* [`extrema`](@ref extrema(::AbstractHyperrectangle, ::Int))
* [`generators`](@ref generators(::AbstractHyperrectangle))
Expand Down
10 changes: 5 additions & 5 deletions docs/src/lib/sets/Singleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,18 @@ Inherited from [`AbstractSingleton`](@ref):
* [`center`](@ref center(::AbstractSingleton))
* [`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})
* [`generators`](@ref generators(::AbstractSingleton))
* [`genmat`](@ref genmat(::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})
* [`radius_hyperrectangle`](@ref radius_hyperrectangle(::AbstractSingleton))
* [`radius_hyperrectangle`](@ref radius_hyperrectangle(::AbstractSingleton, ::Int))
* [`reflect`](@ref reflect(::AbstractSingleton))
* [`vertices`](@ref vertices(::AbstractSingleton{N}) where {N})
* [`vertices`](@ref vertices(::AbstractSingleton))
* [`vertices_list`](@ref vertices_list(::AbstractSingleton))
* [``](@ref ∈(::AbstractVector, ::AbstractSingleton))
* [`ρ`](@ref σ(::AbstractVector, ::AbstractSingleton))
Expand Down
2 changes: 1 addition & 1 deletion docs/src/lib/sets/Universe.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ an_element(::LazySet)
CurrentModule = LazySets.UniverseModule
```
```@docs
an_element(::Universe{N}) where {N}
an_element(::Universe)
constrained_dimensions(::Universe)
```
```@meta
Expand Down
2 changes: 1 addition & 1 deletion docs/src/lib/sets/VPolygon.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Inherited from [`LazySet`](@ref):
Inherited from [`AbstractPolytope`](@ref):
* [`isbounded`](@ref isbounded(::AbstractPolytope))
* [`isempty`](@ref isempty(::AbstractPolytope))
* [`isuniversal`](@ref isuniversal(::AbstractPolytope{N}, ::Bool=false) where {N})
* [`isuniversal`](@ref isuniversal(::AbstractPolytope, ::Bool=false))

Inherited from [`AbstractPolygon`](@ref):
* [`dim`](@ref dim(::AbstractPolygon))
Expand Down
2 changes: 1 addition & 1 deletion docs/src/lib/sets/VPolytope.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ Inherited from [`AbstractPolyhedron`](@ref):
Inherited from [`AbstractPolytope`](@ref):
* [`isbounded`](@ref isbounded(::AbstractPolytope))
* [`isempty`](@ref isempty(::AbstractPolytope))
* [`isuniversal`](@ref isuniversal(::AbstractPolytope{N}, ::Bool=false) where {N})
* [`isuniversal`](@ref isuniversal(::AbstractPolytope, ::Bool=false))
* [`volume`](@ref volume(::AbstractPolytope))
14 changes: 7 additions & 7 deletions docs/src/lib/sets/ZeroSet.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ ZeroSet
## Operations

```@docs
element(::ZeroSet{N}) where {N}
element(::ZeroSet{N}, ::Int) where {N}
element(::ZeroSet)
element(::ZeroSet, ::Int)
```
```@meta
CurrentModule = LazySets.API
Expand Down Expand Up @@ -99,17 +99,17 @@ Inherited from [`AbstractSingleton`](@ref):
* [`center`](@ref center(::AbstractSingleton))
* [`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})
* [`generators`](@ref generators(::AbstractSingleton))
* [`genmat`](@ref genmat(::AbstractSingleton))
* [`high`](@ref high(::AbstractSingleton))
* [`high`](@ref high(::AbstractSingleton, ::Int))
* [`isconvextype`](@ref isconvextype(::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})
* [`vertices`](@ref vertices(::AbstractSingleton{N}) where {N})
* [`radius_hyperrectangle`](@ref radius_hyperrectangle(::AbstractSingleton))
* [`radius_hyperrectangle`](@ref radius_hyperrectangle(::AbstractSingleton, ::Int))
* [`vertices`](@ref vertices(::AbstractSingleton))
* [`vertices`](@ref vertices(::AbstractSingleton))
* [`vertices_list`](@ref vertices_list(::AbstractSingleton))
* [`σ`](@ref σ(::AbstractVector, ::AbstractSingleton))
Expand Down
2 changes: 1 addition & 1 deletion docs/src/lib/sets/Zonotope.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Inherited from [`LazySet`](@ref):

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

Inherited from [`AbstractCentrallySymmetricPolytope`](@ref):
Expand Down
7 changes: 3 additions & 4 deletions src/Interfaces/AbstractCentrallySymmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ function isempty(::AbstractCentrallySymmetric)
end

"""
isuniversal(S::AbstractCentrallySymmetric{N},
[witness]::Bool=false) where {N}
isuniversal(S::AbstractCentrallySymmetric, [witness]::Bool=false)
Check whether a centrally symmetric set is universal.
Expand All @@ -120,9 +119,9 @@ 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.
"""
function isuniversal(S::AbstractCentrallySymmetric{N},
witness::Bool=false) where {N}
function isuniversal(S::AbstractCentrallySymmetric, witness::Bool=false)
if witness
N = eltype(S)
d = SingleEntryVector{N}(1, dim(S))
w = σ(d, S) + d
return (false, w)
Expand Down
4 changes: 2 additions & 2 deletions src/Interfaces/AbstractHyperrectangle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ function vertices_list(H::AbstractHyperrectangle; kwargs...)
end

"""
constraints_list(H::AbstractHyperrectangle{N}) where {N}
constraints_list(H::AbstractHyperrectangle)
Return the list of constraints of a hyperrectangular set.
Expand All @@ -295,7 +295,7 @@ Return the list of constraints of a hyperrectangular set.
A list of ``2n`` linear constraints, where ``n`` is the dimension of `H`.
"""
function constraints_list(H::AbstractHyperrectangle{N}) where {N}
function constraints_list(H::AbstractHyperrectangle)
return _constraints_list_hyperrectangle(H)
end

Expand Down
5 changes: 3 additions & 2 deletions src/Interfaces/AbstractPolytope.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function isempty(P::AbstractPolytope)
end

"""
isuniversal(P::AbstractPolytope{N}, [witness]::Bool=false) where {N}
isuniversal(P::AbstractPolytope, [witness]::Bool=false)
Check whether a polytopic set is universal.
Expand All @@ -96,10 +96,11 @@ Check whether a polytopic set is universal.
A witness is produced using `isuniversal(H)` where `H` is the first linear
constraint of `P`.
"""
function isuniversal(P::AbstractPolytope{N}, witness::Bool=false) where {N}
function isuniversal(P::AbstractPolytope, witness::Bool=false)
if witness
constraints = constraints_list(P)
if isempty(constraints)
N = eltype(P)
return (true, N[]) # special case for polytopes without constraints
end
return isuniversal(constraints[1], true)
Expand Down
24 changes: 14 additions & 10 deletions src/Interfaces/AbstractSingleton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function element(S::AbstractSingleton, i::Int)
end

"""
radius_hyperrectangle(S::AbstractSingleton{N}, i::Int) where {N}
radius_hyperrectangle(S::AbstractSingleton, i::Int)
Return the box radius of a set with a single value in a given dimension.
Expand All @@ -76,13 +76,14 @@ Return the box radius of a set with a single value in a given dimension.
Zero.
"""
function radius_hyperrectangle(S::AbstractSingleton{N}, i::Int) where {N}
function radius_hyperrectangle(S::AbstractSingleton, i::Int)
@boundscheck _check_bounds(S, i)
N = eltype(S)
return zero(N)
end

"""
radius_hyperrectangle(S::AbstractSingleton{N}) where {N}
radius_hyperrectangle(S::AbstractSingleton)
Return the box radius of a set with a single value in every dimension.
Expand All @@ -94,7 +95,8 @@ Return the box radius of a set with a single value in every dimension.
The zero vector.
"""
function radius_hyperrectangle(S::AbstractSingleton{N}) where {N}
function radius_hyperrectangle(S::AbstractSingleton)
N = eltype(S)
return zeros(N, dim(S))
end

Expand Down Expand Up @@ -173,7 +175,7 @@ function low(S::AbstractSingleton, i::Int)
end

"""
genmat(S::AbstractSingleton{N}) where {N}
genmat(S::AbstractSingleton)
Return the (empty) generator matrix of a set with a single value.
Expand All @@ -185,12 +187,13 @@ Return the (empty) generator matrix of a set with a single value.
A matrix with no columns representing the generators of `S`.
"""
function genmat(S::AbstractSingleton{N}) where {N}
function genmat(S::AbstractSingleton)
N = eltype(S)
return Matrix{N}(undef, dim(S), 0)
end

"""
generators(S::AbstractSingleton{N}) where {N}
generators(S::AbstractSingleton)
Return an (empty) iterator over the generators of a set with a single value.
Expand All @@ -202,7 +205,8 @@ Return an (empty) iterator over the generators of a set with a single value.
An empty iterator.
"""
function generators(S::AbstractSingleton{N}) where {N}
function generators(S::AbstractSingleton)
N = eltype(S)
return EmptyIterator{Vector{N}}()
end

Expand Down Expand Up @@ -260,7 +264,7 @@ function center(S::AbstractSingleton, i::Int)
end

"""
vertices(S::AbstractSingleton{N}) where {N}
vertices(S::AbstractSingleton)
Construct an iterator over the vertices of a set with a single value.
Expand All @@ -272,7 +276,7 @@ Construct an iterator over the vertices of a set with a single value.
An iterator with a single value.
"""
function vertices(S::AbstractSingleton{N}) where {N}
function vertices(S::AbstractSingleton)
return SingletonIterator(element(S))
end

Expand Down
Loading

0 comments on commit b194b8b

Please sign in to comment.