diff --git a/Project.toml b/Project.toml index 08c50b952..3aa9a0ea2 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "IntervalArithmetic" uuid = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253" repo = "https://github.com/JuliaIntervals/IntervalArithmetic.jl.git" -version = "0.20.5" +version = "0.20.6" [deps] CRlibm = "96374032-68de-5a5b-8d9e-752f78720389" diff --git a/src/multidim/intervalbox.jl b/src/multidim/intervalbox.jl index 0b0e7da85..9052bd30a 100644 --- a/src/multidim/intervalbox.jl +++ b/src/multidim/intervalbox.jl @@ -82,6 +82,11 @@ end ∈(X::AbstractVector, Y::IntervalBox{N, T}) where {N, T} = all(X .∈ Y) ∈(X, Y::IntervalBox{N, T}) where {N, T} = throw(ArgumentError("$X ∈ $Y is not defined")) +# mixing intervals with one-dimensional interval boxes +for op in (:⊆, :⊂, :⊃, :∩, :∪) + @eval $(op)(a::Interval, X::IntervalBox{1}) = $(op)(a, first(X)) + @eval $(op)(X::IntervalBox{1}, a::Interval) = $(op)(first(X), a) +end #= On Julia 0.6 can now write diff --git a/test/multidim_tests/multidim.jl b/test/multidim_tests/multidim.jl index 89a32ac0c..1117caa3e 100644 --- a/test/multidim_tests/multidim.jl +++ b/test/multidim_tests/multidim.jl @@ -68,6 +68,13 @@ let X, A # avoid problems with global variables @test A ∪ B.v ≛ B end + x = 0.5 .. 3 + a = IntervalBox(A[1]) # 1 .. 2 + @test !(x ⊆ a) && a ⊆ x + @test !(x ⊂ a) && a ⊂ x + @test x ∩ a == a ∩ x == A[1] + @test x ∪ a == a ∪ x == x + X = IntervalBox(1..2, 3..4) Y = IntervalBox(3..4, 3..4) @@ -333,7 +340,7 @@ end @test hull(vb3...) ≛ ib3 @test hull(vb3) ≛ ib3 @test all(mince(ib3, (4,4,4)) .≛ vb3) - @test all(mince(ib3, (2,1,1)) .≛ [(-1 .. 0)×(-1 .. 1)×(-1 .. 1), + @test all(mince(ib3, (2,1,1)) .≛ [(-1 .. 0)×(-1 .. 1)×(-1 .. 1), (0 .. 1)×(-1 .. 1)×(-1 .. 1)]) @test hull(mince(ib3, (2,1,1))) ≛ ib3