I want to perform in-place matrix multiplications where the matrices can be sparse or dense. As a simple case, consider evaluating residuals from a regression model
resid .= y - X*β
where resid is a pre-allocated dense vector, y and β are both dense vectors, and X is a StridedArray or a SparseMatrixCSC.
For the sparse X I can call
A_mul_B!(-1, X, β, 1, copy!(resid, y))
but that is not defined for dense X. I can drop down to BLAS.gemv! or BLAS.gemm! for the dense case but I would prefer a method call that applies to both sparse and dense and doesn’t cause allocation or introduce inefficiencies. I would also prefer syntax that applies to both v0.5 and v0.6