-
Notifications
You must be signed in to change notification settings - Fork 38
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
Matrix-Matrix product is slow with diagonal banded matrices #296
Comments
Probably need to overload |
Not sure if I understand. This uses
Perhaps some special cases may be added to |
Part of the issue seems to be that julia> using BandedMatrices, LinearAlgebra, BenchmarkTools
julia> import BandedMatrices: bandeddata
julia> A = BandedMatrix(0=>rand(1000));
julia> v = Float64[i for i in 1:size(A,2)];
julia> y = zeros(size(A,1));
julia> @btime BLAS.gbmv!('N', size($A,1), bandwidth($A,1), bandwidth($A,2),1.0, bandeddata($A), $v, 0.0, $y);
6.184 μs (0 allocations: 0 bytes)
julia> @btime mul!($y, $(Diagonal(A)), $v, 1.0, 0.0);
133.336 ns (0 allocations: 0 bytes) |
Right multiplication by a julia> A = BandedMatrix(-1=>rand(999), 0=>rand(1000), 1=>rand(999));
julia> D = Diagonal(rand(1000));
julia> A * D ≈ BandedMatrices._BandedMatrix(A.data .* D.diag', size(A,1), bandwidths(A)...)
true
julia> @btime $A * $D;
20.770 μs (3 allocations: 23.53 KiB)
julia> @btime BandedMatrices._BandedMatrix($A.data .* $D.diag', size($A,1), bandwidths($A)...);
4.954 μs (3 allocations: 23.53 KiB) Edit: This should be fixed by #302 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a significant difference, and it would be good to identify why this is slow.
The text was updated successfully, but these errors were encountered: