diff --git a/src/R2_alg.jl b/src/R2_alg.jl index 202b9f95..0ccb443c 100644 --- a/src/R2_alg.jl +++ b/src/R2_alg.jl @@ -290,10 +290,10 @@ function R2!( ξ = hk - mks + max(1, abs(hk)) * 10 * eps() if ξ ≥ 0 && k == 1 - ϵ += ϵr * sqrt(ξ) # make stopping test absolute and relative + ϵ += ϵr * sqrt(ξ/ν) # make stopping test absolute and relative end - if (ξ < 0 && sqrt(-ξ) ≤ neg_tol) || (ξ ≥ 0 && sqrt(ξ) ≤ ϵ) + if (ξ < 0 && sqrt(-ξ/ν) ≤ neg_tol) || (ξ ≥ 0 && sqrt(ξ/ν) ≤ ϵ) optimal = true continue end @@ -310,7 +310,8 @@ function R2!( if (verbose > 0) && (k % ptf == 0) #! format: off σ_stat = (η2 ≤ ρk < Inf) ? "↘" : (ρk < η1 ? "↗" : "=") - @info @sprintf "%6d %8.1e %8.1e %7.1e %8.1e %7.1e %7.1e %7.1e %1s" k fk hk sqrt(ξ) ρk σk norm(xk) norm(s) σ_stat + @info @sprintf "%6d %8.1e %8.1e %7.1e %8.1e %7.1e %7.1e %7.1e %1s" k fk hk sqrt(ξ/ν) ρk σk norm(xk) norm(s) σ_stat + #! format: on end @@ -347,9 +348,9 @@ function R2!( @info @sprintf "%6d %8.1e %8.1e" k fk hk elseif optimal #! format: off - @info @sprintf "%6d %8.1e %8.1e %7.1e %8s %7.1e %7.1e %7.1e" k fk hk sqrt(ξ) "" σk norm(xk) norm(s) + @info @sprintf "%6d %8.1e %8.1e %7.1e %8s %7.1e %7.1e %7.1e" k fk hk sqrt(ξ/ν) "" σk norm(xk) norm(s) #! format: on - @info "R2: terminating with √ξ = $(sqrt(ξ))" + @info "R2: terminating with √ξ/√ν = $(sqrt(ξ/ν))" end end