Skip to content

Commit

Permalink
Update intervalbox.jl (#520)
Browse files Browse the repository at this point in the history
* Update intervalbox.jl

* Update multidim.jl

* Update Project.toml
  • Loading branch information
mforets committed May 19, 2022
1 parent 06f49c2 commit f8a5b5e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
5 changes: 5 additions & 0 deletions src/multidim/intervalbox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,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
Expand Down
7 changes: 6 additions & 1 deletion test/multidim_tests/multidim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ 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)
Expand Down

2 comments on commit f8a5b5e

@lucaferranti
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/60730

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.20.6 -m "<description of version>" f8a5b5edffd2daacd741d875cb882a42b83f2191
git push origin v0.20.6

Please sign in to comment.