From 2de78d14daeb52622e158ed7f80a089c43ccde97 Mon Sep 17 00:00:00 2001 From: schillic Date: Mon, 9 Sep 2024 20:12:28 +0200 Subject: [PATCH] fix ambiguities with matrix multiplication --- src/operations/mult.jl | 12 +++++++++--- test/Aqua.jl | 6 ++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/operations/mult.jl b/src/operations/mult.jl index 227aa0fa..771029ef 100644 --- a/src/operations/mult.jl +++ b/src/operations/mult.jl @@ -36,9 +36,15 @@ function set_multiplication_mode(multype) type = MultiplicationType{multype}() @eval *(A::IntervalMatrix, B::IntervalMatrix) = *($type, A, B) - @eval *(A::AbstractMatrix, B::IntervalMatrix) = *($type, A, B) - - @eval *(A::IntervalMatrix, B::AbstractMatrix) = *($type, A, B) + # AbstractMatrix, incl. disambiguations + for T in (:AbstractMatrix, :(LinearAlgebra.AbstractTriangular), + :(Transpose{T, <:AbstractVector} where T), :Diagonal, + :(LinearAlgebra.Adjoint{T, <:AbstractVector} where T)) + @eval begin + *(A::IntervalMatrix, B::$T) = *($type, A, B) + *(A::$T, B::IntervalMatrix) = *($type, A, B) + end + end return config[:multiplication] = multype end diff --git a/test/Aqua.jl b/test/Aqua.jl index fb2a3a48..f34beb6d 100644 --- a/test/Aqua.jl +++ b/test/Aqua.jl @@ -17,8 +17,10 @@ import PkgVersion, Aqua end Aqua.test_all(IntervalMatrices; stale_deps=stale_deps, undefined_exports=undefined_exports, - # the ambiguities should be resolved in the future - ambiguities=(broken=true,), + ambiguities=false, # the piracies should be resolved in the future piracies=(broken=true,)) + + # do not warn about ambiguities in dependencies + Aqua.detect_ambiguities(IntervalMatrices) end