Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HParallelotope: revise docs entries, shorten docs, shorten signature #3695

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 117 additions & 12 deletions docs/src/lib/sets/HParallelotope.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,54 +11,159 @@ HParallelotope
## Conversion

```@docs
convert(::Type{HParallelotope}, Z::AbstractZonotope{N}) where {N}
convert(::Type{HParallelotope}, Z::AbstractZonotope)
```

## Operations

```@docs
base_vertex(::HParallelotope)
```
```@meta
CurrentModule = LazySets.API
```
```@docs; canonical=false
center(::LazySet)
```
```@meta
CurrentModule = LazySets.HParallelotopeModule
```
```@docs
center(::HParallelotope)
constraints_list(::HParallelotope)
dim(::HParallelotope)
directions(::HParallelotope)
extremal_vertices(::HParallelotope{N, VN}) where {N, VN}
generators(::HParallelotope)
```
```@meta
CurrentModule = LazySets
```
```@docs; canonical=false
genmat(::AbstractZonotope)
```
```@meta
CurrentModule = LazySets.HParallelotopeModule
```
```@docs
genmat(::HParallelotope)
offset(::HParallelotope)
```
```@meta
CurrentModule = LazySets.API
```
```@docs; canonical=false
rand(::Type{LazySet})
```
```@meta
CurrentModule = LazySets.HParallelotopeModule
```
```@docs
rand(::Type{HParallelotope})
```
```@meta
CurrentModule = LazySets.API
```
```@docs; canonical=false
volume(::LazySet)
```
```@meta
CurrentModule = LazySets.HParallelotopeModule
```
```@docs
volume(::HParallelotope)
```

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

Undocumented implementations:
* [`constraints_list`](@ref constraints_list(::LazySet))
* [`dim`](@ref dim(::LazySet))
```@meta
CurrentModule = LazySets
```
* [`generators`](@ref generators(::AbstractZonotope))
```@meta
CurrentModule = LazySets.API
```
* [`isoperationtype`](@ref isoperationtype(::Type{LazySet}))

```@meta
CurrentModule = LazySets
```

Inherited from [`LazySet`](@ref):
* [`diameter`](@ref diameter(::LazySet, ::Real))
* [`high`](@ref high(::LazySet))
* [`low`](@ref low(::LazySet))
* [`norm`](@ref norm(::LazySet, ::Real))
* [`radius`](@ref radius(::LazySet, ::Real))
* [`area`](@ref area(::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))
* [`isoperation`](@ref isoperation(::LazySet))
* [`norm`](@ref norm(::LazySet, ::Real=Inf))
* [`radius`](@ref radius(::LazySet, ::Real=Inf))
* [`rectify`](@ref rectify(::LazySet))
* [`singleton_list`](@ref singleton_list(::LazySet))
* [`surface`](@ref surface(::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))
* [`sample`](@ref sample(::LazySet, ::Int=1))
* [`scale`](@ref scale(::Real, ::LazySet))
* [`scale!`](@ref scale!(::Real, ::LazySet))
* [`translate`](@ref translate(::LazySet, ::AbstractVector))
* [`translate!`](@ref translate!(::LazySet, ::AbstractVector))
* [`convex_hull`](@ref convex_hull(::LazySet, ::LazySet))
* [`exact_sum`](@ref exact_sum(::LazySet, ::LazySet))
* [`≈`](@ref ≈(::LazySet, ::LazySet))
* [`==`](@ref ==(::LazySet, ::LazySet))
* [`isequivalent`](@ref isequivalent(::LazySet, ::LazySet))
* [`⊂`](@ref ⊂(::LazySet, ::LazySet))

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

Inherited from [`AbstractPolyhedron`](@ref):
* [`high`](@ref high(::AbstractPolyhedron))
* [`high`](@ref high(::AbstractPolyhedron, ::Int))
* [`ispolyhedral`](@ref ispolyhedral(::AbstractPolyhedron))
* [`low`](@ref low(::AbstractPolyhedron))
* [`low`](@ref low(::AbstractPolyhedron, ::Int))
* [`intersection`](@ref intersection(::AbstractPolyhedron, ::AbstractPolyhedron))

Inherited from [`AbstractPolytope`](@ref):
* [`isbounded`](@ref isbounded(::AbstractPolytope))
* [`isboundedtype`](@ref isboundedtype(::Type{AbstractPolytope}))
* [`isconvextype`](@ref isconvextype(::Type{AbstractPolytope}))

Inherited from [`AbstractCentrallySymmetricPolytope`](@ref):
* [`an_element`](@ref an_element(::AbstractCentrallySymmetricPolytope))
* [`center`](@ref center(::AbstractCentrallySymmetricPolytope, ::Int))
* [`extrema`](@ref extrema(::AbstractCentrallySymmetricPolytope))
* [`extrema`](@ref extrema(::AbstractCentrallySymmetricPolytope, ::Int))
* [`isuniversal`](@ref isuniversal(::AbstractPolytope, ::Bool=false))
* [`isempty`](@ref isempty(::AbstractCentrallySymmetricPolytope))
* [`isuniversal`](@ref isuniversal(::AbstractCentrallySymmetricPolytope, ::Bool=false))

Inherited from [`AbstractZonotope`](@ref):
* [`isempty`](@ref isempty(::AbstractZonotope))
* [`ngens`](@ref ngens(::AbstractZonotope))
* [`order`](@ref order(::AbstractZonotope))
* [`reflect`](@ref reflect(::AbstractZonotope))
* [`remove_redundant_generators`](@ref remove_redundant_generators(::AbstractZonotope))
* [`togrep`](@ref togrep(::AbstractZonotope))
* [`vertices_list`](@ref vertices_list(::AbstractZonotope))
* [`linear_map`](@ref linear_map(::AbstractMatrix, ::AbstractZonotope))
* [`∈`](@ref ∈(::AbstractVector, ::AbstractZonotope))
* [`project`](@ref project(::AbstractZonotope, ::AbstractVector{Int}))
* [`reduce_order`](@ref reduce_order(::AbstractZonotope, ::Real, ::AbstractReductionMethod=GIR05()))
* [`split`](@ref split(::AbstractZonotope, ::Int))
* [`split`](@ref split(::AbstractZonotope, ::AbstractVector{Int}, ::AbstractVector{Int}))
* [`ρ`](@ref ρ(::AbstractVector, ::AbstractZonotope))
* [`σ`](@ref σ(::AbstractVector, ::AbstractZonotope))
* [`translate`](@ref translate(::AbstractZonotope, ::AbstractVector))
* [`cartesian_product`](@ref cartesian_product(::AbstractZonotope, ::AbstractZonotope))
* [`isdisjoint`](@ref isdisjoint(::AbstractZonotope, ::AbstractZonotope))
* [`⊆`](@ref ⊆(::AbstractZonotope, ::AbstractZonotope))
* [`minkowski_difference`](@ref minkowski_difference(::AbstractZonotope, ::AbstractZonotope))
* [`minkowski_sum`](@ref minkowski_sum(::AbstractZonotope, ::AbstractZonotope))
12 changes: 2 additions & 10 deletions src/Sets/HParallelotope/center.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
"""
center(P::HParallelotope)

Return the center of a parallelotope in constraint representation.

### Input
# Extended help

- `P` -- parallelotope in constraint representation

### Output

The center of the parallelotope.
center(P::HParallelotope)

### Algorithm

Expand Down
15 changes: 1 addition & 14 deletions src/Sets/HParallelotope/constraints_list.jl
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
"""
constraints_list(P::HParallelotope)

Return the list of constraints of a parallelotope in constraint representation.

### Input

- `P` -- parallelotope in constraint representation

### Output

The list of constraints of `P`.
"""
function constraints_list(P::HParallelotope)
D, c = P.directions, P.offset
N, VN = _parameters(P)
return _constraints_list_hparallelotope(D, c, N, VN)
end

# reason: `Documenter` cannot annotate `constraints_list` with type parameters
function _parameters(P::HParallelotope{N,VN}) where {N,VN}
function _parameters(::HParallelotope{N,VN}) where {N,VN}
return (N, VN)
end

Expand Down
5 changes: 3 additions & 2 deletions src/Sets/HParallelotope/convert.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
convert(::Type{HParallelotope}, Z::AbstractZonotope{N}) where {N}
convert(::Type{HParallelotope}, Z::AbstractZonotope)

Convert a zonotopic set of order one to a parallelotope in constraint
representation.
Expand All @@ -19,10 +19,11 @@ This function requires that the list of constraints of `Z` are obtained in
the particular order returned from the `constraints_list` function of a
`Zonotope`. Hence it first converts `Z` to a `Zonotope`.
"""
function convert(::Type{HParallelotope}, Z::AbstractZonotope{N}) where {N}
function convert(::Type{HParallelotope}, Z::AbstractZonotope)
@assert order(Z) == 1 "cannot convert a zonotope that is not of order 1 " *
"to a parallelotope"
n = dim(Z)
N = eltype(Z)

constraints = _constraints_list_zonotope(Z)

Expand Down
13 changes: 0 additions & 13 deletions src/Sets/HParallelotope/dim.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
"""
dim(P::HParallelotope)

Return the dimension of a parallelotope in constraint representation.

### Input

- `P` -- parallelotope in constraint representation

### Output

The ambient dimension of the parallelotope.
"""
function dim(P::HParallelotope)
return size(P.directions, 1)
end
14 changes: 0 additions & 14 deletions src/Sets/HParallelotope/generators.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
"""
generators(P::HParallelotope)

Return an iterator over the generators of a parallelotope in constraint
representation.

### Input

- `P` -- parallelotope in constraint representation

### Output

An iterator over the generators of `P`.
"""
function generators(P::HParallelotope)
return generators_fallback(P)
end
12 changes: 2 additions & 10 deletions src/Sets/HParallelotope/genmat.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
"""
genmat(P::HParallelotope)

Return the generator matrix of a parallelotope in constraint representation.

### Input
# Extended help

- `P` -- parallelotope in constraint representation

### Output

A matrix where each column represents one generator of the parallelotope `P`.
genmat(P::HParallelotope)

### Algorithm

Expand Down
20 changes: 3 additions & 17 deletions src/Sets/HParallelotope/rand.jl
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
"""
# Extended help

rand(::Type{HParallelotope}; [N]::Type{<:Real}=Float64, [dim]::Int=2,
[rng]::AbstractRNG=GLOBAL_RNG, [seed]::Union{Int, Nothing}=nothing)

Create a random parallelotope in constraint representation.

### Input

- `HParallelotope` -- type for dispatch
- `N` -- (optional, default: `Float64`) numeric type
- `dim` -- (optional, default: 2) dimension
- `rng` -- (optional, default: `GLOBAL_RNG`) random number generator
- `seed` -- (optional, default: `nothing`) seed for reseeding

### Output

A random parallelotope.

### Notes
### Algorithm

All numbers are normally distributed with mean 0 and standard deviation 1.

### Algorithm

The directions matrix and offset vector are created randomly. On average there
is a good chance that this resulting set is empty. We then modify the offset to
ensure non-emptiness.
Expand Down
12 changes: 2 additions & 10 deletions src/Sets/HParallelotope/volume.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
"""
volume(P::HParallelotope)

Return the volume of a parallelotope in constraint representation.

### Input
# Extended help

- `P` -- parallelotope in constraint representation

### Output

The volume.
volume(P::HParallelotope)

### Algorithm

Expand Down
Loading