Skip to content

Commit 9809201

Browse files
committed
bug: avoid using matvec in LowRankFactorizedMatrix when n=m
1 parent d6dd475 commit 9809201

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pyproximal/utils/bilinear.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ def _matvecy(self, y):
129129
return X.ravel()
130130

131131
def matvec(self, x):
132+
if self.n == self.m:
133+
raise NotImplementedError('Since n=m, this method'
134+
'cannot distinguish automatically'
135+
'between _matvecx and _matvecy. '
136+
'Explicitely call either of those two methods.')
132137
if x.size == self.shapex[1]:
133138
y = self._matvecx(x)
134139
else:
@@ -150,7 +155,7 @@ def ly(self, y):
150155
return np.linalg.norm(np.conj(Y).T @ Y, 'fro')
151156

152157
def gradx(self, x):
153-
r = self.d - self.matvec(x)
158+
r = self.d - self._matvecx(x)
154159
if self.Op is not None:
155160
r = (self.Op.H @ r).reshape(self.n, self.m)
156161
else:
@@ -159,7 +164,7 @@ def gradx(self, x):
159164
return g.ravel()
160165

161166
def grady(self, y):
162-
r = self.d - self.matvec(y)
167+
r = self.d - self._matvecy(y)
163168
if self.Op is not None:
164169
r = (self.Op.H @ r.ravel()).reshape(self.n, self.m)
165170
else:

0 commit comments

Comments
 (0)