ProductSpaceOperator.__getitem__¶
-
ProductSpaceOperator.
__getitem__
(self, index)[source]¶ Get sub-operator by index.
- Parameters
- indexint or tuple of int
A pair of integers given as (row, col).
- Returns
- suboperator
ReductionOperator
,Operator
or0
If index is an integer, return the row given by the index.
If index is a tuple, it must have two elements. if there is an operator at
(row, col)
, the operator is returned, otherwise0
.
- suboperator
Examples
>>> r3 = odl.rn(3) >>> pspace = odl.ProductSpace(r3, r3) >>> I = odl.IdentityOperator(r3) >>> prod_op = ProductSpaceOperator([[0, I], ... [0, 0]], ... domain=pspace, range=pspace) >>> prod_op[0, 0] 0 >>> prod_op[0, 1] IdentityOperator(rn(3)) >>> prod_op[1, 0] 0 >>> prod_op[1, 1] 0
By accessing single indices, a row is extracted as a
ReductionOperator
:>>> prod_op[0] ReductionOperator(ZeroOperator(rn(3)), IdentityOperator(rn(3)))