ReductionOperator

class odl.ReductionOperator(*args, **kwargs)

Bases: Operator

Reduce argument over set of operators.

An argument is reduced by evaluating several operators and summing the result:

ReductionOperator(op1, op2)(x) = op1(x[0]) + op2(x[1])

See Also

ProductSpaceOperator : More general case, used as backend. BroadcastOperator : Calls several operators with same argument. DiagonalOperator : Case where each operator should have its own argument. SeparableSum : Corresponding construction for functionals.

__init__(*operators)[source]

Initialize a new instance.

Parameters

operator1,…,operatorNOperator or int

The individual operators that should be evaluated and summed. Can also be given as operator, n with n integer, in which case operator is repeated n times.

Examples

>>> I = odl.IdentityOperator(odl.rn(3))
>>> op = ReductionOperator(I, 2 * I)
>>> op.domain
ProductSpace(rn(3), 2)
>>> op.range
rn(3)

Evaluating in a point gives the sum of the evaluation results of the individual operators:

>>> op([[1, 2, 3],
...     [4, 6, 8]])
rn(3).element([  9.,  14.,  19.])

An out argument can be given for in-place evaluation:

>>> out = op.range.element()
>>> result = op([[1, 2, 3],
...              [4, 6, 8]], out=out)
>>> out
rn(3).element([  9.,  14.,  19.])
>>> result is out
True

There is a simplified syntax for the case that all operators are the same:

>>> op = ReductionOperator(I, 2)
>>> op.operators
(IdentityOperator(rn(3)), IdentityOperator(rn(3)))