Skip to content

Commit

Permalink
Update conjugategradient.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbeckers committed Feb 7, 2024
1 parent 36df42b commit a03fe4c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/conjugategradient.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ function conjugategradient(
fun!(x, Ap)
r = b - Ap


#TEST
#@show (r ⋅ (r+b))/((r+b) ⋅ (r+b)),(b ⋅ (r+b))/((r+b) ⋅ (r+b)),r⋅r,b⋅b

###########
if deflation
projectPx!(r)
Expand All @@ -249,9 +253,9 @@ function conjugategradient(
###JMB: it appears that if you use a good solution or very small values
### the residue might be much larger than b because of the ill conditionningg
###
### In this case, rather decide to stop based on error reduction
### In this case, rather decide to stop
#@show tol2,tol,r2
tol2=max(tol2,r2*tol^2)
tol2=max(tol2,((r+b) (r+b))*tol^2)
###

# apply preconditioner
Expand Down

0 comments on commit a03fe4c

Please sign in to comment.