SeparableSum¶
-
class
odl.solvers.functional.default_functionals.
SeparableSum
(*args, **kwargs)[source]¶ Bases:
odl.solvers.functional.functional.Functional
The functional corresponding to separable sum of functionals.
The separable sum of functionals
f_1, f_2, ..., f_n
is given byh(x_1, x_2, ..., x_n) = sum_i^n f_i(x_i)
The separable sum is thus defined for any collection of functionals with the same range.
Notes
The separable sum of functionals is given by
It has several useful features that also distribute. For example, the gradient is a
DiagonalOperator
:The convex conjugate is also a separable sum:
And the proximal distributes:
If is a list of positive
float
’s, then it distributes, too:- Attributes
adjoint
Adjoint of this operator (abstract).
convex_conj
The convex conjugate functional.
domain
Set of objects on which this operator can be evaluated.
functionals
The summands of the functional.
grad_lipschitz
Lipschitz constant for the gradient of the functional.
gradient
Gradient operator of the functional.
inverse
Return the operator inverse.
is_functional
True
if this operator’s range is aField
.is_linear
True
if this operator is linear.proximal
Return the
proximal factory
of the functional.range
Set in which the result of an evaluation of this operator lies.
Methods
_call
(self, x)Return the separable sum evaluated in
x
.bregman
(self, point, subgrad)Return the Bregman distance functional.
derivative
(self, point)Return the derivative operator in the given point.
norm
(self[, estimate])Return the operator norm of this operator.
translated
(self, shift)Return a translation of the functional.
-
__init__
(self, \*functionals)[source]¶ Initialize a new instance.
- Parameters
- functional1, …, functionalN
Functional
The functionals in the sum. Can also be given as
space, n
withn
integer, in which case the functional is repeatedn
times.
- functional1, …, functionalN
Examples
Create functional
f([x1, x2]) = ||x1||_1 + ||x2||_2
:>>> space = odl.rn(3) >>> l1 = odl.solvers.L1Norm(space) >>> l2 = odl.solvers.L2Norm(space) >>> f_sum = odl.solvers.SeparableSum(l1, l2)
The
proximal
factory allows using vector-valued stepsizes:>>> x = f_sum.domain.one() >>> f_sum.proximal([0.5, 2.0])(x) ProductSpace(rn(3), 2).element([ [ 0.5, 0.5, 0.5], [ 0., 0., 0.] ])
Create functional
f([x1, ... ,xn]) = \sum_i ||xi||_1
:>>> f_sum = odl.solvers.SeparableSum(l1, 5)