Skip to content

Commit e213856

Browse files
committed
try harder to avoid ambiguities
1 parent 559e1ed commit e213856

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
@@ -814,17 +814,16 @@ function _map_dual_components(fvalue!, fpartial!, x::AbstractArray{DT}) where DT
814814
return res
815815
end
816816

817-
Base.:\(m::Union{LowerTriangular{<:LinearAlgebra.BlasFloat},
818-
UpperTriangular{<:LinearAlgebra.BlasFloat},
819-
StridedMatrix{<:LinearAlgebra.BlasFloat}},
820-
x::StridedVecOrMat{<:Dual}) =
821-
_map_dual_components(Base.Fix1(ldiv!, m), (x, _) -> ldiv!(m, x), x)
822-
823-
Base.:*(m::Union{LowerTriangular{<:LinearAlgebra.BlasFloat},
824-
UpperTriangular{<:LinearAlgebra.BlasFloat},
825-
StridedMatrix{<:LinearAlgebra.BlasFloat}},
826-
x::StridedVecOrMat{<:Dual}) =
827-
_map_dual_components(Base.Fix1(lmul!, m), (x, _) -> lmul!(m, x), x)
817+
for MT in (StridedMatrix{<:LinearAlgebra.BlasFloat},
818+
LowerTriangular{<:LinearAlgebra.BlasFloat},
819+
UpperTriangular{<:LinearAlgebra.BlasFloat}),
820+
XT in (StridedMatrix{<:Dual}, StridedVector{<:Dual})
821+
@eval Base.:\(m::$MT, x::$XT) =
822+
_map_dual_components(Base.Fix1(ldiv!, m), (x, _) -> ldiv!(m, x), x)
823+
824+
@eval Base.:*(m::$MT, x::$XT) =
825+
_map_dual_components(Base.Fix1(lmul!, m), (x, _) -> lmul!(m, x), x)
826+
end
828827

829828
###################
830829
# Pretty Printing #

0 commit comments

Comments
 (0)