Skip to content
Snippets Groups Projects
Commit 4a6bfd46 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Do not truncate the gradient out-of-place

x/|x| is only a problem if x == 0
just divide by |x|, no matter what non-zero value it is
parent ab4aec9e
No related branches found
No related tags found
No related merge requests found
...@@ -89,7 +89,7 @@ template <int dimension> class LocalNonlinearity { ...@@ -89,7 +89,7 @@ template <int dimension> class LocalNonlinearity {
void addGradient(VectorType const &x, VectorType &y) const { void addGradient(VectorType const &x, VectorType &y) const {
double const xnorm = x.two_norm(); double const xnorm = x.two_norm();
if (xnorm < 1e-8 or std::isinf(func_->regularity(xnorm))) // TODO if (xnorm == 0 or std::isinf(func_->regularity(xnorm)))
return; return;
// left and right differential coincide in this case // left and right differential coincide in this case
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment