Skip to content

Commit

Permalink
Fix objective function
Browse files Browse the repository at this point in the history
  • Loading branch information
frankong committed Jun 12, 2019
1 parent d32a309 commit 4ea3819
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sigpy/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,15 +394,18 @@ def objective(self):
with self.y_device:
r = self.A(self.x) - self.y

obj = 1 / 2 * util.norm2(r)
obj = 1 / 2 * self.y_device.xp.linalg.norm(r).item()**2
if self.lamda > 0:
if self.R is None:
obj += self.lamda / 2 * util.norm2(self.x)
obj += self.lamda / 2 * self.x_device.xp.linalg.norm(
self.x).item()**2
else:
obj += self.lamda / 2 * util.norm2(self.R(self.x))
obj += self.lamda / 2 * self.x_device.xp.linalg.norm(
self.R(self.x)).item()**2

if self.mu != 0:
obj += self.mu / 2 * util.norm2(self.x - self.z)
obj += self.mu / 2 * self.x_device.xp.linalg.norm(
self.x - self.z).item()**2

if self.proxg is not None:
if self.g is None:
Expand All @@ -415,7 +418,6 @@ def objective(self):
else:
obj += self.g(self.G(self.x))

obj = util.asscalar(obj)
return obj


Expand Down

0 comments on commit 4ea3819

Please sign in to comment.