# Why does SparseArrays have mul!(α, A, B, β, C)?

**URL:** https://discourse.julialang.org/t/why-does-sparsearrays-have-mul-a-b-c/8940
**Category:** Internals & Design
**Created:** [February 9, 2018, 10:12am UTC](https://discourse.julialang.org/t/why-does-sparsearrays-have-mul-a-b-c/8940 "2018-02-09T10:12:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)
#### Post date: [February 9, 2018, 10:12am UTC](https://discourse.julialang.org/t/why-does-sparsearrays-have-mul-a-b-c/8940/1 "2018-02-09T10:12:24Z")

</div>

What’s the reason that SparseArrays.jl has a `mul!(α, A, B, β, C)` function but this type signature isn’t overloaded in LinearAlgebra.jl?

---

<div class="post-metadata">

### Author: ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)
#### Post date: [February 11, 2018, 9:29pm UTC](https://discourse.julialang.org/t/why-does-sparsearrays-have-mul-a-b-c/8940/2 "2018-02-11T21:29:28Z")

</div>

Based on e.g. the discussion in e.g. [#23919](https://github.com/JuliaLang/julia/issues/23919) the implementation in `SparseArrays` is “correct” (modulo the order of arguments, although personally I’d be in favor mimicking the BLAS `*gemm` interface). So `LinearAlgebra` should definitely have `mul!` with alpha and beta parameters.

I feel very strongly that having efficient in-place matrix-matrix and matrix-vector multiplication (including the scalars) for any `AbstractMatrix`/`AbstractVector` sub-types in the Julia core is absolutely essential, and I’m happy there seems to be some movement on this for going into Julia 0.7/1.0 (hopefully!).

These generalized BLAS routines are really at the core of efficiently implementing simulations of quantum dynamics (my personal field of research). So far, I’ve had to implement these “by hand” in many instances, and I’m really looking forward of having most of these built-in.

---

<div class="post-metadata">

### Author: ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)
#### Post date: [February 11, 2018, 10:28pm UTC](https://discourse.julialang.org/t/why-does-sparsearrays-have-mul-a-b-c/8940/3 "2018-02-11T22:28:47Z")

</div>

Thanks for the reference to the relevant issue. Though it sounds like the final syntax is not settled yet.
