Skip to content

Commit f8a5b5e

Browse files
authored
Update intervalbox.jl (#520)
* Update intervalbox.jl * Update multidim.jl * Update Project.toml
1 parent 06f49c2 commit f8a5b5e

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "IntervalArithmetic"
22
uuid = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253"
33
repo = "https://github.com/JuliaIntervals/IntervalArithmetic.jl.git"
4-
version = "0.20.5"
4+
version = "0.20.6"
55

66
[deps]
77
CRlibm = "96374032-68de-5a5b-8d9e-752f78720389"

src/multidim/intervalbox.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ end
8181
(X::AbstractVector, Y::IntervalBox{N,T}) where {N,T} = all(X .∈ Y)
8282
(X, Y::IntervalBox{N,T}) where {N,T} = throw(ArgumentError("$X$Y is not defined"))
8383

84+
# mixing intervals with one-dimensional interval boxes
85+
for op in (:, :, :, :, :)
86+
@eval $(op)(a::Interval, X::IntervalBox{1}) = $(op)(a, first(X))
87+
@eval $(op)(X::IntervalBox{1}, a::Interval) = $(op)(first(X), a)
88+
end
8489

8590
#=
8691
On Julia 0.6 can now write

test/multidim_tests/multidim.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ let X, A # avoid problems with global variables
6666
@test A B.v == B
6767
end
6868

69-
69+
x = 0.5 .. 3
70+
a = IntervalBox(A[1]) # 1 .. 2
71+
@test !(x a) && a x
72+
@test !(x a) && a x
73+
@test x a == a x == A[1]
74+
@test x a == a x == x
7075

7176
X = IntervalBox(1..2, 3..4)
7277
Y = IntervalBox(3..4, 3..4)

0 commit comments

Comments
 (0)