diff --git a/src/operations.jl b/src/operations.jl index 087b94a740..9392f646c8 100644 --- a/src/operations.jl +++ b/src/operations.jl @@ -70,3 +70,11 @@ Base.convert(::Type{Expr},x::Operation) = Expr(x) # promotion Base.promote_rule(::Type{<:Constant}, ::Type{<:Operation}) = Operation Base.promote_rule(::Type{<:Operation}, ::Type{<:Constant}) = Operation + +# Fix Sparse MatMul +Base.:*(A::SparseMatrixCSC{Operation,S}, x::StridedVector{Operation}) where {S} = + (T = Operation; mul!(similar(x, T, A.m), A, x, true, false)) +Base.:*(A::SparseMatrixCSC{Tx,S}, x::StridedVector{Operation}) where {Tx,S} = + (T = LinearAlgebra.promote_op(LinearAlgebra.matprod, Operation, Tx); mul!(similar(x, T, A.m), A, x, true, false)) +Base.:*(A::SparseMatrixCSC{Operation,S}, x::StridedVector{Tx}) where {Tx,S} = + (T = LinearAlgebra.promote_op(LinearAlgebra.matprod, Operation, Tx); mul!(similar(x, T, A.m), A, x, true, false))