Skip to content

Commit 0740903

Browse files
committed
try harder to avoid ambiguities
1 parent 05729ff commit 0740903

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
@@ -806,17 +806,16 @@ function _map_dual_components(fvalue!, fpartial!, x::AbstractArray{DT}) where DT
806806
return res
807807
end
808808

809-
Base.:\(m::Union{LowerTriangular{<:LinearAlgebra.BlasFloat},
810-
UpperTriangular{<:LinearAlgebra.BlasFloat},
811-
StridedMatrix{<:LinearAlgebra.BlasFloat}},
812-
x::StridedVecOrMat{<:Dual}) =
813-
_map_dual_components(Base.Fix1(ldiv!, m), (x, _) -> ldiv!(m, x), x)
814-
815-
Base.:*(m::Union{LowerTriangular{<:LinearAlgebra.BlasFloat},
816-
UpperTriangular{<:LinearAlgebra.BlasFloat},
817-
StridedMatrix{<:LinearAlgebra.BlasFloat}},
818-
x::StridedVecOrMat{<:Dual}) =
819-
_map_dual_components(Base.Fix1(lmul!, m), (x, _) -> lmul!(m, x), x)
809+
for MT in (StridedMatrix{<:LinearAlgebra.BlasFloat},
810+
LowerTriangular{<:LinearAlgebra.BlasFloat},
811+
UpperTriangular{<:LinearAlgebra.BlasFloat}),
812+
XT in (StridedMatrix{<:Dual}, StridedVector{<:Dual})
813+
@eval Base.:\(m::$MT, x::$XT) =
814+
_map_dual_components(Base.Fix1(ldiv!, m), (x, _) -> ldiv!(m, x), x)
815+
816+
@eval Base.:*(m::$MT, x::$XT) =
817+
_map_dual_components(Base.Fix1(lmul!, m), (x, _) -> lmul!(m, x), x)
818+
end
820819

821820
###################
822821
# Pretty Printing #

0 commit comments

Comments
 (0)