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

Fix important bug in directionalSubDiff

The directional subdifferential is assumed to be taken with respect to
a coordinate system in which v is a unit vector judging by the
implementation of subDiff in directionalconvexfunction.hh

If we do not take that into consideration, subDiff() will mix input
from two different coordinate systems and return something meaningless

As long as we only care about the sign we need not perform any
back-transformation!
parent b8fcd455
No related branches found
No related tags found
No related merge requests found
......@@ -32,10 +32,9 @@ class MyNonlinearity {
return;
}
double const un = u.two_norm();
double const ndotp = (u * v) / (un * v.two_norm());
double const ndotp = (u * v) / un;
// Our coordinate system is now such that v is a unit vector!
if (ndotp > 0) {
// If we had |v| = 1, this would be
// <f'_pm(|u|)*u/|u|,v>
D[1] = ndotp * func_.rightDifferential(un);
D[0] = ndotp * func_.leftDifferential(un);
} else {
......
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