Optimize mul!#232
Conversation
At least for `PDSparseMat`, `mul!` was falling back to the generic (indexing-based) implementation. This adds specialized `mul!` methods that delegate to the underlying matrix representation, improving performance.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #232 +/- ##
==========================================
- Coverage 93.37% 92.03% -1.35%
==========================================
Files 11 11
Lines 800 816 +16
==========================================
+ Hits 747 751 +4
- Misses 53 65 +12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
bump |
|
|
||
| LinearAlgebra.mul!(y::AbstractVector, a::PDiagMat, x::AbstractVector, α::Number, β::Number) = mul!(y, Diagonal(a.diag), x, α, β) | ||
| @static if isdefined(LinearAlgebra, :AbstractTriangular) | ||
| LinearAlgebra.mul!(y::AbstractMatrix, a::PDiagMat, x::LinearAlgebra.AbstractTriangular, α::Number, β::Number) = mul!(y, Diagonal(a.diag), x, α, β) # ambiguity resolution |
There was a problem hiding this comment.
I'm a bit worried about ambiguity issues here in general. Is there some guideline regarding which function signatures are supposed to be implemented by downstream packages? I'd like to avoid that users run into (different) ambiguity issues on new Julia releases, and I'd also like to avoid adding definitions for a lot of different combinations of argument types to this package in general. Regarding the latter, I think the special definitions for AbstractTriangular and BandedMatrix in this PR are already worrisome.
There was a problem hiding this comment.
Good point. Based on a slack converation there's been movement towards making generic_* as the target, which got formalized in JuliaLang/LinearAlgebra.jl#1584
I'll look into shifting this at some point
At least for
PDSparseMat,mul!was falling back to the generic (indexing-based) implementation. This adds specializedmul!methods that delegate to the underlying matrix representation, improving performance.