https://github.com/JuliaLang/julia
Revision 1ba83f021ecf09a431f7ecd7f35072e6849204eb authored by Jishnu Bhattacharya on 11 March 2024, 06:50:16 UTC, committed by GitHub on 11 March 2024, 06:50:16 UTC
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
```
1 parent 6e3044d
History
Tip revision: 1ba83f021ecf09a431f7ecd7f35072e6849204eb authored by Jishnu Bhattacharya on 11 March 2024, 06:50:16 UTC
LinAlg: fzeropreserving unit triangular broadcast preserves structure (#53648)
Tip revision: 1ba83f0
File Mode Size
.devcontainer
.github
base
cli
contrib
deps
doc
etc
src
stdlib
test
.buildkite-external-version -rw-r--r-- 5 bytes
.clang-format -rw-r--r-- 3.3 KB
.clangd -rw-r--r-- 114 bytes
.codecov.yml -rw-r--r-- 52 bytes
.git-blame-ignore-revs -rw-r--r-- 371 bytes
.gitattributes -rw-r--r-- 65 bytes
.gitignore -rw-r--r-- 571 bytes
.mailmap -rw-r--r-- 12.7 KB
CITATION.bib -rw-r--r-- 513 bytes
CITATION.cff -rw-r--r-- 1012 bytes
CONTRIBUTING.md -rw-r--r-- 23.4 KB
HISTORY.md -rw-r--r-- 388.1 KB
LICENSE.md -rw-r--r-- 1.3 KB
Make.inc -rw-r--r-- 56.1 KB
Makefile -rw-r--r-- 30.3 KB
NEWS.md -rw-r--r-- 3.6 KB
README.md -rw-r--r-- 7.4 KB
THIRDPARTY.md -rw-r--r-- 3.9 KB
VERSION -rw-r--r-- 11 bytes
julia.spdx.json -rw-r--r-- 37.8 KB
pkgimage.mk -rw-r--r-- 1.4 KB
sysimage.mk -rw-r--r-- 4.2 KB
typos.toml -rw-r--r-- 78 bytes

README.md

back to top