ReductionOperator¶
- class odl.operator.pspace_ops.ReductionOperator(*args, **kwargs)[source]¶
Bases:
OperatorReduce 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
ProductSpaceOperatorMore general case, used as backend.
BroadcastOperatorCalls several operators with same argument.
DiagonalOperatorCase where each operator should have its own argument.
SeparableSumCorresponding construction for functionals.
- Attributes:
adjointAdjoint of this operator.
domainSet of objects on which this operator can be evaluated.
inverseReturn the operator inverse.
is_functionalTrueif this operator's range is aField.is_linearTrueif this operator is linear.operatorsTuple of sub-operators that comprise
self.prod_opProductSpaceOperatorimplementation.rangeSet in which the result of an evaluation of this operator lies.
sizeTotal number of sub-operators.
Methods
__call__(x[, out])Return
self(x[, out, **kwargs]).derivative(x)Derivative of the reduction operator.
norm([estimate])Return the operator norm of this operator.
- __init__(*operators)[source]¶
Initialize a new instance.
- Parameters:
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
outargument 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)))