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
In broadcasting over triangular matrices, we loop only over the stored
indices. For these indices, indexing into a triangular matrix is
equivalent to indexing into its parent. We may therefore replace an
`UpperOrLowerTriangular` matrix by its parent, which removes the branch
in `getindex`. This improves performance:
```julia
julia> L = LowerTriangular(zeros(600,600));
julia> L2 = copy(L);
julia> @Btime broadcast!(+, $L2, $L, $L);
161.176 μs (0 allocations: 0 bytes) # master
80.894 μs (0 allocations: 0 bytes) # this PR
```
This replacement is performed recursively on a `Broadcasted` object by
looping over its `args`, and non-triangular elements are left untouched.
Only `UpperOrLowerTriangular` matrices will be replaced by their
`parent`s.
(cherry picked from commit 5165fd3)
0 commit comments