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
Translation
This 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(am::AbstractAffineMap)
Return some element of an affine map.
Input
am
– affine map
Output
An element of the affine map.
Algorithm
The implementation relies on the an_element
method of the wrapped set.
LazySets.API.center
— Methodcenter(am::AbstractAffineMap)
Return the center of an affine map of a centrally-symmetric set.
Input
cp
– affine map of a centrally-symmetric set
Output
The center of the affine map.
Algorithm
The implementation relies on the center
method of the wrapped set.
LazySets.API.constraints_list
— Methodconstraints_list(am::AbstractAffineMap)
Return the list of constraints of a (polyhedral) affine map.
Input
am
– affine map of a polyhedral set
Output
The list of constraints of the affine map.
Notes
We assume that the underlying set X
is polyhedral, i.e., offers a method constraints_list(X)
.
Algorithm
This implementation uses the method to compute the list of constraints of the translation of a lazy linear map.
LazySets.API.dim
— Methoddim(am::AbstractAffineMap)
Return the dimension of an affine map.
Input
am
– affine map
Output
The ambient dimension of an affine map.
LazySets.API.isbounded
— Methodisbounded(am::AbstractAffineMap; cond_tol::Number=DEFAULT_COND_TOL)
Check whether an affine map is bounded.
Input
am
– affine mapcond_tol
– (optional) tolerance of matrix condition (used to check whether the matrix is invertible)
Output
true
iff the affine map is bounded.
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(am::AbstractAffineMap)
Check whether an affine map is empty.
Input
am
– affine map
Output
true
iff the wrapped set is empty.
Base.:∈
— Method∈(x::AbstractVector, am::AbstractAffineMap)
Check whether a given point is contained in the affine map of a convex set.
Input
x
– point/vectoram
– affine map of a convex set
Output
true
iff $x ∈ am$.
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
true
An 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
true
LazySets.API.linear_map
— Methodlinear_map(M::AbstractMatrix, am::AbstractAffineMap)
Return the linear map of a lazy affine map.
Input
M
– matrixam
– affine map
Output
A set corresponding to the linear map of the lazy affine map of a set.
LazySets.API.ρ
— Methodρ(d::AbstractVector, am::AbstractAffineMap)
Evaluate the support function of an affine map.
Input
d
– directionam
– affine map
Output
The evaluation of the support function in the given direction.
LazySets.API.σ
— Methodσ(d::AbstractVector, am::AbstractAffineMap)
Return a support vector of an affine map.
Input
d
– directionam
– affine map
Output
A support vector in the given direction.
LazySets.API.vertices_list
— Methodvertices_list(am::AbstractAffineMap; [apply_convex_hull]::Bool)
Return the list of vertices of a (polytopic) affine map.
Input
am
– affine map of a polytopic setapply_convex_hull
– (optional, default:true
) iftrue
, apply the convex hull operation to the list of vertices transformed by the affine map
Output
A list of vertices.
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.