Abstract Classes
This section describes the abstract classes of the GlobalBioIm library. It provides general properties for every derived classes.
Map
- class Abstract.Map
Bases:
matlab.mixin.CopyableAbstract class for Maps which maps elements from \(\mathrm{X}\) to \(\mathrm{Y}\) $$ \mathrm{H}: \mathrm{X}\rightarrow \mathrm{Y}.$$ where \(\mathrm{X}\) and \(\mathrm{Y}\) are either \(\mathbb{R}^N\) or \(\mathbb{C}^N\).
- Parameters:
name – name of the linear operator \(\mathbf{H}\)
sizein – dimension of the left hand side vector space \(\mathrm{X}\)
sizeout – dimension of the right hand side vector space \(\mathrm{Y}\)
norm – norm of the operator \(\|\mathrm{H}\|\) (if known, otherwise -1)
isInvertible – true if the method
applyInverse_()is implementedisDifferentiable – true if the method
applyJacobianT_()is implementedmemoizeOpts – structure of boolean (one field per method, see details below).
doPrecomputation – boolean true to allow doing precomputations to save time (will generally require more memory).
Note on the memoize option This option allows to store the result of a method such that if an identical call to this method is done, calculations are avoided. Example: memoizeOpts.apply=true will store the result of H*x.
- Method Summary
- apply(this, x)
Computes \(\mathrm{y}=\mathrm{H}(\mathrm{x})\) for the given \(\mathrm{x} \in \mathrm{X}\).
Calls the method
apply_()
- applyJacobianT(this, x, v)
Compute \(\mathrm{x}=[\mathrm{J}_{\mathrm{H}}(\mathrm{v})]^{\star}\mathrm{y}\) where
\([\mathrm{J}_{\mathrm{H}}(\mathrm{v})]\) is the Jacobian matrix of the Map \(\mathrm{H}\) computed at \(\mathrm{v} \in \mathrm{X} \)
\(\mathrm{y} \in \mathrm{Y} \)
Calls the method
applyJacobianT_()
- applyInverse(this, x)
Computes \(\mathrm{x} = \mathrm{H}^{-1} \mathrm{y}\) for the given \(\mathrm{y} \in \mathrm{Y}\). (if applicable)
Calls the method
applyInverse_()
- makeComposition(this, G)
Compose the Map \(\mathrm{H}\) with the given Map \(\mathrm{G}\). Returns a new map \(\mathrm{M=HG}\)
Calls the method
makeComposition_()
- plus(this, G)
Overload operator (+) for
Mapobjects $$ \mathrm{M}(\mathrm{x}) := \mathrm{H}(\mathrm{x}) + \mathrm{G}(\mathrm{x})$$Calls the method
plus_()
- minus(this, G)
Overload operator (-) for
Mapobjects $$ \mathrm{M}(\mathrm{x}) := \mathrm{H}(\mathrm{x}) - \mathrm{G}(\mathrm{x})$$Calls the method
minus_()
- mpower(this, p)
Returns a new
Mapwhich is the power p \(\mathrm{H}^{p}\) of the current \(\mathrm{H}\).Calls the method
mpower_()
- mtimes(this, G)
Overload operator (*) for
Mapobjects $$ \mathrm{M}(\mathrm{x}) := \mathrm{H}(\mathrm{G}(\mathrm{x}))$$
- times(this, G)
Returns a new
Mapwhich is the element-wise multiplication of the current \(\mathrm{H}\) with \(\mathrm{G}\) $$ \mathrm{M}(\mathrm{x}) := \mathrm{H}(\mathrm{x}) \times \mathrm{G}(\mathrm{x})$$Calls the method
times_()
- apply_(this, x)
Not implemented in this Abstract class
- applyJacobianT_(this, y, v)
Not implemented in this Abstract class
- applyInverse_(this, y)
Not implemented in this Abstract class
- plus_(this, G)
Constructs a
MapSummationobject to sum the currentMap\(\mathrm{H}\) with the given \(\mathrm{G}\).
- minus_(this, G)
Constructs a
MapSummationobject to subtract to the currentMap\(\mathrm{H}\), the given \(\mathrm{G}\).
- mpower_(this, p)
When \(p=-1\), constructs a
MapInversionobject which is the inverse Map of \(\mathrm{H}\). When \(p\neq-1\), this method is not implemented in this Abstract class
- times_(this, G)
Constructs a
MapMultiplicationobject to element-wise multiply the currentMap\(\mathrm{H}\) with the given \(\mathrm{G}\).
- makeComposition_(this, G)
Constructs a
MapCompositionobject to compose the current Map \(\mathrm{H}\) with the given \(\mathrm{G}\).
- copyElement()
Perform a deep copy of \(\mathrm{H}\)
Called by the function
copy()
LinOp
- class Abstract.LinOp
Bases:
Abstract.MapAbstract class for linear operators $$ \mathrm{H}: \mathrm{X}\rightarrow \mathrm{Y}.$$ where \(\mathrm{X}\) and \(\mathrm{Y}\) are either \(\mathbb{R}^N\) or \(\mathbb{C}^N\).
All attributes of parent class
Mapare inheritedSee also
Map- Method Summary
- applyAdjoint(this, y)
Computes \(\mathrm{y=H}^*\mathrm{y}\) for \(\mathrm{y} \in \mathrm{Y}\)
Calls the method
applyAdjoint_()
- applyHtH(this, x)
Computes \(\mathrm{y=H}^*\mathrm{Hx}\) for \(\mathrm{y} \in \mathrm{Y}\)
Calls the method
applyHHt_()
- applyHHt(this, y)
Computes \(\mathrm{y=HH}^*\mathrm{y}\) for \(\mathrm{y} \in \mathrm{Y}\)
Calls the method
applyHHt_()
- transpose(this)
Returns a new
LinOpwhich is the Adjoint \(\mathrm{H}^{\star}\) of the current \(\mathrm{H}\).
- ctranspose(this)
Do the same as
transpose()
- applyAdjointInverse(this, x)
Computes \(\mathrm{y} = \mathrm{H}^{-\star} \mathrm{x}\) for the given \(\mathrm{x} \in \mathrm{X}\). (if applicable)
Calls the method
applyAdjointInverse_()
- makeHtH(this)
Compose the Adjoint Map \(\mathrm{H}^{\star}\) with \(\mathrm{H}\). Returns a new map \(\mathrm{M=H}^{\star} \mathrm{H}\)
Calls the method
makeHtH_()
- makeHHt(this)
Compose the Map \(\mathrm{H}\) with its adjoint \(\mathrm{H}^{\star}\). Returns a new map \(\mathrm{M=H}\mathrm{H}^{\star}\)
Calls the method
makeHHt_()
- applyAdjoint_(~, ~)
Not implemented in this Abstract class
- applyHtH_(this, x)
There is a default implementation in the abstract class
LinOpwhich calls successively theapply()andapplyAdjoint()methods. However, it can be reimplemented in derived classes if there exists a faster way to perform computation.
- applyHHt_(this, y)
There is a default implementation in the abstract class
LinOpwhich calls successively theapplyAdjoint()andapply()methods. However, it can be reimplemented in derived classes if there exists a faster way to perform computation.
- applyAdjointInverse_(~, ~)
Not implemented in this Abstract class
- plus_(this, G)
If \(\mathrm{G}\) is a
LinOp, constructs aLinOpSummationobject to sum the currentLinOp\(\mathrm{H}\) with the given \(\mathrm{G}\). Otherwise the summation will be aMapSummation.
- makeHtH_(this)
Constructs a
LinOpCompositioncorresponding to \(\mathrm{H}^{\star}\mathrm{H}\)
- makeHHt_(this)
Constructs a
LinOpCompositioncorresponding to \(\mathrm{H}\mathrm{H}^{\star}\)
- makeInversion_(this)
Constructs a
LinOpInversioncorresponding to \(\mathrm{H}^{-1}\)
- makeComposition_(this, G)
Reimplemented from parent class
Map. If \(\mathrm{G}\) is aLinOp, constructs aLinOpCompositionobject to compose the current LinOp (this) with the givenLinOp\(\mathrm{G}\). Otherwise the composition will be aMapComposition.
- applyJacobianT_(this, y, ~)
Uses the method applyAdjoint (hence do not need to be reimplemented in derived classes)
Cost
- class Abstract.Cost
Bases:
Abstract.MapAbstract class for Cost functions $$ C : \mathrm{X} \longrightarrow \mathbb{R}$$ with the following special structure $$ C(\mathrm{x}) := F( \mathrm{x} , \mathrm{y} ) $$ where \(F\) is a function takin two variables, both in \(\mathrm{X}\).
- Parameters:
y – data vector (default 0)
name – name of the cost function
lip – Lipschitz constant of the gradient (when applicable and known, otherwise -1)
isConvex – true if the cost is convex
isSeparable – true if the cost is separable (R^n basis)
All attributes of parent class
Mapare inherited andnormis fixed to -1,sizeoutis fixed to for allCost- Method Summary
- applyGrad(this, x)
Computes the gradient of the cost function at \(\mathrm{x} \in \mathrm{X}\) (when applicable) $$ \mathrm{g} = \nabla C(\mathrm{x}) $$
Calls the method
applyGrad_()
- applyProx(this, z, alpha)
Computes the proximity operator of the cost at \(\mathrm{z} \in \mathrm{X} \) (when applicable) $$ \mathrm{prox}_{\alpha C}(\mathrm{z}) = \mathrm{arg} \, \mathrm{min}_{\mathrm{u} \in \mathrm{X}} \; \frac{1}{2\alpha} \| \mathrm{u} - \mathrm{z} \|_2^2 + C(\mathrm{u}). $$
Calls the method
applyProx_()
- applyProxFench(this, z, alpha)
Computes the proximity operator of the Fenchel Transform \(C^*\) at \(\mathrm{z} \in \mathrm{Y} \) (when applicable)
Calls the method
applyProxFench_()
- applyGrad_(this, x)
Not implemented in this Abstract class
- applyProx_(this, z, alpha)
By default, if the cost \(C\)
isConvex, computes the proximity operator of \(C^*\) at \(\mathrm{z} \in \mathrm{X} \) using the Moreau’s identity which uses theapplyProxFench()method $$\mathrm{prox}_{\alpha C}(\mathrm{z}) = \mathrm{z} - \alpha \,\mathrm{prox}_{\frac{1}{\alpha}C^*}\left(\frac{\mathrm{z}}{\alpha}\right).$$
- applyProxFench_(this, z, alpha)
By default, if the cost \(C\)
isConvex, computes the proximity operator of the Fenchel Transform \(C^*\) at \(\mathrm{z} \in \mathrm{Y} \) using the Moreau’s identity which uses theapplyProx()method $$\mathrm{prox}_{\alpha C^*}(\mathrm{z}) = \mathrm{z} - \alpha \,\mathrm{prox}_{\frac{1}{\alpha}C}\left(\frac{\mathrm{z}}{\alpha}\right).$$
- plus_(this, G)
If \(\mathrm{G}\) is a
Cost, constructs aCostSummationobject to sum the currentCost\(C\) with the given \(G\). Otherwise the summation will be aMapSummation.
- minus_(this, G)
If \(\mathrm{G}\) is a
Cost, constructs aCostSummationobject to subtract to the currentCost\(C\), the given \(G\). Otherwise the summation will be aMapSummation.
- makeComposition_(this, G)
Reimplemented from parent class
Map. Constructs aCostCompositionobject to compose the current Cost (this) with the givenMap\(\mathrm{G}\).
- applyJacobianT_(this, y, v)
Uses the method applyGrad (hence do not need to be reimplemented in derived classes)
- set_y(this, y)
Set the attribute \(\mathrm{y}\)
has to be conformable with the
sizeinof the costcan be a scalar.
Opti
- class Abstract.Opti
Bases:
matlab.mixin.SetGetAbstract class for optimization algorithms to minimize
Costobjects- Parameters:
name – name of the algorithm
cost – minimized
Costmaxiter – maximal number of iterations (default 50)
verbose – bollean (default true) to activate verbose mode
OutOp –
OutputOptiobjectItUpOut – number of iterations between two calls to the update method of the
OutputOptiobjectOutOp(default 0)CvOp –
TestCvgobjecttime – execution time of the algorithm
niter – iteration counter
xopt – optimization variable
See also
OutputOptiCost- Method Summary
- run(this, x0)
Run the algorithm.
- Parameters:
x0 – initial point in \(\in X\), if no argument restarts from the current value
xopt.
note: this method does not return anything, the result being stored in public attribute
xopt.
- initialize(this, x0)
Implements initialization of the algorithm
- Parameters:
x0 – initial point
- doIteration(this)
Implements algorithm iteration
- Returns:
flag with values
OPTI_NEXT_IT (= 0) to go to the next iteration
OPTI_REDO_IT (= 1) to redo the iteration
OPTI_STOP (= 2) to stop algorithm
- updateParams(this)
Updates the parameters of the algorithm at each iteration (default: no update). This method can be overloaded to makes some parameters varying during iterations (e.g. descent step, lagrangian parameters…)
- starting_verb(this)
Generic method to display a starting message in verbose mode.
- ending_verb(this)
Generic method to display a ending message in verbose mode.
OperationsOnMaps
The following classes implement basic operations between Map (LinOp and Cost).
They are not abstract but generally they do not need to be instanciated.
They are mainly used inside the methods of the abstract classes Map, LinOp and
Cost for the operator algebra machinery.
MapComposition
- class Abstract.OperationsOnMaps.MapComposition
Bases:
Abstract.MapMapComposition : Composition of Maps $$ \mathrm{H}(\mathrm{x}) = \mathrm{H}_1 \left( \mathrm{H}_2(\mathrm{x}) \right) $$
- Parameters:
H1 – left hand side
MapH2 – right hand side
Map
Example H=MapComposition(H1,H2)
See also
Map
MapInversion
- class Abstract.OperationsOnMaps.MapInversion
Bases:
Abstract.MapMapInversion : Builds the inverse
Map- Parameters:
M –
Mapobject
Example Minv=MapInversion(M)
See also
Map
MapSummation
- class Abstract.OperationsOnMaps.MapSummation
Bases:
Abstract.MapMapSummation: Sum of Maps $$ \mathrm{H}(\mathrm{x}) = \sum_i \alpha_i \mathrm{H}_i(\mathrm{x}) $$
- Parameters:
Maps – cell of
Mapalpha – array of coefficients
Example H=MapSummation(Maps,alpha)
See also
Map,LinOpSummation
MapMultiplication
- class Abstract.OperationsOnMaps.MapMultiplication
Bases:
Abstract.MapMapMultiplication: Multiplication of Maps $$ \mathrm{H}(\mathrm{x}) = \mathrm{H}_1(\mathrm{x}) \times \mathrm{H}_2(\mathrm{x}) $$
- Parameters:
Map1 –
MapobjectMap2 –
Mapobject
Example H=MapMultiplication(Map1,Map2)
See also
Map
LinOpAdjoint
LinOpComposition
- class Abstract.OperationsOnMaps.LinOpComposition
Bases:
Abstract.OperationsOnMaps.MapComposition,LinOpLinOpComposition : Composition of LinOps $$ \mathrm{H}(\mathrm{x}) = \mathrm{H}_1 \mathrm{H}_2\mathrm{x} $$
Example H=LinOpComposition(H1,H2)
See also
Map,LinOp,MapComposition- Method Summary
-
- makeComposition_(this, G)
Reimplemented from
MapComposition
LinOpInversion
- class Abstract.OperationsOnMaps.LinOpInversion
Bases:
Abstract.OperationsOnMaps.MapInversion,LinOpLinOpInversion : Builds the inverse
LinOp- Parameters:
M –
LinOpobject
Example Minv=LinOpInversion(M)
See also
Map,LinOp,MapInversion- Method Summary
-
- mpower_(this, p)
Reimplemented from
MapInversion
- makeComposition_(this, G)
Reimplemented from
MapInversion
LinOpSummation
- class Abstract.OperationsOnMaps.LinOpSummation
Bases:
Abstract.OperationsOnMaps.MapSummation,LinOpLinOpSummation: Sum of linear operators $$ \mathrm{H}(\mathrm{x}) = \sum_i \alpha_i \mathrm{H}_i(\mathrm{x}) $$
- Parameters:
LinOps – cell of
LinOpalpha – array of coefficients
Example L=LinOpSummation(LinOps,alpha)
See also
Map,LinOp,MapOpSummation
CostComposition
- class Abstract.OperationsOnMaps.CostComposition
Bases:
Abstract.OperationsOnMaps.MapComposition,CostCostComposition: Compose a
Costwith aMap$$ C(\mathrm{x}) := F( \mathrm{Hx}) $$ where \(F\) is aCostand \(\mathrm{H}\) aMapExample C = CostComposition(H1,H2)
See also
Map,MapComposition,Cost- Method Summary
-
- applyProx_(this, z, alpha)
Reimplemented from
CostIf this.H2 is a
LinOpand \(\mathrm{H} \mathrm{H}^{\star}\) is aLinOpScaledIdentity
- set_y(this, y)
Set the attribute \(\mathrm{y}\)
has to be conformable with the
sizeoutof theMap\(\mathrm{H}\),can be anything if \(\mathrm{H}\) is not yet set (empty),
can be a scalar.
CostMultiplication
CostSummation
- class Abstract.OperationsOnMaps.CostSummation
Bases:
Abstract.OperationsOnMaps.MapSummation,CostCostSummation : Sum of
Cost$$C(\mathrm{x}) = \sum_i \alpha_i C_i(\mathrm{x}) $$- Parameters:
costs – cell of
Costalpha – array of coefficients
Example F = CostSummation(ACost,alpha)
See also
Map,Cost,MapOpSummation- Method Summary
- makePartialSummation(this, Lsub)
Instanciation of
CostPartialSummation.- Parameters:
Lsub – number of
Costused for computation
- applyProx_(this, z, alpha)
Reimplemented from
Costin the case of the sum between aCostRectangle\(i_C \) and aCost\(f \) which is separable [1] $$ \mathrm{prox}_{\alpha(i_C +f)}(z) = \mathrm{prox}_{i_c} \circ \mathrm{prox}_{\alpha f}(z) $$Reference
[1] “A Douglas?Rachford splitting approach to nonsmooth convex variational signal recovery” P. L. Combettes, and J.C. Pesquet, Journal of Selected Topics in Signal Processing, 1(4), 564-574, 2007
CostPartialSummation
- class Abstract.OperationsOnMaps.CostPartialSummation
Bases:
Abstract.OperationsOnMaps.CostSummationCostPartialSummation : Sum of
Costwith apply, applyGrad,… computed from a subset of Cost $$C(\mathrm{x}) = \sum_i \alpha_i C_i(\mathrm{x}) $$- Parameters:
Example F = CostPartialSummation(ACost,alpha,Lsub)
See also
Map,Cost,MapOpSummation