Skip to content

Commit

Permalink
Use the macro kfill
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Oct 16, 2024
1 parent 78732f8 commit 9629c43
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/usymlqr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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₀ ]
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9629c43

Please sign in to comment.