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 {
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 {
if (x.two_norm() <
1e-8 or std::isinf(func_->regularity(x.two_norm()))) // TODO
double const xnorm = x.two_norm();
if (xnorm < 1e-8 or std::isinf(func_->regularity(xnorm))) // TODO
return;
VectorType tmp;
upperGradient(x, tmp); // upper and lower gradient coincide in this case
y += tmp;
// left and right differential coincide in this case
y.axpy(func_->rightDifferential(xnorm) / xnorm, x);
}
void upperGradient(VectorType const &x, VectorType &ret) const {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment