Skip to content
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

Forward complex matrix multiplication to components #294

Merged
merged 5 commits into from
Jul 26, 2024

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Jan 19, 2024

Start implementing #223
This PR forwards the matrix multiplication to the components, which may lead to a substantial speed-up if the components are BLAS-compatible matrices.

On master

julia> using StructArrays, LinearAlgebra, BenchmarkTools

julia> A = StructArray{ComplexF64}((rand(1000,1000), rand(1000,1000)));

julia> @btime $A * $A;
  1.543 s (12 allocations: 15.29 MiB)

This PR

julia> @btime $A * $A;
  58.998 ms (6 allocations: 15.26 MiB)

I've added a method for matrix * vector as well. This is actually marginally slower for BLAS-compatible cases. However, this may be substantially more efficient if the components have fast matrix * vector methods defined (e.g. sparse matrices).

@aplavin
Copy link
Member

aplavin commented Mar 8, 2024

Seems pretty straightforward and uncontroversial, I guess...

@jishnub jishnub merged commit 9ca8264 into JuliaArrays:master Jul 26, 2024
7 checks passed
@jishnub jishnub deleted the matmul branch July 26, 2024 19:04
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