Skip to content

Optimize mul!#232

Open
timholy wants to merge 1 commit into
JuliaStats:masterfrom
timholy:teh/mul!
Open

Optimize mul!#232
timholy wants to merge 1 commit into
JuliaStats:masterfrom
timholy:teh/mul!

Conversation

@timholy

@timholy timholy commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

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.

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-commenter

codecov-commenter commented Jan 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 25.00000% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.03%. Comparing base (61c65b1) to head (5d73897).
⚠️ Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
src/pdiagmat.jl 25.00% 3 Missing ⚠️
src/pdmat.jl 25.00% 3 Missing ⚠️
src/pdsparsemat.jl 25.00% 3 Missing ⚠️
src/scalmat.jl 25.00% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timholy

timholy commented Feb 25, 2026

Copy link
Copy Markdown
Contributor Author

bump

Comment thread src/pdiagmat.jl

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants