From a1ee4ccb6083d00647727a6a7c9b2e3131499952 Mon Sep 17 00:00:00 2001 From: Elias Pipping <elias.pipping@fu-berlin.de> Date: Mon, 12 Sep 2011 19:06:39 +0200 Subject: [PATCH] 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! --- src/mynonlinearity.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mynonlinearity.cc b/src/mynonlinearity.cc index 1a09904e..0b6489ba 100644 --- a/src/mynonlinearity.cc +++ b/src/mynonlinearity.cc @@ -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 { -- GitLab