Skip to content

Commit

Permalink
Add prox vec L05 (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathurinm authored Feb 5, 2024
1 parent 1dcbfff commit 946e30a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions skglm/penalties/separable.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,12 @@ def prox_1d(self, value, stepsize, j):
"""Compute the proximal operator of L0_5."""
return prox_05(value, self.alpha * stepsize)

def prox_vec(self, x, stepsize):
res = np.zeros_like(x)
for j in range(x.shape[0]):
res[j] = self.prox_1d(x[j], stepsize, j)
return res

def subdiff_distance(self, w, grad, ws):
"""Compute distance of negative gradient to the subdifferential at w."""
subdiff_dist = np.zeros_like(grad)
Expand Down

0 comments on commit 946e30a

Please sign in to comment.