Skip to content

Commit

Permalink
Merge pull request #1200 from JuliaReach/schillic/union
Browse files Browse the repository at this point in the history
Fix dim(::UnionSet)
  • Loading branch information
schillic authored Mar 6, 2019
2 parents 8bc5c0b + dd6d626 commit ba1f869
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/src/lib/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ Hence these set types are not part of the convex-set family `LazySet`.
```@docs
UnionSet
∪(::LazySet, ::LazySet)
dim(::Union)
dim(::UnionSet)
σ(::AbstractVector{N}, ::UnionSet{N}; algorithm="support_vector") where {N<:Real}
ρ(::AbstractVector{N}, ::UnionSet{N}) where {N<:Real}
an_element(::UnionSet{N}) where {N<:Real}
Expand Down
6 changes: 3 additions & 3 deletions src/UnionSet.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Base: isempty, , , Union
import Base: isempty, ,

export UnionSet,
UnionSetArray,
Expand Down Expand Up @@ -43,7 +43,7 @@ Alias for `UnionSet`.
(X::LazySet, Y::LazySet) = UnionSet(X, Y)

"""
dim(cup::Union)::Int
dim(cup::UnionSet)::Int
Return the dimension of the set union of two convex sets.
Expand All @@ -55,7 +55,7 @@ Return the dimension of the set union of two convex sets.
The ambient dimension of the union of two convex sets.
"""
function dim(cup::Union)::Int
function dim(cup::UnionSet)::Int
return dim(cup.X)
end

Expand Down
3 changes: 3 additions & 0 deletions test/unit_UnionSet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ for N in [Float64, Rational{Int}, Float32]
Uarr = UnionSetArray([B1, B2])

for U in [UXY, Uarr]
# dimension
@test dim(U) == dim(B1)

# support vector (default algorithm)
d = N[1, 0]
@test σ(d, U) == [N(2), N(1)]
Expand Down

0 comments on commit ba1f869

Please sign in to comment.