From 9c2dc4cd38ec0efe098bdf128dce3d2961e42e3d Mon Sep 17 00:00:00 2001 From: "Gregory L. Wagner" Date: Tue, 15 Oct 2024 15:39:49 -0600 Subject: [PATCH 1/4] Use `kcopy!` and `fill!` instead of broadcasting --- src/cg.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cg.jl b/src/cg.jl index 29cd813ad..a8c01ccb4 100644 --- a/src/cg.jl +++ b/src/cg.jl @@ -133,15 +133,15 @@ kwargs_cg = (:M, :ldiv, :radius, :linesearch, :atol, :rtol, :itmax, :timemax, :v reset!(stats) z = MisI ? r : solver.z - x .= zero(FC) + fill!(x, zero(FC)) if warm_start mul!(r, A, Δx) @kaxpby!(n, one(FC), b, -one(FC), r) else - r .= b + @kcopy!(r, b) end MisI || mulorldiv!(z, M, r, ldiv) - p .= z + @kcopy!(p, z) γ = @kdotr(n, r, z) rNorm = sqrt(γ) history && push!(rNorms, rNorm) @@ -182,7 +182,7 @@ kwargs_cg = (:M, :ldiv, :radius, :linesearch, :atol, :rtol, :itmax, :timemax, :v inconsistent = !linesearch end if linesearch - iter == 0 && (x .= b) + iter == 0 && (kcopy!(x, b)) solved = true end end From 7c637642c4582042ac55cbd998b4ed29d53f57c2 Mon Sep 17 00:00:00 2001 From: "Gregory L. Wagner" Date: Tue, 15 Oct 2024 15:40:59 -0600 Subject: [PATCH 2/4] Update src/cg.jl --- src/cg.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cg.jl b/src/cg.jl index a8c01ccb4..a9ba039a3 100644 --- a/src/cg.jl +++ b/src/cg.jl @@ -141,7 +141,7 @@ kwargs_cg = (:M, :ldiv, :radius, :linesearch, :atol, :rtol, :itmax, :timemax, :v @kcopy!(r, b) end MisI || mulorldiv!(z, M, r, ldiv) - @kcopy!(p, z) + @kcopy!(n, p, z) γ = @kdotr(n, r, z) rNorm = sqrt(γ) history && push!(rNorms, rNorm) From f1c9ff8331727ab5388fc65ce174ad76c14351c6 Mon Sep 17 00:00:00 2001 From: "Gregory L. Wagner" Date: Tue, 15 Oct 2024 15:41:16 -0600 Subject: [PATCH 3/4] Update src/cg.jl --- src/cg.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cg.jl b/src/cg.jl index a9ba039a3..4238a4c4f 100644 --- a/src/cg.jl +++ b/src/cg.jl @@ -182,7 +182,7 @@ kwargs_cg = (:M, :ldiv, :radius, :linesearch, :atol, :rtol, :itmax, :timemax, :v inconsistent = !linesearch end if linesearch - iter == 0 && (kcopy!(x, b)) + iter == 0 && (@kcopy!(n, x, b)) solved = true end end From ce38110ce79d26b1e8ba55ec2c44f39f6f9d9ee8 Mon Sep 17 00:00:00 2001 From: "Gregory L. Wagner" Date: Tue, 15 Oct 2024 15:41:27 -0600 Subject: [PATCH 4/4] Update src/cg.jl --- src/cg.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cg.jl b/src/cg.jl index 4238a4c4f..a2c4d84a8 100644 --- a/src/cg.jl +++ b/src/cg.jl @@ -138,7 +138,7 @@ kwargs_cg = (:M, :ldiv, :radius, :linesearch, :atol, :rtol, :itmax, :timemax, :v mul!(r, A, Δx) @kaxpby!(n, one(FC), b, -one(FC), r) else - @kcopy!(r, b) + @kcopy!(n, r, b) end MisI || mulorldiv!(z, M, r, ldiv) @kcopy!(n, p, z)