# Products of sparse by dense matrices don't revert to specialized methods

**URL:** https://discourse.julialang.org/t/products-of-sparse-by-dense-matrices-dont-revert-to-specialized-methods/80894
**Category:** General Usage
**Tags:** linearalgebra, sparse
**Created:** [May 11, 2022, 3:46pm UTC](https://discourse.julialang.org/t/products-of-sparse-by-dense-matrices-dont-revert-to-specialized-methods/80894 "2022-05-11T15:46:14Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Arrigo\_Benedetti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/arrigo_benedetti/32/25545_2.png) [@Arrigo\_Benedetti](https://discourse.julialang.org/u/Arrigo_Benedetti)
#### Post date: [May 11, 2022, 3:46pm UTC](https://discourse.julialang.org/t/products-of-sparse-by-dense-matrices-dont-revert-to-specialized-methods/80894/1 "2022-05-11T15:46:14Z")

</div>

Apparently in 1.7.2 the product of a sparse (SparseMatrixCSC) and a dense matrix (both directions) never use the specialized method. Looking at this old [discussion](https://github.com/JuliaLang/julia/issues/29956) it seems that at least the sparse by dense product should be handled by `SparseArrays`.

```julia
julia> using BenchmarkTools, SparseArrays, LinearAlgebra

julia> A = sprand(100,100,0.01)
julia> B = rand(100,100)
julia> C = A*B

julia> println(typeof(A))
SparseMatrixCSC{Float64, Int64}

julia> println(typeof(B))
Matrix{Float64}

julia> println(typeof(C))
Matrix{Float64}

julia> @which mul!(C, A, B)
mul!(C, A, B) in LinearAlgebra at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/matmul.jl:274

julia> @which mul!(C, B, A)
mul!(C, A, B) in LinearAlgebra at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/matmul.jl:274

```

---

<div class="post-metadata">

### Author: ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)
#### Post date: [May 11, 2022, 3:58pm UTC](https://discourse.julialang.org/t/products-of-sparse-by-dense-matrices-dont-revert-to-specialized-methods/80894/2 "2022-05-11T15:58:40Z")

</div>

On 1.9, I’m seeing `*(X::AdjOrTransDenseMatrix, A::SparseMatrixCSCUnion{TvA})` and `*(A::SparseMatrixCSCUnion{TA}, B::AdjOrTransDenseMatrix)`
