Skip to content

5-term mul! with Diagonal #603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

5-term mul! with Diagonal #603

wants to merge 12 commits into from

Conversation

jishnub
Copy link
Collaborator

@jishnub jishnub commented Mar 4, 2025

This speeds up certain 5-term multiplications involving sparse matrices and a Diagonal, as the operations become O(nnz(A)) from O(N^2).

julia> using SparseArrays, LinearAlgebra, Chairmarks

julia> S = sprand(5_000, 5_000, 0.00001);

julia> S2 = similar(S);

julia> D = Diagonal(axes(S,1));

julia> @b (S2,S,D) mul!(_[1], _[2], _[3], true, false)
190.253 ms # main
7.143 μs # PR

julia> S2 = sprand(5_000, 5_000, 0.00001);

julia> @b (S2,S,D) mul!(_[1], _[2], _[3], 2, 3)
219.410 ms (without a warmup) # main
23.085 μs # PR

Copy link

codecov bot commented Mar 4, 2025

Codecov Report

Attention: Patch coverage is 93.81443% with 6 lines in your changes missing coverage. Please review.

Project coverage is 84.18%. Comparing base (9548149) to head (07da375).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/linalg.jl 93.81% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #603      +/-   ##
==========================================
+ Coverage   84.10%   84.18%   +0.08%     
==========================================
  Files          12       12              
  Lines        9192     9265      +73     
==========================================
+ Hits         7731     7800      +69     
- Misses       1461     1465       +4     

☔ View full report in Codecov by Sentry.
📢 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.

@jishnub jishnub marked this pull request as draft March 11, 2025 15:12
@jishnub jishnub marked this pull request as ready for review March 12, 2025 11:56
@ViralBShah
Copy link
Member

good to merge?

@jishnub
Copy link
Collaborator Author

jishnub commented Apr 1, 2025

It's ready, but I wonder if someone might want to have a look at the code?

@jishnub jishnub requested a review from SobhanMP April 2, 2025 02:31
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.

2 participants