Skip to content

Commit aef0df9

Browse files
committed
try harder to avoid ambiguities
1 parent c55430d commit aef0df9

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/dual.jl

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -837,17 +837,16 @@ function _map_dual_components(fvalue!, fpartial!, x::AbstractArray{DT}) where DT
837837
return res
838838
end
839839

840-
Base.:\(m::Union{LowerTriangular{<:LinearAlgebra.BlasFloat},
841-
UpperTriangular{<:LinearAlgebra.BlasFloat},
842-
StridedMatrix{<:LinearAlgebra.BlasFloat}},
843-
x::StridedVecOrMat{<:Dual}) =
844-
_map_dual_components(Base.Fix1(ldiv!, m), (x, _) -> ldiv!(m, x), x)
845-
846-
Base.:*(m::Union{LowerTriangular{<:LinearAlgebra.BlasFloat},
847-
UpperTriangular{<:LinearAlgebra.BlasFloat},
848-
StridedMatrix{<:LinearAlgebra.BlasFloat}},
849-
x::StridedVecOrMat{<:Dual}) =
850-
_map_dual_components(Base.Fix1(lmul!, m), (x, _) -> lmul!(m, x), x)
840+
for MT in (StridedMatrix{<:LinearAlgebra.BlasFloat},
841+
LowerTriangular{<:LinearAlgebra.BlasFloat},
842+
UpperTriangular{<:LinearAlgebra.BlasFloat}),
843+
XT in (StridedMatrix{<:Dual}, StridedVector{<:Dual})
844+
@eval Base.:\(m::$MT, x::$XT) =
845+
_map_dual_components(Base.Fix1(ldiv!, m), (x, _) -> ldiv!(m, x), x)
846+
847+
@eval Base.:*(m::$MT, x::$XT) =
848+
_map_dual_components(Base.Fix1(lmul!, m), (x, _) -> lmul!(m, x), x)
849+
end
851850

852851
###################
853852
# Pretty Printing #

0 commit comments

Comments
 (0)