From 946e30a23fcf98ba8810723b1a17823b3e8df23a Mon Sep 17 00:00:00 2001 From: mathurinm Date: Mon, 5 Feb 2024 13:13:55 +0100 Subject: [PATCH] Add prox vec L05 (#222) --- skglm/penalties/separable.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/skglm/penalties/separable.py b/skglm/penalties/separable.py index ee45eca88..c7d8d0bd7 100644 --- a/skglm/penalties/separable.py +++ b/skglm/penalties/separable.py @@ -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)