Skip to content

Commit

Permalink
Merge pull request #3708 from JuliaReach/schillic/spz
Browse files Browse the repository at this point in the history
`SparsePolynomialZonotope`: revise docs entries, shorten docs
  • Loading branch information
schillic authored Dec 26, 2024
2 parents 1571b8f + 0152b4b commit 2bbb7a9
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 106 deletions.
4 changes: 2 additions & 2 deletions docs/src/lib/sets/SimpleSparsePolynomialZonotope.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,5 @@ Inherited from [`AbstractPolynomialZonotope`](@ref):
* [`order`](@ref order(::AbstractPolynomialZonotope))

Inherited from [`AbstractSparsePolynomialZonotope`](@ref):
* [`ngens_dep`](@ref ngens_dep(::AbstractPolynomialZonotope))
* [`nparams`](@ref nparams(::AbstractPolynomialZonotope))
* [`ngens_dep`](@ref ngens_dep(::AbstractSparsePolynomialZonotope))
* [`nparams`](@ref nparams(::AbstractSparsePolynomialZonotope))
122 changes: 116 additions & 6 deletions docs/src/lib/sets/SparsePolynomialZonotope.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,144 @@ SparsePolynomialZonotope
## Operations

```@docs
center(::SparsePolynomialZonotope)
expmat(::SparsePolynomialZonotope)
genmat_dep(::SparsePolynomialZonotope)
genmat_indep(::SparsePolynomialZonotope)
indexvector(::SparsePolynomialZonotope)
polynomial_order(::SparsePolynomialZonotope)
rand(::Type{SparsePolynomialZonotope})
```
```@meta
CurrentModule = LazySets
```
```@docs; canonical=false
remove_redundant_generators(::AbstractZonotope)
```
```@meta
CurrentModule = LazySets.SparsePolynomialZonotopeModule
```
```@docs
remove_redundant_generators(::SparsePolynomialZonotope)
uniqueID(::Int)
linear_map(::AbstractMatrix, ::SparsePolynomialZonotope)
```
```@meta
CurrentModule = LazySets
```
```@docs; canonical=false
reduce_order(::AbstractZonotope, ::Real)
```
```@meta
CurrentModule = LazySets.SparsePolynomialZonotopeModule
```
```@docs
reduce_order(::SparsePolynomialZonotope, ::Real, ::AbstractReductionMethod=GIR05())
ρ(::AbstractVector, ::SparsePolynomialZonotope)
translate(::SparsePolynomialZonotope, ::AbstractVector)
```
```@meta
CurrentModule = LazySets.API
```
```@docs; canonical=false
cartesian_product(::LazySet, ::LazySet)
```
```@meta
CurrentModule = LazySets.SparsePolynomialZonotopeModule
```
```@docs
cartesian_product(::SparsePolynomialZonotope, ::SparsePolynomialZonotope)
```
```@meta
CurrentModule = LazySets.API
```
```@docs; canonical=false
exact_sum(::LazySet, ::LazySet)
```
```@meta
CurrentModule = LazySets.SparsePolynomialZonotopeModule
```
```@docs
exact_sum(::SparsePolynomialZonotope, ::SparsePolynomialZonotope)
```
```@meta
CurrentModule = LazySets.API
```
```@docs; canonical=false
minkowski_sum(::LazySet, ::LazySet)
```
```@meta
CurrentModule = LazySets.SparsePolynomialZonotopeModule
```
```@docs
minkowski_sum(::SparsePolynomialZonotope, ::SparsePolynomialZonotope)
```

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

Undocumented implementations:

* [`center`](@ref center(::LazySet))
* [`extrema`](@ref extrema(::LazySet))
* [`isoperationtype`](@ref isoperationtype(::Type{LazySet}))
* [`linear_map`](@ref linear_map(::AbstractMatrix, ::LazySet))
* [`translate`](@ref translate(::LazySet, ::AbstractVector))

```@meta
CurrentModule = LazySets
```

Inherited from [`LazySet`](@ref):
* [`an_element`](@ref an_element(::LazySet))
* [`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))
* [`extrema`](@ref extrema(::LazySet, ::Int))
* [`high`](@ref high(::LazySet))
* [`high`](@ref high(::LazySet, ::Int))
* [`isbounded`](@ref isbounded(::LazySet))
* [`isempty`](@ref isempty(::LazySet))
* [`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))
* [`rectify`](@ref rectify(::LazySet))
* [`reflect`](@ref reflect(::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))
* [``](@ref ∈(::AbstractVector, ::LazySet))
* [`is_interior_point`](@ref is_interior_point(::AbstractVector, ::LazySet))
* [`project`](@ref project(::LazySet, ::AbstractVector{Int}))
* [`sample`](@ref sample(::LazySet, ::Int=1))
* [`scale`](@ref scale(::Real, ::LazySet))
* [`σ`](@ref σ(::AbstractVector, ::LazySet))
* [`convex_hull`](@ref convex_hull(::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))

Inherited from [`AbstractPolynomialZonotope`](@ref):
* [`dim`](@ref dim(::AbstractPolynomialZonotope))
* [`isboundedtype`](@ref isboundedtype(::Type{AbstractPolynomialZonotope}))
* [`isconvextype`](@ref isconvextype(::Type{LazySet}))
* [`ngens`](@ref ngens(::AbstractPolynomialZonotope))
* [`order`](@ref order(::AbstractPolynomialZonotope))

Inherited from [`AbstractSparsePolynomialZonotope`](@ref):
* [`ngens_dep`](@ref ngens_dep(::AbstractPolynomialZonotope))
* [`ngens_indep`](@ref ngens_indep(::AbstractPolynomialZonotope))
* [`nparams`](@ref nparams(::AbstractPolynomialZonotope))
* [`ngens_dep`](@ref ngens_dep(::AbstractSparsePolynomialZonotope))
* [`ngens_indep`](@ref ngens_indep(::AbstractSparsePolynomialZonotope))
* [`nparams`](@ref nparams(::AbstractSparsePolynomialZonotope))
13 changes: 2 additions & 11 deletions src/Sets/SparsePolynomialZonotope/cartesian_product.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
"""
cartesian_product(P1::SparsePolynomialZonotope, P2::SparsePolynomialZonotope)
Compute the Cartesian product of two sparse polynomial zonotopes.
### Input
# Extended help
- `P1` -- sparse polynomial zonotope
- `P2` -- sparse polynomial zonotope
### Output
The Cartesian product of `P1` and `P2`.
cartesian_product(P1::SparsePolynomialZonotope, P2::SparsePolynomialZonotope)
### Algorithm
Expand Down
13 changes: 0 additions & 13 deletions src/Sets/SparsePolynomialZonotope/center.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
"""
center(P::SparsePolynomialZonotope)
Return the center of a sparse polynomial zonotope.
### Input
- `P` -- sparse polynomial zonotope
### Output
The center.
"""
center(P::SPZ) = P.c
13 changes: 2 additions & 11 deletions src/Sets/SparsePolynomialZonotope/exact_sum.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
"""
exact_sum(P1::SparsePolynomialZonotope, P2::SparsePolynomialZonotope)
Compute the exact sum of sparse polyomial zonotopes ``P₁`` and ``P₂``.
### Input
# Extended help
- `P1` -- sparse polynomial zonotope
- `P2` -- sparse polynomial zonotope
### Output
A `SparsePolynomialZonotope` representing the exact sum ``P₁ ⊞ P₂``.
exact_sum(P1::SparsePolynomialZonotope, P2::SparsePolynomialZonotope)
### Algorithm
Expand Down
14 changes: 0 additions & 14 deletions src/Sets/SparsePolynomialZonotope/linear_map.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
"""
linear_map(M::AbstractMatrix, P::SparsePolynomialZonotope)
Apply a linear map to a sparse polynomial zonotope.
### Input
- `M` -- square matrix with `size(M) == dim(P)`
- `P` -- sparse polynomial zonotope
### Output
The sparse polynomial zonotope resulting from applying the linear map.
"""
function linear_map(M::AbstractMatrix, P::SPZ)
return SparsePolynomialZonotope(M * center(P),
M * genmat_dep(P),
Expand Down
13 changes: 2 additions & 11 deletions src/Sets/SparsePolynomialZonotope/minkowski_sum.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
"""
minkowski_sum(P1::SparsePolynomialZonotope, P2::SparsePolynomialZonotope)
Compute the Minkowski sum of two sparse polyomial zonotopes.
### Input
# Extended help
- `P1` -- sparse polynomial zonotope
- `P2` -- sparse polynomial zonotope
### Output
The Minkowski sum of `P1` and `P2`.
minkowski_sum(P1::SparsePolynomialZonotope, P2::SparsePolynomialZonotope)
### Algorithm
Expand Down
16 changes: 2 additions & 14 deletions src/Sets/SparsePolynomialZonotope/reduce_order.jl
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
"""
# Extended help
reduce_order(P::SparsePolynomialZonotope, r::Real,
[method]::AbstractReductionMethod=GIR05())
Overapproximate the sparse polynomial zonotope by another sparse polynomial
zonotope with order at most `r`.
### Input
- `P` -- sparse polynomial zonotope
- `r` -- maximum order of the resulting sparse polynomial zonotope (≥ 1)
- `method` -- (optional default [`GIR05`](@ref)) algorithm used internally for
the order reduction of a (normal) zonotope
### Output
A sparse polynomial zonotope with order at most `r`.
### Notes
This method implements the algorithm described in Proposition 3.1.39 of [1].
Expand Down
12 changes: 2 additions & 10 deletions src/Sets/SparsePolynomialZonotope/remove_redundant_generators.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
"""
remove_redundant_generators(S::SparsePolynomialZonotope)
Remove redundant generators from `S`.
### Input
# Extended help
- `S` -- sparse polynomial zonotope
### Output
A new sparse polynomial zonotope where redundant generators have been removed.
remove_redundant_generators(S::SparsePolynomialZonotope)
## Notes
Expand Down
14 changes: 0 additions & 14 deletions src/Sets/SparsePolynomialZonotope/translate.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
"""
translate(S::SparsePolynomialZonotope, v::AbstractVector)
Translate (i.e., shift) a sparse polynomial zonotope by a given vector.
### Input
- `S` -- sparse polynomial zonotope
- `v` -- translation vector
### Output
A translated sparse polynomial zonotope.
"""
function translate(S::SparsePolynomialZonotope, v::AbstractVector)
c = center(S) + v
return SparsePolynomialZonotope(c, genmat_dep(S), genmat_indep(S), expmat(S))
Expand Down

0 comments on commit 2bbb7a9

Please sign in to comment.