Commit e7b2a8a
Specialize Diagonal * Adjoint (#1207)
This reinstates slightly altered versions of the methods that were
removed in JuliaLang/julia#52389. Sort of fixes
#1205, although this doesn't recover the full performance. However, this
version is more general, and works with the example presented in
JuliaLang/julia#52389. There's still a
performance regression, but the full performance may only be obtained
for mutable matrices, and we may not assume mutability in general.
Performance:
v1.10:
```julia
julia> n = 100
100
julia> A = adjoint(sparse(Float64, I, n, n));
julia> B = Diagonal(ones(n));
julia> @Btime $A * $B;
837.119 ns (5 allocations: 2.59 KiB)
```
This PR
```julia
julia> @Btime $A * $B;
1.106 μs (15 allocations: 5.56 KiB)
```
We need double the allocations here compared to earlier, as we firstly
materialize `D' * A'`, and then we again copy the adjoint of this
result. I wonder if this may be reduced.
---------
Co-authored-by: Daniel Karrasch <[email protected]>1 parent e7da19f commit e7b2a8a
2 files changed
+24
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
323 | | - | |
| 322 | + | |
| 323 | + | |
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
335 | 357 | | |
336 | 358 | | |
337 | 359 | | |
| |||
0 commit comments