From 3204f95800e5827b39dd1953e6dc163c4254449e Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Tue, 15 Oct 2024 23:47:26 -0500 Subject: [PATCH] Use the macro kfill --- src/usymlqr.jl | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/usymlqr.jl b/src/usymlqr.jl index 9c67a0a03..c1b71ca2f 100644 --- a/src/usymlqr.jl +++ b/src/usymlqr.jl @@ -173,13 +173,15 @@ kwargs_usymlqr = (:transfer_to_usymcg, :M, :N, :ldiv, :atol, :rtol, :itmax, :tim iter = 0 itmax == 0 && (itmax = n+m) - # Initial solutions x₀ and y₀. - xₖ .= zero(T) - yₖ .= zero(T) + # Initial solutions r₀, x₀, y₀ and z₀. + @kfill!(rₖ, zero(FC)) + @kfill!(xₖ, zero(FC)) + @kfill!(yₖ, zero(FC)) + @kfill!(zₖ, zero(FC)) # Initialize preconditioned orthogonal tridiagonalization process. - M⁻¹uₖ₋₁ .= zero(T) # u₀ = 0 - N⁻¹vₖ₋₁ .= zero(T) # v₀ = 0 + @kfill!(M⁻¹uₖ₋₁, zero(FC)) # u₀ = 0 + @kfill!(N⁻¹vₖ₋₁, zero(FC)) # v₀ = 0 # [ I A ] [ xₖ ] = [ b - Δx - AΔy ] = [ b₀ ] # [ Aᴴ ] [ yₖ ] [ c - AᴴΔx ] [ c₀ ] @@ -220,10 +222,10 @@ kwargs_usymlqr = (:transfer_to_usymcg, :M, :N, :ldiv, :atol, :rtol, :itmax, :tim cₖ₋₂ = cₖ₋₁ = cₖ = one(T) # Givens cosines used for the QR factorization of Tₖ₊₁.ₖ sₖ₋₂ = sₖ₋₁ = sₖ = zero(FC) # Givens sines used for the QR factorization of Tₖ₊₁.ₖ - wₖ₋₂ .= zero(FC) # Column k-2 of Wₖ = Vₖ(Rₖ)⁻¹ - wₖ₋₁ .= zero(FC) # Column k-1 of Wₖ = Vₖ(Rₖ)⁻¹ + @kfill!(wₖ₋₂, zero(FC)) # Column k-2 of Wₖ = Vₖ(Rₖ)⁻¹ + @kfill!(wₖ₋₁, zero(FC)) # Column k-1 of Wₖ = Vₖ(Rₖ)⁻¹ ϕbarₖ = βₖ # ϕbarₖ is the last component of f̄ₖ = (Qₖ)ᴴβ₁e₁ - d̅ .= zero(FC) # Last column of D̅ₖ = UₖQₖ + @kfill!(d̅, zero(FC)) # Last column of D̅ₖ = UₖQₖ ηₖ₋₁ = ηbarₖ = zero(FC) # ηₖ₋₁ and ηbarₖ are the last components of h̄ₖ = (Rₖ)⁻ᵀγ₁e₁ ηₖ₋₂ = θₖ = zero(FC) # ζₖ₋₂ and θₖ are used to update ηₖ₋₁ and ηbarₖ δbarₖ₋₁ = δbarₖ = zero(FC) # Coefficients of Rₖ₋₁ and Rₖ modified over the course of two iterations