Skip to content

Commit

Permalink
Response to review
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-T-McCann committed Jan 19, 2022
1 parent 0f3316c commit b2246cd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/source/functional.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ An instance of :class:`.Functional`, ``f``, may provide three core operations.
* Proximal operator
- ``f.prox(v, lam)`` returns the result of the scaled proximal
operator of ``f``, i.e., the proximal operator of ``lambda x:
lam * f(x)``, evaulated at the point ``v``.
lam * f(x)``, evaluated at the point ``v``.
- The proximal operator of a functional :math:`f : \mathbb{R}^n \to
\mathbb{R}` is the mapping :math:`\mathrm{prox}_f : \mathbb{R}^n
\to \mathbb{R}^n` defined as
Expand Down
6 changes: 3 additions & 3 deletions scico/functional/_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def prox(
lam: Proximal parameter :math:`\lambda`.
kwargs: Additional arguments that may be used by derived
classes. These include ``x0``, an initial guess for the
minimizer.
minimizer in the defintion of :math:`\mathrm{prox}`.
"""
if not self.has_prox:
Expand Down Expand Up @@ -240,8 +240,8 @@ def prox(self, v: BlockArray, lam: float = 1.0, **kwargs) -> BlockArray:
v: Input array :math:`\mb{v}`.
lam: Proximal parameter :math:`\lambda`.
kwargs: Additional arguments that may be used by derived
classes. These include ``x0``, an initial guess for the
minimizer.
classes.
"""
if len(v.shape) == len(self.functional_list):
return BlockArray.array([fi.prox(vi, lam) for fi, vi in zip(self.functional_list, v)])
Expand Down
11 changes: 6 additions & 5 deletions scico/functional/_indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def prox(
self, v: Union[JaxArray, BlockArray], lam: float = 1.0, **kwargs
) -> Union[JaxArray, BlockArray]:
r"""Evaluate the scaled proximal operator of the indicator over
the non-negative orthant:
the non-negative orthant, :math:`I`,:
.. math::
[\mathrm{prox}_{\lambda I}(\mb{v})]_i =
Expand All @@ -64,8 +64,8 @@ def prox(
v : Input array :math:`\mb{v}`.
lam : Proximal parameter :math:`\lambda` (has no effect).
kwargs: Additional arguments that may be used by derived
classes. These include ``x0``, an initial guess for the
minimizer.
classes.
"""
return snp.maximum(v, 0)

Expand Down Expand Up @@ -107,10 +107,11 @@ def prox(
self, v: Union[JaxArray, BlockArray], lam: float = 1.0, **kwargs
) -> Union[JaxArray, BlockArray]:
r"""Evalulate the scaled proximal operator of the indicator over
a :math:`\ell_2` ball with radius :math:`r` = `self.radius`.
a :math:`\ell_2` ball with radius :math:`r` = `self.radius`,
:math:`I`:
.. math::
\mathrm{prox}_{\lambda I}(\mb{v}) = r \frac{\mb{v}}{\norm{\mb{v}}_2}
\mathrm{prox}_{\lambda I}(\mb{v}) = r \frac{\mb{v}}{\norm{\mb{v}}_2}\;.
"""
return self.radius * v / norm(v)
7 changes: 3 additions & 4 deletions scico/functional/_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ def prox(
v: Input array :math:`\mb{v}`.
lam: Proximal parameter :math:`\lambda`.
kwargs: Additional arguments that may be used by derived
classes. These include ``x0``, an initial guess for the
minimizer.
classes.
"""
norm_v = norm(v)
Expand Down Expand Up @@ -248,8 +247,8 @@ def prox(
v: Input array :math:`\mb{v}`.
lam: Proximal parameter :math:`\lambda`.
kwargs: Additional arguments that may be used by derived
classes. These include ``x0``, an initial guess for the
minimizer.
classes.
"""

length = norm(v, axis=self.l2_axis, keepdims=True)
Expand Down

0 comments on commit b2246cd

Please sign in to comment.