Skip to content

Commit

Permalink
Generalize how the infinite norm is computed in non-linear solvers
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiManyer committed Aug 30, 2023
1 parent 578f5b7 commit 1b75c53
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/Algebra/NLSolvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,13 @@ function _solve_nr!(x,A,b,dx,ns,nls,op)
end

function _check_convergence(nls,b)
m0 = _inf_norm(b)
(false, m0)
m0 = maximum(abs,b)
return (false, m0)
end

function _check_convergence(nls,b,m0)
m = _inf_norm(b)
m < nls.tol * m0
end

function _inf_norm(b)
m = 0
for bi in b
m = max(m,abs(bi))
end
m
m = maximum(abs,b)
return m < nls.tol * m0
end

# Default concrete implementation
Expand Down

0 comments on commit 1b75c53

Please sign in to comment.