Skip to content

Commit 3eda167

Browse files
authored
Improve performance of LinearAlgebra.dot (#147)
1 parent 772c4e0 commit 3eda167

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/interface.jl

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,15 @@ end
5858

5959
# `Vararg` gives extra allocations on Julia v1.3, see
6060
# https://travis-ci.com/jump-dev/MutableArithmetics.jl/jobs/260666164#L215-L238
61-
function promote_operation_fallback(op::AddSubMul, T::Type, x::Type, y::Type)
62-
return promote_operation(add_sub_op(op), T, promote_operation(*, x, y))
61+
function promote_operation_fallback(
62+
op::AddSubMul,
63+
::Type{T},
64+
::Type{x},
65+
::Type{y},
66+
) where {T,x,y}
67+
new_op = add_sub_op(op)
68+
z = promote_operation(*, x, y)
69+
return promote_operation(new_op, T, z)
6370
end
6471

6572
function promote_operation_fallback(
@@ -632,10 +639,10 @@ promote_operation_fallback(::typeof(adjoint), a::Type) = a
632639

633640
function promote_operation_fallback(
634641
::typeof(LinearAlgebra.dot),
635-
b::Type,
636-
c::Type,
637-
)
638-
return promote_operation(*, promote_operation(adjoint, b), c)
642+
::Type{A},
643+
::Type{B},
644+
) where {A,B}
645+
return promote_operation(*, promote_operation(adjoint, A), B)
639646
end
640647

641648
function buffer_for(::typeof(add_dot), a::Type, b::Type, c::Type)

0 commit comments

Comments
 (0)