From ff3d4391bd14ee66624fe44a3bdd6a2817ee409d Mon Sep 17 00:00:00 2001 From: David Sanders Date: Sat, 24 Aug 2024 18:38:34 -0500 Subject: [PATCH 1/3] Generalize contractors to bare intervals --- src/intervalbox.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/intervalbox.jl b/src/intervalbox.jl index e6566c8..15b2804 100644 --- a/src/intervalbox.jl +++ b/src/intervalbox.jl @@ -115,12 +115,12 @@ isinterior(X::IntervalBox{N,T}, Y::IntervalBox{N,T}) where {N,T} = all(isinterio # Cartesian product: ×(a::IntervalType...) = IntervalBox(a...) ×(a::IntervalType, b::IntervalBox) = IntervalBox(a, b.v...) -×(a::IntervalBox, b::Interval) = IntervalBox(a.v..., b) +×(a::IntervalBox, b::IntervalType) = IntervalBox(a.v..., b) ×(a::IntervalBox, b::IntervalBox) = IntervalBox(a.v..., b.v...) -IntervalBox(x::Interval, ::Val{n}) where {n} = IntervalBox(SVector(ntuple( _ -> x, Val(n) ))) +IntervalBox(x::IntervalType, ::Val{n}) where {n} = IntervalBox(SVector(ntuple( _ -> x, Val(n) ))) -IntervalBox(x::Interval, n::Int) = IntervalBox(x, Val(n)) +IntervalBox(x::IntervalType, n::Int) = IntervalBox(x, Val(n)) dot(x::IntervalBox, y::IntervalBox) = dot(x.v, y.v) From 7bb9944e995a5a8f4371e4ebcf7021dc08a376a4 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Sat, 24 Aug 2024 18:39:58 -0500 Subject: [PATCH 2/3] Add test --- test/multidim.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/multidim.jl b/test/multidim.jl index 96389b0..0a7656c 100644 --- a/test/multidim.jl +++ b/test/multidim.jl @@ -341,3 +341,9 @@ end # end # end + + +@testset "Bare interval boxes" begin + x = bareinterval(-1..1) + @test IntervalBox(x, 2) == IntervalBox(x, x) +end \ No newline at end of file From 6d4a3704364016efafa05cdbde35208dc2eea5f3 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Sat, 24 Aug 2024 18:42:09 -0500 Subject: [PATCH 3/3] New line --- test/multidim.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/multidim.jl b/test/multidim.jl index 0a7656c..8b167d8 100644 --- a/test/multidim.jl +++ b/test/multidim.jl @@ -346,4 +346,4 @@ end @testset "Bare interval boxes" begin x = bareinterval(-1..1) @test IntervalBox(x, 2) == IntervalBox(x, x) -end \ No newline at end of file +end