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

Return zero at zero (for gradient/hessian)

parent 5c7924a5
No related branches found
No related tags found
No related merge requests found
...@@ -62,6 +62,9 @@ template <int dimension> class LocalNonlinearity { ...@@ -62,6 +62,9 @@ template <int dimension> class LocalNonlinearity {
= (h2 - h1ox) * x[i] * x[j] / normX2 = (h2 - h1ox) * x[i] * x[j] / normX2
*/ */
void addHessian(VectorType const &x, MatrixType &A) const { void addHessian(VectorType const &x, MatrixType &A) const {
if (x == VectorType(0))
return;
double const normX2 = x.two_norm2(); double const normX2 = x.two_norm2();
double const normX = sqrt(normX2); double const normX = sqrt(normX2);
double const h1ox = func_->rightDifferential(normX) / normX; double const h1ox = func_->rightDifferential(normX) / normX;
...@@ -79,6 +82,9 @@ template <int dimension> class LocalNonlinearity { ...@@ -79,6 +82,9 @@ template <int dimension> class LocalNonlinearity {
} }
void addGradient(VectorType const &x, VectorType &y) const { void addGradient(VectorType const &x, VectorType &y) const {
if (x == VectorType(0))
return;
VectorType tmp; VectorType tmp;
upperGradient(x, tmp); // TODO upperGradient(x, tmp); // TODO
y += tmp; y += tmp;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment