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


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

Can't reply to some posts

Based on e.g. the discussion in e.g. #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.


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