Skip to content

Commit

Permalink
Use similar for dynamic allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Jan 18, 2025
1 parent 292a51d commit 4a5ba1c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/fgmres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ kwargs_fgmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :i
end
push!(s, zero(FC))
push!(c, zero(T))
push!(Z, S(undef, n))
push!(Z, similar(solver.x))
end

# Continue the process.
Expand Down
2 changes: 1 addition & 1 deletion src/fom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ kwargs_fom = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :itma
# Compute vₖ₊₁.
if !(solved || inner_tired || breakdown || user_requested_exit || overtimed)
if !restart && (inner_iter mem)
push!(V, S(undef, n))
push!(V, similar(solver.x))
end
V[inner_iter+1] .= q ./ Hbis # hₖ₊₁.ₖvₖ₊₁ = q
end
Expand Down
2 changes: 1 addition & 1 deletion src/gmres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ kwargs_gmres = (:M, :N, :ldiv, :restart, :reorthogonalization, :atol, :rtol, :it
# Compute vₖ₊₁.
if !(solved || inner_tired || breakdown || user_requested_exit || overtimed)
if !restart && (inner_iter mem)
push!(V, S(undef, n))
push!(V, similar(solver.x))
push!(z, zero(FC))
end
V[inner_iter+1] .= q ./ Hbis # hₖ₊₁.ₖvₖ₊₁ = q
Expand Down
4 changes: 2 additions & 2 deletions src/gpmr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@ kwargs_gpmr = (:C, :D, :E, :F, :ldiv, :gsp, :λ, :μ, :reorthogonalization, :ato
# Compute vₖ₊₁ and uₖ₊₁
if !(solved || tired || breakdown || user_requested_exit || overtimed)
if iter mem
push!(V, S(undef, m))
push!(U, S(undef, n))
push!(V, similar(solver.x))
push!(U, similar(solver.y))
push!(zt, zero(FC), zero(FC))
end

Expand Down

0 comments on commit 4a5ba1c

Please sign in to comment.