You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specialize lmul!/rmul! for strided triangular matrices (#1228)
This improves performance, as we only need to loop over one half of the
matrix. On master, `rmul!` for an `UpperTriangular` forwards the
multiplication to the parent, so the entire array is looped over. We
therefore obtain identical performance for `rmul!(::Matrix, ::Diagonal)`
and `rmul!(::UpperTriangular{<:Any, <:Matrix}, ::Diagonal)`.
```julia
julia> using LinearAlgebra, Chairmarks
julia> D = Diagonal(rand(4000));
julia> A = rand(size(D)...);
julia> U = UpperTriangular(A);
julia> @b (A, D) rmul!(_[1], _[2])
10.309 ms
julia> @b (U, D) rmul!(_[1], _[2])
10.370 ms
```
On this PR, the latter is faster, as the loop is only over half the
indices:
```julia
julia> @b (U, D) rmul!(_[1], _[2])
7.216 ms
```
0 commit comments