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

Use axpy

parent f5cb35fe
No related branches found
No related tags found
No related merge requests found
...@@ -88,15 +88,13 @@ template <int dimension> class LocalNonlinearity { ...@@ -88,15 +88,13 @@ template <int dimension> class LocalNonlinearity {
A[k][k] += (h2 - h1ox) * x[k] * x[k] / normX2 + h1ox; A[k][k] += (h2 - h1ox) * x[k] * x[k] / normX2 + h1ox;
} }
// TODO: do not evaluate at zero
void addGradient(VectorType const &x, VectorType &y) const { void addGradient(VectorType const &x, VectorType &y) const {
if (x.two_norm() < double const xnorm = x.two_norm();
1e-8 or std::isinf(func_->regularity(x.two_norm()))) // TODO if (xnorm < 1e-8 or std::isinf(func_->regularity(xnorm))) // TODO
return; return;
VectorType tmp; // left and right differential coincide in this case
upperGradient(x, tmp); // upper and lower gradient coincide in this case y.axpy(func_->rightDifferential(xnorm) / xnorm, x);
y += tmp;
} }
void upperGradient(VectorType const &x, VectorType &ret) const { void upperGradient(VectorType const &x, VectorType &ret) const {
......
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