Skip to content

Commit

Permalink
EmptySet: add 'linear_combination'
Browse files Browse the repository at this point in the history
  • Loading branch information
schillic committed Dec 15, 2024
1 parent edd9f5c commit 95ca7a0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/ConcreteOperations/linear_combination.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
function linear_combination(X::ConvexSet, Y::ConvexSet)
return convex_hull(X, Y)
end

@commutative function linear_combination(∅::EmptySet, X::LazySet)
return _linear_combination_emptyset(∅, X)
end

# disambiguation
@commutative function linear_combination(∅::EmptySet, X::ConvexSet)
return _linear_combination_emptyset(∅, X)
end
4 changes: 2 additions & 2 deletions src/LazySets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ include("Sets/EmptySet/EmptySetModule.jl")
@reexport using ..EmptySetModule: EmptySet, ∅
using ..EmptySetModule: _difference_emptyset, _difference_emptyset2, _distance_emptyset,
_isdisjoint_emptyset, _issubset_emptyset, _issubset_emptyset2,
_minkowski_difference_emptyset, _minkowski_difference_emptyset2,
_minkowski_sum_emptyset
_linear_combination_emptyset, _minkowski_difference_emptyset,
_minkowski_difference_emptyset2, _minkowski_sum_emptyset

include("Sets/HParallelotope/HParallelotopeModule.jl")
@reexport using ..HParallelotopeModule: HParallelotope,
Expand Down
3 changes: 2 additions & 1 deletion src/Sets/EmptySet/EmptySetModule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ using ReachabilityBase.Require: require
ρ, σ, surface, translate, translate!, vertices,
vertices_list, volume, cartesian_product, convex_hull,
difference, distance, intersection, , isdisjoint, ,
minkowski_difference, minkowski_sum
linear_combination, minkowski_difference, minkowski_sum
@reexport import ..LazySets: chebyshev_center_radius
import ..LazySets: plot_recipe
import Base: convert, copy
Expand Down Expand Up @@ -68,6 +68,7 @@ include("intersection.jl")
include("isapprox.jl")
include("isdisjoint.jl")
include("issubset.jl")
include("linear_combination.jl")
include("minkowski_difference.jl")
include("minkowski_sum.jl")

Expand Down
10 changes: 10 additions & 0 deletions src/Sets/EmptySet/linear_combination.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function linear_combination(∅₁::EmptySet, ∅₂::EmptySet)
return _linear_combination_emptyset(∅₁, ∅₂)
end

# the empty set is absorbing for the linear combination
function _linear_combination_emptyset(∅::EmptySet, X::LazySet)
@assert dim(∅) == dim(X) "the dimensions of the given sets should match, " *
"but they are $(dim(∅)) and $(dim(X)), respectively"
return
end

0 comments on commit 95ca7a0

Please sign in to comment.