Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy parent in copy_similar for Symmetric/Hermitian (#54473)
This should be equivalent to copying the `Symmetric`/`Hermitian` matrix, as only one triangular half is used. However, this reduces latency when the parent is a `Matrix` (and possibly others too, although I've not checked this). ```julia julia> using LinearAlgebra julia> A = rand(2,2); H = Hermitian(A); julia> @time eigen(H); 0.342207 seconds (440.61 k allocations: 22.926 MiB, 99.95% compilation time) # nightly 0.260913 seconds (326.62 k allocations: 16.926 MiB, 99.93% compilation time) # This PR ``` Copying the parent is also marginally faster, although this doesn't really matter in `eigen`: ```julia julia> A = rand(1000,1000); H = Hermitian(A); julia> @Btime LinearAlgebra.copy_similar($H, Float64); 1.839 ms (3 allocations: 7.63 MiB) # nightly 1.760 ms (3 allocations: 7.63 MiB) # This PR ``` --------- Co-authored-by: Daniel Karrasch <daniel.karrasch@posteo.de>
- Loading branch information