Skip to content

Commit

Permalink
Showing 2 changed files with 17 additions and 21 deletions.
6 changes: 3 additions & 3 deletions docs/src/lib/conversion.md
Original file line number Diff line number Diff line change
@@ -43,9 +43,9 @@ convert(::Type{Zonotope}, ::CartesianProduct{N, Zonotope{N}, Zonotope{N}}) where
convert(::Type{Hyperrectangle}, ::CartesianProduct{N, HN1, HN2}) where {N<:Real, HN1<:AbstractHyperrectangle{N}, HN2<:AbstractHyperrectangle{N}}
convert(::Type{Zonotope}, ::CartesianProduct{N, HN1, HN2}) where {N<:Real, HN1<:AbstractHyperrectangle{N}, HN2<:AbstractHyperrectangle{N}}
convert(::Type{Zonotope}, ::CartesianProductArray{N, HN}) where {N<:Real, HN<:AbstractHyperrectangle{N}}
convert(::Type{Zonotope}, ::LinearMap{N, SN, NM, MAT}) where {N, SN<:AbstractHyperrectangle{N}, NM, MAT<:AbstractMatrix{N}}
convert(::Type{Zonotope}, ::LinearMap{N, CartesianProduct{N, HN1, HN2}, NM, MAT}) where {N, HN1<:AbstractHyperrectangle{N}, HN2<:AbstractHyperrectangle{N}, NM, MAT<:AbstractMatrix{N}}
convert(::Type{Zonotope}, ::LinearMap{N, CartesianProductArray{N, HN}, NM, MAT}) where {N, HN<:AbstractHyperrectangle{N}, NM, MAT<:AbstractMatrix{N}}
convert(::Type{Zonotope}, ::LinearMap{N, SN}) where {N, SN<:AbstractHyperrectangle{N}}
convert(::Type{Zonotope}, ::LinearMap{N, CartesianProduct{N, HN1, HN2}}) where {N, HN1<:AbstractHyperrectangle{N}, HN2<:AbstractHyperrectangle{N}}
convert(::Type{Zonotope}, ::LinearMap{N, CartesianProductArray{N, HN}}) where {N, HN<:AbstractHyperrectangle{N}}
```


32 changes: 14 additions & 18 deletions src/convert.jl
Original file line number Diff line number Diff line change
@@ -305,8 +305,8 @@ end

"""
convert(::Type{Zonotope},
S::LinearMap{N, SN, NM, MAT}
) where {N, SN<:AbstractHyperrectangle{N}, NM, MAT<:AbstractMatrix{N}}
S::LinearMap{N, SN}
) where {N, SN<:AbstractHyperrectangle{N}}
Converts the lazy linear map of a hyperrectangular set to a zonotope.
@@ -324,17 +324,15 @@ A zonotope.
This method first converts the hyperrectangular set to a zonotope, and then
applies the (concrete) linear map to the zonotope.
"""
function convert(::Type{Zonotope},
S::LinearMap{N, SN, NM, MAT}
) where {N, SN<:AbstractHyperrectangle{N}, NM, MAT<:AbstractMatrix{N}}
function convert(::Type{Zonotope}, S::LinearMap{N, SN}
) where {N, SN<:AbstractHyperrectangle{N}}
return linear_map(S.M, convert(Zonotope, S.X))
end

"""
convert(::Type{Zonotope},
S::LinearMap{N, CartesianProduct{N, HN1, HN2}, NM, MAT}
) where {N, HN1<:AbstractHyperrectangle{N}, HN2<:AbstractHyperrectangle{N},
NM, MAT<:AbstractMatrix{N}}
convert(::Type{Zonotope}, S::LinearMap{N, CartesianProduct{N, HN1, HN2}}
) where {N, HN1<:AbstractHyperrectangle{N},
HN2<:AbstractHyperrectangle{N}}
Converts the lazy linear map of the cartesian product of two hyperrectangular
sets to a zonotope.
@@ -354,16 +352,15 @@ This method first converts the cartesian product to a zonotope, and then
applies the (concrete) linear map to the zonotope.
"""
function convert(::Type{Zonotope},
S::LinearMap{N, CartesianProduct{N, HN1, HN2}, NM, MAT}
) where {N, HN1<:AbstractHyperrectangle{N}, HN2<:AbstractHyperrectangle{N},
NM, MAT<:AbstractMatrix{N}}
S::LinearMap{N, CartesianProduct{N, HN1, HN2}}
) where {N, HN1<:AbstractHyperrectangle{N},
HN2<:AbstractHyperrectangle{N}}
return linear_map(S.M, convert(Zonotope, S.X))
end

"""
convert(::Type{Zonotope},
S::LinearMap{N, CartesianProductArray{N, HN}, NM, MAT}
) where {N, HN<:AbstractHyperrectangle{N}, NM, MAT<:AbstractMatrix{N}}
convert(::Type{Zonotope},S::LinearMap{N, CartesianProductArray{N, HN}}
) where {N, HN<:AbstractHyperrectangle{N}}
Converts the lazy linear map of the cartesian product of a finite number of
hyperrectangular sets to a zonotope.
@@ -382,9 +379,8 @@ A zonotope.
This method first converts the cartesian product array to a zonotope, and then
applies the (concrete) linear map to the zonotope.
"""
function convert(::Type{Zonotope},
S::LinearMap{N, CartesianProductArray{N, HN}, NM, MAT}
) where {N, HN<:AbstractHyperrectangle{N}, NM, MAT<:AbstractMatrix{N}}
function convert(::Type{Zonotope}, S::LinearMap{N, CartesianProductArray{N, HN}}
) where {N, HN<:AbstractHyperrectangle{N}}
return linear_map(S.M, convert(Zonotope, S.X))
end

0 comments on commit 8ed0d5b

Please sign in to comment.