https://github.com/JuliaLang/julia
Revision 89cae45ea4f75ce81fff08ca6e731e72e838f4ad authored by Jishnu Bhattacharya on 30 December 2023, 17:08:45 UTC, committed by GitHub on 30 December 2023, 17:08:45 UTC
This uses broadcasting for operations like `A::UpperTriangular +
B::UpperTriangular` in case the parents are `StridedMatrix`es. Looping
only over the triangular part is usually faster for large matrices,
where presumably memory is the bottleneck.

Some performance comparisons, using
```julia
julia> U = UpperTriangular(rand(1000,1000));

julia> U1 = UnitUpperTriangular(rand(size(U)...));
```
| Operation | master | PR |
| --------------- | ---------- | ----- |
|`-U` |`1.011 ms (3 allocations: 7.63 MiB)` |`559.680 μs (3 allocations:
7.63 MiB)` |
|`U + U`/`U - U` |`971.740 μs (3 allocations: 7.63 MiB)` | `560.063 μs
(3 allocations: 7.63 MiB)` |
|`U + U1`/`U - U1` |`3.014 ms (9 allocations: 22.89 MiB)` | `944.772 μs
(3 allocations: 7.63 MiB)` |
|`U1 + U1` |`4.509 ms (12 allocations: 30.52 MiB)` | `1.687 ms (3
allocations: 7.63 MiB)` |
|`U1 - U1` |`3.357 ms (9 allocations: 22.89 MiB)` | `1.763 ms (3
allocations: 7.63 MiB)` |

I've retained the existing methods as fallback, in case there's current
code that works without broadcasting.
1 parent fe0db7d
History
Tip revision: 89cae45ea4f75ce81fff08ca6e731e72e838f4ad authored by Jishnu Bhattacharya on 30 December 2023, 17:08:45 UTC
Optimized arithmetic methods for strided triangular matrices (#52571)
Tip revision: 89cae45
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-- 523 bytes
.mailmap -rw-r--r-- 12.7 KB
CITATION.bib -rw-r--r-- 513 bytes
CITATION.cff -rw-r--r-- 940 bytes
CONTRIBUTING.md -rw-r--r-- 23.4 KB
HISTORY.md -rw-r--r-- 372.8 KB
LICENSE.md -rw-r--r-- 1.3 KB
Make.inc -rw-r--r-- 55.9 KB
Makefile -rw-r--r-- 30.3 KB
NEWS.md -rw-r--r-- 8.8 KB
README.md -rw-r--r-- 7.4 KB
THIRDPARTY.md -rw-r--r-- 3.8 KB
VERSION -rw-r--r-- 11 bytes
julia.spdx.json -rw-r--r-- 35.8 KB
pkgimage.mk -rw-r--r-- 5.8 KB
sysimage.mk -rw-r--r-- 4.2 KB
typos.toml -rw-r--r-- 78 bytes

README.md

back to top