Skip to content

Commit

Permalink
speed up power iterations
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobAsslaender committed Nov 25, 2023
1 parent f7e70e0 commit da8483c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,12 @@ function power_iterations(AᴴA; rtol=1e-2, maxiter=30, verbose=false)

for i = 1:maxiter
b ./= norm(b)
copy!(bᵒˡᵈ, b)

# swap b and bᵒˡᵈ (pointers only, no data is moved or allocated)
bᵗᵐᵖ = bᵒˡᵈ
bᵒˡᵈ = b
b = bᵗᵐᵖ

mul!(b, AᴴA, bᵒˡᵈ)

λᵒˡᵈ = λ
Expand Down

0 comments on commit da8483c

Please sign in to comment.