Skip to content

Commit

Permalink
Improve rNorm estimate in CR
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Aug 29, 2022
1 parent a08e934 commit 569d9d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/cr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,14 @@ function cr!(solver :: CrSolver{T,FC,S}, A, b :: AbstractVector{FC};
xNorm = @knrm2(n, x)
xNorm radius && (on_boundary = true)
@kaxpy!(n, -α, Mq, r) # residual
rNorm² = abs(rNorm² - α * ρ)
rNorm = sqrt(rNorm²)
if MisI
rNorm² = @kdotr(n, r, r)
rNorm = sqrt(rNorm²)
else
ω = sqrt(α) * sqrt(ρ)
rNorm = sqrt(abs(rNorm + ω)) * sqrt(abs(rNorm - ω))
rNorm² = rNorm * rNorm # rNorm² = rNorm² - α * ρ
end
history && push!(rNorms, rNorm)
mul!(Ar, A, r)
ArNorm = @knrm2(n, Ar)
Expand Down
1 change: 0 additions & 1 deletion test/test_cr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
@test(resid cr_tol)
@test(stats.solved)


# test callback function
A, b = symmetric_definite(FC=FC)
solver = CrSolver(A, b)
Expand Down

0 comments on commit 569d9d9

Please sign in to comment.