Skip to content

Commit

Permalink
Merge branch 'master' into fista-second-term
Browse files Browse the repository at this point in the history
  • Loading branch information
MargaretDuff authored Dec 20, 2023
2 parents 9544314 + a754e68 commit 364d66e
Show file tree
Hide file tree
Showing 16 changed files with 588 additions and 267 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/conda_and_docs_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
with:
fetch-depth: 0
- name: conda-build
uses: paskino/conda-package-publish-action@v1.4.4
uses: TomographicImaging/conda-package-publish-action@v2
with:
subDir: recipe
channels: -c conda-forge -c intel -c ccpi
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
* x.x.x
- Added a weight argument to the L1Norm function
- Allow reduction methods on the DataContainer class to accept axis argument as string which matches values in dimension_labels
- Added the functions `set_norms` and `get_norms` to the `BlockOperator` class
- Internal variable name change in BlockOperator to aid understanding
- Fixed formatting errors in the L2NormSquared and LeastSquares documentation
- Bug fix for BlockDataContainer as iterator
- Dropped support for IPP versions older than 2021.10 due to header changes
- Fix build include directories
- proximal of MixedL21Norm with numpy backend now accepts numpy ndarray, DataContainer and float as tau parameter
- Proximal of MixedL21Norm with numpy backend now accepts numpy ndarray, DataContainer and float as tau parameter
- ZeroOperator no longer relies on the default of allocate
- Bug fix in SIRF TotalVariation unit tests with warm_start
- Allow show2D to be used with 3D `DataContainer` instances

* 23.1.0
- Fix bug in IndicatorBox proximal_conjugate
- Allow CCPi Regulariser functions for non CIL object
Expand Down
2 changes: 2 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Institutions Key:
8 - UES Inc.
9 - Swansea University
10 - University of Warwick
11 - University of Helsinki

CIL Developers in date order:
Edoardo Pasca (2017 – present) - 1
Expand All @@ -55,6 +56,7 @@ Sam Tygier (2022) - 1
Andrew Sharits (2022) - 8
Kyle Pidgeon (2023) - 1
Letizia Protopapa (2023) - 1
Tommi Heikkilä (2023) - 11

CIL Advisory Board:
Llion Evans - 9
Expand Down
50 changes: 26 additions & 24 deletions Wrappers/Python/cil/optimisation/functions/Function.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@

class Function(object):

""" Abstract class representing a function
r""" Abstract class representing a function
:param L: Lipschitz constant of the gradient of the function F(x), when it is differentiable.
:type L: number, positive, default None
:param domain: The domain of the function.
Lipschitz of the gradient of the function; it is a positive real number, such that |f'(x) - f'(y)| <= L ||x-y||, assuming f: IG --> R
Parameters
----------
L: number, positive, default None
Lipschitz constant of the gradient of the function F(x), when it is differentiable.
Note
-----
The Lipschitz of the gradient of the function is a positive real number, such that :math:`\|f'(x) - f'(y)\| \leq L \|x-y\|`, assuming :math:`f: IG \rightarrow \mathbb{R}`
"""

Expand All @@ -40,17 +44,13 @@ def __init__(self, L = None):
# overrides the type check to allow None as initial value
self._L = L

def __call__(self,x):

r"""Returns the value of the function F at x: :math:`F(x)`
"""
def __call__(self,x):

raise NotImplementedError

def gradient(self, x, out=None):

r"""Returns the value of the gradient of function F at x, if it is differentiable
r"""Returns the value of the gradient of function :math:`F` at :math:`x`, if it is differentiable
.. math:: F'(x)
Expand All @@ -60,14 +60,16 @@ def gradient(self, x, out=None):
def proximal(self, x, tau, out=None):

r"""Returns the proximal operator of function :math:`\tau F` at x
.. math:: \mathrm{prox}_{\tau F}(x) = \underset{z}{\mathrm{argmin}} \frac{1}{2}\|z - x\|^{2} + \tau F(z)
.. math:: \text{prox}_{\tau F}(x) = \underset{z}{\text{argmin}} \frac{1}{2}\|z - x\|^{2} + \tau F(z)
"""
raise NotImplementedError

def convex_conjugate(self, x):
r""" Returns the convex conjugate of function :math:`F` at :math:`x^{*}`,
.. math:: F^{*}(x^{*}) = \underset{x^{*}}{\sup} <x^{*}, x> - F(x)
.. math:: F^{*}(x^{*}) = \underset{x^{*}}{\sup} \langle x^{*}, x \rangle - F(x)
"""
raise NotImplementedError
Expand All @@ -76,11 +78,11 @@ def proximal_conjugate(self, x, tau, out = None):

r"""Returns the proximal operator of the convex conjugate of function :math:`\tau F` at :math:`x^{*}`
.. math:: \mathrm{prox}_{\tau F^{*}}(x^{*}) = \underset{z^{*}}{\mathrm{argmin}} \frac{1}{2}\|z^{*} - x^{*}\|^{2} + \tau F^{*}(z^{*})
.. math:: \text{prox}_{\tau F^{*}}(x^{*}) = \underset{z^{*}}{\text{argmin}} \frac{1}{2}\|z^{*} - x^{*}\|^{2} + \tau F^{*}(z^{*})
Due to Moreau’s identity, we have an analytic formula to compute the proximal operator of the convex conjugate :math:`F^{*}`
.. math:: \mathrm{prox}_{\tau F^{*}}(x) = x - \tau\mathrm{prox}_{\tau^{-1} F}(\tau^{-1}x)
.. math:: \text{prox}_{\tau F^{*}}(x) = x - \tau\text{prox}_{\tau^{-1} F}(\tau^{-1}x)
"""
try:
Expand Down Expand Up @@ -159,9 +161,9 @@ def centered_at(self, center):

@property
def L(self):
'''Lipschitz of the gradient of function f.
r'''Lipschitz of the gradient of function f.
L is positive real number, such that |f'(x) - f'(y)| <= L ||x-y||, assuming f: IG --> R'''
L is positive real number, such that :math:`\|f'(x) - f'(y)\| \leq L\|x-y\|`, assuming :math:`f: IG \rightarrow \mathbb{R}`'''
return self._L
# return self._L
@L.setter
Expand Down Expand Up @@ -334,7 +336,7 @@ class ScaledFunction(Function):
1. :math:`G(x) = \alpha F(x)` ( __call__ method )
2. :math:`G'(x) = \alpha F'(x)` ( gradient method )
3. :math:`G^{*}(x^{*}) = \alpha F^{*}(\frac{x^{*}}{\alpha})` ( convex_conjugate method )
4. :math:`\mathrm{prox}_{\tau G}(x) = \mathrm{prox}_{(\tau\alpha) F}(x)` ( proximal method )
4. :math:`\text{prox}_{\tau G}(x) = \text{prox}_{(\tau\alpha) F}(x)` ( proximal method )
"""
def __init__(self, function, scalar):
Expand Down Expand Up @@ -412,7 +414,7 @@ def proximal(self, x, tau, out=None):

r"""Returns the proximal operator of the scaled function.
.. math:: \mathrm{prox}_{\tau G}(x) = \mathrm{prox}_{(\tau\alpha) F}(x)
.. math:: \text{prox}_{\tau G}(x) = \text{prox}_{(\tau\alpha) F}(x)
"""

Expand Down Expand Up @@ -480,7 +482,7 @@ def proximal(self, x, tau, out=None):

""" Returns the proximal operator of :math:`F+scalar`
.. math:: \mathrm{prox}_{\tau (F+scalar)}(x) = \mathrm{prox}_{\tau F}
.. math:: \text{prox}_{\tau (F+scalar)}(x) = \text{prox}_{\tau F}
"""
return self.function.proximal(x, tau, out=out)
Expand Down Expand Up @@ -551,7 +553,7 @@ def proximal(self, x, tau, out=None):

"""Returns the proximal operator of the constant function, which is the same element, i.e.,
.. math:: \mathrm{prox}_{\tau F}(x) = x
.. math:: \text{prox}_{\tau F}(x) = x
"""
if out is None:
Expand Down Expand Up @@ -598,7 +600,7 @@ class TranslateFunction(Function):
1. :math:`G(x) = F(x - b)` ( __call__ method )
2. :math:`G'(x) = F'(x - b)` ( gradient method )
3. :math:`G^{*}(x^{*}) = F^{*}(x^{*}) + <x^{*}, b >` ( convex_conjugate method )
4. :math:`\mathrm{prox}_{\tau G}(x) = \mathrm{prox}_{\tau F}(x - b) + b` ( proximal method )
4. :math:`\text{prox}_{\tau G}(x) = \text{prox}_{\tau F}(x - b) + b` ( proximal method )
"""

Expand Down Expand Up @@ -662,7 +664,7 @@ def proximal(self, x, tau, out = None):

r"""Returns the proximal operator of the translated function.
.. math:: \mathrm{prox}_{\tau G}(x) = \mathrm{prox}_{\tau F}(x-b) + b
.. math:: \text{prox}_{\tau G}(x) = \text{prox}_{\tau F}(x-b) + b
"""
try:
Expand Down
Loading

0 comments on commit 364d66e

Please sign in to comment.