Skip to content

Commit

Permalink
Another documentation iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
MargaretDuff committed Nov 9, 2023
1 parent da6adfd commit 3ec805b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Wrappers/Python/cil/optimisation/functions/Function.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ 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 :math:`\|f'(x) - f'(y)\| \leq L\ |x-y\|`, assuming :math:`f: IG \rightarrow \mathbb{R}`'''
return self._L
Expand Down
12 changes: 6 additions & 6 deletions Wrappers/Python/cil/optimisation/functions/L2NormSquared.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(self, **kwargs):
self.b = kwargs.get('b', None)

def __call__(self, x):
r"""Returns the value of the L2NormSquared function at x, :math:`\sigma_ix_{i}^{2}`.
r"""Returns the value of the L2NormSquared function at :math:`x`,
Following cases are considered:
Expand Down Expand Up @@ -145,15 +145,15 @@ def proximal(self, x, tau, out=None):
class WeightedL2NormSquared(Function):

r""" WeightedL2NormSquared function: :math:`F(x) = \|x\|_{W,2}^2 = \Sigma_iw_ix_i^2 = \langle x, Wx\rangle = x^TWx`
where :math:`W=\text{diag}(weight)` if `weight` is a `DataContainer or :math:`W=\text{weight} I` if `weight` is a scalar.
where :math:`W=\text{diag}(weight)` if `weight` is a `DataContainer` or :math:`W=\text{weight} I` if `weight` is a scalar.
Parameters
-----------
**kwargs
weight: a `scalar` or a `DataContainer` with the same shape as the intended domain of this `WeightedL2NormSquared` function
b: a `DataContainer` with the same shape as the intended domain of this `WeightedL2NormSquared` function
A shift so that the function becomes "function: :math:`F(x) = \| x-b\|_{W,2}^2 = \Sigma_iw_i(x_i-b_i)^2 = \langle x-b, W(x-b) \rangle = (x-b)^TW(x-b)`
A shift so that the function becomes :math:`F(x) = \| x-b\|_{W,2}^2 = \Sigma_iw_i(x_i-b_i)^2 = \langle x-b, W(x-b) \rangle = (x-b)^TW(x-b)`
"""
Expand All @@ -179,8 +179,8 @@ def __init__(self, **kwargs):
super(WeightedL2NormSquared, self).__init__(L=2 * tmp_norm)

def __call__(self, x):
'''Calculates :math:`F(x) = \| x\|_{W,2}^2 = \Sigma_iw_ix_i^2 = \langle x, Wx\rangle = x^TWx` or, if `b` is defined, :math:`F(x) = \| x-b\|_{W,2}^2 = \Sigma_iw_i(x_i-b_i)^2 = \langle x-b, W(x-b)\rangle = (x-b)^TW(x-b)`
where :math:`W=\text{diag}(weight)` if `weight` is a `DataContainer or :math:`\text{weight}I` if `weight` is a scalar.'''
r'''Calculates :math:`F(x) = \| x\|_{W,2}^2 = \Sigma_iw_ix_i^2 = \langle x, Wx \rangle = x^TWx` or, if `b` is defined, :math:`F(x) = \| x-b\|_{W,2}^2 = \Sigma_iw_i(x_i-b_i)^2 = \langle x-b, W(x-b)\rangle = (x-b)^TW(x-b)`
where :math:`W=\text{diag}(weight)` if `weight` is a `DataContainer` or :math:`\text{weight}I` if `weight` is a scalar.'''
self.operator_weight.direct(x, out=self.tmp_space)
y = x.dot(self.tmp_space)

Expand All @@ -191,7 +191,7 @@ def __call__(self, x):

def gradient(self, x, out=None):
r""" Returns the value of :math: `F'(x) = 2Wx` or, if `b` is defined, :math: `F'(x) = 2W(x-b)`
where :math:`W=\text{diag}(weight)` if `weight` is a `DataContainer or :math:`\text{weight}I` if `weight` is a scalar.`.
where :math:`W=\text{diag}(weight)` if `weight` is a `DataContainer` or :math:`\text{weight}I` if `weight` is a scalar.`.
"""

Expand Down
2 changes: 1 addition & 1 deletion Wrappers/Python/cil/optimisation/functions/LeastSquares.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def gradient(self, x, out=None):
.. math:: F'(x) = 2cA^T(W(Ax-b))
where :math:`W=diag(self.weight)`.
where :math:`W=\text{diag}(weight)`.
"""
should_return = True
Expand Down

0 comments on commit 3ec805b

Please sign in to comment.