Skip to content

Commit

Permalink
Fix power_iterations for CuArrays
Browse files Browse the repository at this point in the history
  • Loading branch information
nHackel committed Apr 3, 2024
1 parent 3edb4b6 commit d923459
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,10 @@ Power iterations to determine the maximum eigenvalue of a normal operator or squ
maximum eigenvalue of the operator
"""
function power_iterations(AᴴA; rtol=1e-2, maxiter=30, verbose=false)
b = randn(eltype(AᴴA), size(AᴴA,2))
# Creating b like this allows instead of directly randn it to become a CuArray
b = similar(AᴴA, size(AᴴA, 2))
b[:] = randn(eltype(AᴴA), size(AᴴA, 2))

bᵒˡᵈ = similar(b)
λ = Inf

Expand Down

0 comments on commit d923459

Please sign in to comment.