julia
1ba83f02 - LinAlg: fzeropreserving unit triangular broadcast preserves structure (#53648)

Commit
1 year ago
LinAlg: fzeropreserving unit triangular broadcast preserves structure (#53648) On master ```julia julia> UU = UnitUpperTriangular(reshape([1:9;],3,3)) 3×3 UnitUpperTriangular{Int64, Matrix{Int64}}: 1 4 7 ⋅ 1 8 ⋅ ⋅ 1 julia> UU .* 2 3×3 Matrix{Int64}: 2 8 14 0 2 16 0 0 2 ``` This PR ```julia julia> UU .* 2 3×3 UpperTriangular{Int64, Matrix{Int64}}: 2 8 14 ⋅ 2 16 ⋅ ⋅ 2 ``` This also improves performance, as the `materialize` skips the structured zeros. ```julia julia> UU = UnitUpperTriangular(rand(100, 100)); julia> @btime $UU .* 2; 12.788 μs (3 allocations: 78.20 KiB) # master 7.821 μs (3 allocations: 78.20 KiB) # PR ```
Author
Parents
Loading