Skip to content

Commit

Permalink
SPDHG documentation changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MargaretDuff committed Nov 15, 2023
1 parent 4e7f2b6 commit d861a13
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions Wrappers/Python/cil/optimisation/algorithms/SPDHG.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class SPDHG(Algorithm):
parameter controlling the trade-off between the primal and dual step sizes
sampler: an instance of a `cil.optimisation.utilities.Sampler` class
Method of selecting the next index for the SPDHG update. If None, random sampling and each index will have probability = 1/number of subsets
**kwargs:
prob : list of floats, optional, default=None
List of probabilities. If None each subset will have probability = 1/number of subsets. To be deprecated/
norms : list of floats
Expand All @@ -81,13 +81,11 @@ class SPDHG(Algorithm):
- Case 2: If `sigma` is provided but not `tau` then `tau` is calculated using the formula
.. math::
\tau = 0.99\min_i([p_i / (\sigma_i * \|K_i\|**2) ])
- Case 3: If `tau` is provided but not `sigma` then `sigma` is calculated using the formula
.. math::
\sigma_i=0.99 p_i / (\tau*\|K_i\|**2)
- Case 4: Both `sigma` and `tau` are provided.
Expand All @@ -99,7 +97,6 @@ class SPDHG(Algorithm):
Convergence is guaranteed provided that [2, eq. (12)]:
.. math::
\|\sigma[i]^{1/2} * K[i] * tau^{1/2} \|^2 < p_i for all i
References
Expand Down Expand Up @@ -148,7 +145,7 @@ def tau(self):
return self._tau

def set_step_sizes_from_ratio(self, gamma=1., rho=.99):
""" Sets gamma, the step-size ratio for the SPDHG algorithm. Currently gamma takes a scalar value.
r""" Sets gamma, the step-size ratio for the SPDHG algorithm. Currently gamma takes a scalar value.
Parameters
----------
Expand All @@ -161,7 +158,6 @@ def set_step_sizes_from_ratio(self, gamma=1., rho=.99):
-----
The step sizes `sigma` and `tau` are set using the equations:
.. math::
\sigma_i=\gamma\rho / (\|K_i\|**2)\\
\tau = (\rho/\gamma)\min_i([p_i / (\sigma_i * \|K_i\|**2) ])
Expand Down Expand Up @@ -190,7 +186,7 @@ def set_step_sizes_from_ratio(self, gamma=1., rho=.99):
self._tau *= (rho / gamma)

def set_step_sizes_custom(self, sigma=None, tau=None):
""" Sets sigma step-sizes for the SPDHG algorithm. The step sizes can be either scalar or array-objects.
r""" Sets sigma step-sizes for the SPDHG algorithm. The step sizes can be either scalar or array-objects.
Parameters
----------
Expand All @@ -207,21 +203,18 @@ def set_step_sizes_custom(self, sigma=None, tau=None):
- Case 1: If neither `sigma` or `tau` are provided then `sigma` is set using the formula:
.. math::
\sigma_i=0.99 / (\|K_i\|**2)
and `tau` is set as per case 2
- Case 2: If `sigma` is provided but not `tau` then `tau` is calculated using the formula
.. math::
\tau = 0.99\min_i([p_i / (\sigma_i * \|K_i\|**2) ])
- Case 3: If `tau` is provided but not `sigma` then `sigma` is calculated using the formula
.. math::
\sigma_i=0.99 p_i / (\tau*\|K_i\|**2)
- Case 4: Both `sigma` and `tau` are provided.
Expand Down

0 comments on commit d861a13

Please sign in to comment.