Skip to content

Commit 7022fb2

Browse files
leburgelJutho
andcommitted
Update src/pullbacks/eigh.jl
Co-authored-by: Jutho <Jutho@users.noreply.github.com>
1 parent 47fc913 commit 7022fb2

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎src/pullbacks/eigh.jl‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,10 @@ function eigh_pullback!(
8888
# For k ≤ n / 2, applying these two blocks directly, in O(n² k), is faster than forming VᴴΔAV.
8989
ind′ = select_indices(axes(D, 1), ind)
9090
if 2 * length(ind′) <= n
91-
Xʳ = copy(VᴴΔAVₖ)
92-
Xʳ[ind′, :] .= zero(eltype(Xʳ)) # these entries are part of the columns ind′
9391
Vₖ = view(V, :, ind′)
9492
ΔA = mul!(ΔA, V * VᴴΔAVₖ, Vₖ', 1, 1)
95-
ΔA = mul!(ΔA, Vₖ, Xʳ' * V', 1, 1)
93+
VᴴΔAVₖ[ind′, :] .= zero(eltype(VᴴΔAVₖ))
94+
ΔA = mul!(ΔA, Vₖ, VᴴΔAVₖ' * V', 1, 1)
9695
else
9796
if is_leading_index(ind′, n) # NOTE: all columns in order (e.g. `ind = Colon()`): the original path
9897
VᴴΔAV = VᴴΔAVₖ

0 commit comments

Comments
 (0)