We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cd85294 commit ecf16f5Copy full SHA for ecf16f5
src/multidim/arithmetic.jl
@@ -29,7 +29,7 @@ Base.size(X::IntervalBox{2,Float64}) = (2,)
29
@inline broadcasted(f, x, Y::IntervalBox) = wrap(f.(x, Y.v))
30
# for literal_pow:
31
@inline broadcasted(f, x, y, Z::IntervalBox) = wrap(f.(x, y, Z.v))
32
-@inline broadcasted(f, x, Y::IntervalBox, z) = wrap(f.(x, Y.v, z))
+@inline broadcasted(f, x, Y::IntervalBox, z) = wrap(f.(x, Y.v, z))
33
34
for op in (:+, :-, :∩, :∪, :⊆, :isinterior, :dot, :setdiff, :×)
35
@eval $(op)(a::SVector, b::IntervalBox) = $(op)(IntervalBox(a), b)
@@ -38,3 +38,8 @@ end
38
39
@eval $(op)(a::IntervalBox, b::SVector) = $(op)(a, IntervalBox(b))
40
end
41
+
42
43
+# multiplication by a matrix
44
45
+*(A::AbstractMatrix, X::IntervalBox) = IntervalBox(A * X.v)
test/multidim_tests/multidim.jl
@@ -236,4 +236,16 @@ end
236
237
238
239
+@testset "Multiplication by a matrix" begin
240
+ A = [1 2; 3 4]
241
+ X = IntervalBox(1..2, 3..4)
242
243
+ @test A * X == IntervalBox(7..10, 15..22)
244
245
+ B = SMatrix{2,2}(A)
246
247
+ @test B * X == IntervalBox(7..10, 15..22)
248
249
+end
250
251
0 commit comments