Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize how the infinite norm is computed in non-linear solvers #940

Merged
merged 3 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Using Broadcasting(\circ) instead of \circ in one of the lazy_maps used to transform a coarse field into a fine field. Since PR [#938](https://github.com/gridap/Gridap.jl/pull/938).
- Better infinite norm computation in `Algebra._check_convergence`. Now works for any `AbstractArray` type, including `PVector`. Since PR [#940](https://github.com/gridap/Gridap.jl/pull/940).

## [0.17.19] - 2023-08-23

Expand Down
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
Loading