Skip to content

Commit fc3a292

Browse files
committed
improve \ override
1 parent bc56c05 commit fc3a292

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/dual.jl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -837,14 +837,15 @@ function _map_dual_components!(fvalue!, fpartial!, y::AbstractArray{DT}, x::Abst
837837
return y
838838
end
839839

840-
function Base.:\(m::Union{LowerTriangular{<:LinearAlgebra.BlasFloat},
841-
UpperTriangular{<:LinearAlgebra.BlasFloat}},
842-
x::StridedVector{<:Dual})
843-
T = valtype(eltype(x))
844-
res = copy(x)
845-
ldiv!(m, reinterpret(reshape, T, res)')
846-
return res
847-
end
840+
LinearAlgebra.ldiv!(y::StridedVector{T},
841+
m::Union{LowerTriangular{<:LinearAlgebra.BlasFloat},
842+
UpperTriangular{<:LinearAlgebra.BlasFloat}},
843+
x::StridedVector{T}) where T <: Dual =
844+
(ldiv!(reinterpret(reshape, valtype(T), y)', m, reinterpret(reshape, valtype(T), x)'); y)
845+
846+
Base.:\(m::Union{LowerTriangular{<:LinearAlgebra.BlasFloat},
847+
UpperTriangular{<:LinearAlgebra.BlasFloat}},
848+
x::StridedVector{<:Dual}) = ldiv!(similar(x), m, x)
848849

849850
for MT in (StridedMatrix{<:LinearAlgebra.BlasFloat},
850851
LowerTriangular{<:LinearAlgebra.BlasFloat},

0 commit comments

Comments
 (0)