Affine maps (AbstractAffineMap)
An affine map consists of a linear map and a translation.
LazySets.AbstractAffineMap — TypeAbstractAffineMap{N, S<:LazySet{N}} <: LazySet{N}Abstract type for affine maps.
Notes
See AffineMap for a standard implementation of this interface.
Every concrete AbstractAffineMap must define the following methods:
matrix(::AbstractAffineMap)– return the linear mapvector(::AbstractAffineMap)– return the affine translation vectorset(::AbstractAffineMap)– return the set that the map is applied to
The subtypes of AbstractAffineMap:
julia> subtypes(AbstractAffineMap)
7-element Vector{Any}:
AffineMap
ExponentialMap
ExponentialProjectionMap
InverseLinearMap
LinearMap
ResetMap
TranslationThis interface requires to implement the following functions:
LazySets.matrix — Methodmatrix(X::AbstractAffineMap)Return the matrix of an affine map.
Input
X– affine map
Output
The matrix of X.
LazySets.vector — Methodvector(X::AbstractAffineMap)Return the vector of an affine map.
Input
X– affine map
Output
The vector of X.
LazySets.set — Methodset(X::AbstractAffineMap)Return the set of an affine map.
Input
X– affine map
Output
The set of X before applying the map.
This interface defines the following functions:
LazySets.API.an_element — Methodan_element(X::LazySet)Return some element of a nonempty set.
Input
X– set
Output
An element of X unless X is empty.
LazySets.API.an_element — MethodExtended help
Algorithm
The implementation relies on the an_element method of the wrapped set.
LazySets.API.center — Methodcenter(X::LazySet)Compute the center of a centrally symmetric set.
Input
X– centrally symmetric set
Output
A vector with the center, or midpoint, of X.
LazySets.API.center — MethodExtended help
center(am::AbstractAffineMap)Algorithm
The implementation relies on the center method of the wrapped set.
LazySets.API.constraints_list — Methodconstraints_list(X::LazySet)Compute a list of linear constraints of a polyhedral set.
Input
X– polyhedral set
Output
A list of the linear constraints of X.
LazySets.API.constraints_list — MethodExtended help
constraints_list(am::AbstractAffineMap)Notes
We assume that the underlying set X is polyhedral, i.e., offers a method constraints_list(X).
Algorithm
This implementation uses the constraints_list method to compute the list of constraints of the translation of a lazy LinearMap.
LazySets.API.isbounded — Methodisbounded(X::LazySet)Check whether a set is bounded.
Input
X– set
Output
true iff the set is bounded.
Notes
See also isboundedtype(::Type{<:LazySet}).
LazySets.API.isbounded — MethodExtended help
isbounded(am::AbstractAffineMap; cond_tol::Number=DEFAULT_COND_TOL)Input
cond_tol– (optional) tolerance of matrix condition (used to check whether the matrix is invertible)
Algorithm
We first check if the matrix is zero or the wrapped set is bounded. If not, we perform a sufficient check whether the matrix is invertible. If the matrix is invertible, then the map being bounded is equivalent to the wrapped set being bounded, and hence the map is unbounded. Otherwise, we check boundedness via _isbounded_unit_dimensions.
Base.isempty — Methodisempty(X::LazySet, witness::Bool=false)Check whether a set is empty.
Input
X– setwitness– (optional, default:false) compute a witness if activated
Output
- If the
witnessoption is deactivated:trueiff $X = ∅$ - If the
witnessoption is activated:(true, [])iff $X = ∅$(false, v)iff $X ≠ ∅$ for some $v ∈ X$
Base.isempty — MethodExtended help
isempty(am::AbstractAffineMap)Algorithm
The result is true iff the wrapped set is empty.
LazySets.API.isuniversal — Methodisuniversal(X::LazySet, witness::Bool=false)Check whether a set is universal.
Input
X– setwitness– (optional, default:false) compute a witness if activated
Output
- If the
witnessoption is deactivated:trueiff $X = ℝ^n$ - If the
witnessoption is activated:(true, [])iff $X = ℝ^n$(false, v)iff $X ≠ ℝ^n$ for some $v ∉ X$
LazySets.API.isuniversal — MethodExtended help
isuniversal(am::AbstractAffineMap)Algorithm
An affine map is universal iff the wrapped set is universal and the matrix does not map any dimension to zero.
Base.:∈ — Method∈(x::AbstractVector, X::LazySet)Check whether a point lies in a set.
Input
x– point/vectorX– set
Output
true iff $x ∈ X$.
Base.:∈ — MethodExtended help
∈(x::AbstractVector, am::AbstractAffineMap)Algorithm
Observe that $x ∈ M⋅S ⊕ v$ iff $M^{-1}⋅(x - v) ∈ S$. This implementation does not explicitly invert the matrix, which is why it also works for non-square matrices.
Examples
julia> am = AffineMap([2.0 0.0; 0.0 1.0], BallInf([1., 1.], 1.), [-1.0, -1.0]);
julia> [5.0, 1.0] ∈ am
false
julia> [3.0, 1.0] ∈ am
trueAn example with a non-square matrix:
julia> B = BallInf(zeros(4), 1.);
julia> M = [1. 0 0 0; 0 1 0 0]/2;
julia> [0.5, 0.5] ∈ M*B
trueLazySets.API.vertices_list — Methodvertices_list(X::LazySet)Compute a list of vertices of a polytopic set.
Input
X– polytopic set
Output
A list of the vertices of X.
LazySets.API.vertices_list — MethodExtended help
vertices_list(am::AbstractAffineMap; [apply_convex_hull]::Bool=true)Input
apply_convex_hull– (optional, default:true) iftrue, apply the convex hull operation to the list of vertices transformed by the affine map
Algorithm
This implementation computes all vertices of X, then transforms them through the affine map, i.e., x ↦ M*x + v for each vertex x of X. By default, the convex-hull operation is taken before returning this list. For dimensions three or higher, this operation relies on the functionality through the concrete polyhedra library Polyhedra.jl.
If you are not interested in taking the convex hull of the resulting vertices under the affine map, pass apply_convex_hull=false as a keyword argument.
Note that we assume that the underlying set X is polytopic, either concretely or lazily, i.e., the function vertices_list should be applicable.
LazySets.API.volume — Methodvolume(X::LazySet)Compute the volume, or Lebesgue measure, of a set.
Input
X– set
Output
A real number representing the Lebesgue measure of X.
Notes
The Lebesgue measure has the following common special cases:
- In 1D, it coincides with the length.
- In 2D, it coincides with the area (see also
area). - In 3D, it coincides with the volume.
In higher dimensions, it is also known as the hypervolume or simply volume.
LazySets.API.volume — MethodExtended help
volume(am::AbstractAffineMap)Notes
This implementation requires a dimension-preserving map (i.e., a square matrix).
Algorithm
A square linear map scales the volume of any set by its absolute determinant. A translation does not affect the volume. Thus, the volume of M * X + {v} is |det(M)| * volume(X).
Undocumented implementations:
Inherited from LazySet:
areachebyshev_center_radiuscomplementconcretizeconstraintsconvex_hullcopy(::Type{LazySet})diametereltypeeltypeextremaextremahighhighisboundedtypeisoperationispolytopiclowlownormpolyhedronradiusrationalizerectifyreflectsingleton_listtosimplehreptriangulatetriangulate_facesverticesaffine_mapexponential_mapis_interior_pointprojectsamplescaletranslatecartesian_productconvex_hullexact_sumisapproxisdisjoint==isequivalent⊂⊆linear_combinationminkowski_differenceminkowski_sum