diff --git a/src/matmul.jl b/src/matmul.jl index 3ad84cc1..21846b96 100644 --- a/src/matmul.jl +++ b/src/matmul.jl @@ -130,7 +130,19 @@ LinearAlgebra.mul!(C::AbstractVecOrMat{<:RealOrComplexI}, A::AbstractMatrix, B:: LinearAlgebra.mul!(C::AbstractVecOrMat{<:RealOrComplexI}, A::AbstractMatrix{<:RealOrComplexI}, B::AbstractVecOrMat, α::Number, β::Number) = _mul!(matmul_mode(), C, A, B, α, β) -_mul!(::MatMulMode{:slow}, C, A, B, α, β) = LinearAlgebra._mul!(C, A, B, α, β) +function _mul!(::MatMulMode{:slow}, C, A::AbstractMatrix, B::AbstractVector, α, β) + @inbounds for l ∈ axes(A, 2), i ∈ axes(A, 1) + C[i] = A[i,l] * B[l] * α + C[i] * β + end + return C +end + +function _mul!(::MatMulMode{:slow}, C, A::AbstractMatrix, B::AbstractMatrix, α, β) + @inbounds for j ∈ axes(B, 2), l ∈ axes(A, 2), i ∈ axes(A, 1) + C[i,j] = A[i,l] * B[l,j] * α + C[i,j] * β + end + return C +end # fast matrix multiplication # Note: Rump's algorithm