22
33from pyproximal .ProxOperator import _check_tau
44from pyproximal import ProxOperator
5+ from pyproximal .proximal .L1 import _current_sigma
56
67
78def _l2 (x , thresh ):
@@ -26,34 +27,27 @@ def _l2(x, thresh):
2627 return y
2728
2829
29- def _current_sigma (sigma , count ):
30- if not callable (sigma ):
31- return sigma
32- else :
33- return sigma (count )
34-
35-
3630def _current_kappa (kappa , count ):
3731 if not callable (kappa ):
3832 return kappa
3933 else :
4034 return kappa (count )
4135
4236
43- class rMS (ProxOperator ):
44- r"""relaxed Mumford-Shoh norm proximal operator.
37+ class RelaxedMumfordShah (ProxOperator ):
38+ r"""Relaxed Mumford-Shah norm proximal operator.
4539
4640 Proximal operator of the relaxed Mumford-Shah norm:
47- :math:`\text{rMS}(x) = \min (\alpha\Vert x\Vert_2^2, \kappa). `.
41+ :math:`\text{rMS}(x) = \min (\alpha\Vert x\Vert_2^2, \kappa)`.
4842
4943 Parameters
5044 ----------
5145 sigma : :obj:`float` or :obj:`list` or :obj:`np.ndarray` or :obj:`func`, optional
52- Multiplicative coefficient of L2 norm that controls the smoothness. This can be a constant number, a list
53- of values (for multidimensional inputs, acting on the second dimension) or
54- a function that is called passing a counter which keeps track of how many
55- times the ``prox`` method has been invoked before and returns a scalar (or a list of)
56- ``sigma`` to be used.
46+ Multiplicative coefficient of L2 norm that controls the smoothness of the solutuon.
47+ This can be a constant number, a list of values (for multidimensional inputs, acting
48+ on the second dimension) or a function that is called passing a counter which keeps
49+ track of how many times the ``prox`` method has been invoked before and returns a
50+ scalar (or a list of) ``sigma`` to be used.
5751 kappa : :obj:`float` or :obj:`list` or :obj:`np.ndarray` or :obj:`func`, optional
5852 Constant value in the rMS norm which essentially controls when the norm allows a jump. This can be a
5953 constant number, a list of values (for multidimensional inputs, acting on the second dimension) or
@@ -65,12 +59,12 @@ class rMS(ProxOperator):
6559
6660 Notes
6761 -----
68- The :math:`\ell_1 ` proximal operator is defined as [1]_:
62+ The :math:`rMS ` proximal operator is defined as [1]_:
6963
7064 .. math::
71- \text{prox}_{\text{rMS}}(x) =
65+ \text{prox}_{\tau \ text{rMS}}(x) =
7266 \begin{cases}
73- \frac{1}{1+2\alpha}x & \text{ if } & \vert x\vert \leq \sqrt{\frac{\kappa}{\alpha}(1 + 2\alpha)} \\
67+ \frac{1}{1+2\tau\ alpha}x & \text{ if } & \vert x\vert \leq \sqrt{\frac{\kappa}{\alpha}(1 + 2\tau \alpha)} \\
7468 \kappa & \text{ else }
7569 \end{cases}.
7670
@@ -89,7 +83,7 @@ def __init__(self, sigma=1., kappa=1., g=None):
8983 def __call__ (self , x ):
9084 sigma = _current_sigma (self .sigma , self .count )
9185 kappa = _current_sigma (self .kappa , self .count )
92- return np .minimum (sigma * np .linalg .norm (x )** 2 , kappa )
86+ return np .minimum (sigma * np .linalg .norm (x ) ** 2 , kappa )
9387
9488 def _increment_count (func ):
9589 """Increment counter
@@ -107,10 +101,3 @@ def prox(self, x, tau):
107101
108102 x = np .where (np .abs (x ) <= np .sqrt (kappa / sigma * (1 + 2 * tau * sigma )), _l2 (x , tau * sigma ), x )
109103 return x
110-
111- @_check_tau
112- def proxdual (self , x , tau ):
113- # x - tau * self.prox(x / tau, 1. / tau)
114- x = self ._proxdual_moreau (x , tau )
115-
116- return x
0 commit comments