Are there any 5-argument versions of `mul!` or similar in LinearAlgebra now?

The BLAS routines for multiplication and solving linear systems allow for scalar multipliers, usually written alpha and beta, so that the general mutating version of a matrix product is equivalent to

C .= α .* (A * B) + β .* C

I thought I saw 5-argument versions of mul! with a signature like

mul!(C::Matrix{T}, A::Matrix{T}, B::Matrix{T}, alpha::T, beta::T)

but it appears I was hallucinating.

Are there methods for mul!, etc. that would end up calling LinearAlgebra.BLAS.gemm!with alpha and beta arguments?

The reason I want this is because a calculation in a tight inner loop needs to replace C by C - A*B and I would much prefer to do this in-place. If there are alternative ways to accomplish this I would welcome hearing of them.

1 Like

AFAIK, the gemm_wrapper! which is the entry point the the BLAS gemm still hardcodes alpha and beta in its call:

Sparse arrays do have this 5 arg version though, heh: