ProductSpaceOperator¶
-
class
odl.operator.pspace_ops.
ProductSpaceOperator
(*args, **kwargs)[source]¶ Bases:
odl.operator.operator.Operator
A “matrix of operators” on product spaces.
For example a matrix of operators can act on a vector by
ProductSpaceOperator([[A, B], [C, D]])([x, y]) = [A(x) + B(y), C(x) + D(y)]
See also
BroadcastOperator
Case when a single argument is used by several ops.
ReductionOperator
Calculates sum of operator results.
DiagonalOperator
Case where the ‘matrix’ is diagonal.
Notes
This is intended for the case where an operator can be decomposed as a linear combination of “sub-operators”, e.g.
Mathematically, a
ProductSpaceOperator
is an operatorbetween product spaces and which can be written in the form
with component operators .
Its action on a vector is defined as the matrix multiplication
- Attributes
adjoint
Adjoint of this operator.
domain
Set of objects on which this operator can be evaluated.
inverse
Return the operator inverse.
is_functional
True
if this operator’s range is aField
.is_linear
True
if this operator is linear.ops
The sparse operator matrix representing this operator.
range
Set in which the result of an evaluation of this operator lies.
shape
Shape of the matrix of operators.
size
Total size of the matrix of operators.
Methods
_call
(self, x[, out])Call the operators on the parts of
x
.derivative
(self, x)Derivative of the product space operator.
norm
(self[, estimate])Return the operator norm of this operator.
-
__init__
(self, operators, domain=None, range=None)[source]¶ Initialize a new instance.
- Parameters
- operators
array-like
An array of
Operator
’s, must be 2-dimensional.- domain
ProductSpace
, optional Domain of the operator. If not provided, it is tried to be inferred from the operators. This requires each column to contain at least one operator.
- range
ProductSpace
, optional Range of the operator. If not provided, it is tried to be inferred from the operators. This requires each row to contain at least one operator.
- operators
Examples
>>> r3 = odl.rn(3) >>> pspace = odl.ProductSpace(r3, r3) >>> I = odl.IdentityOperator(r3) >>> x = pspace.element([[1, 2, 3], ... [4, 5, 6]])
Create an operator that sums two inputs:
>>> prod_op = odl.ProductSpaceOperator([[I, I]]) >>> prod_op(x) ProductSpace(rn(3), 1).element([ [ 5., 7., 9.] ])
Diagonal operator – 0 or
None
means ignore, or the implicit zero operator:>>> prod_op = odl.ProductSpaceOperator([[I, 0], ... [0, I]]) >>> prod_op(x) ProductSpace(rn(3), 2).element([ [ 1., 2., 3.], [ 4., 5., 6.] ])
If a column is empty, the operator domain must be specified. The same holds for an empty row and the range of the operator:
>>> prod_op = odl.ProductSpaceOperator([[I, 0], ... [I, 0]], domain=r3 ** 2) >>> prod_op(x) ProductSpace(rn(3), 2).element([ [ 1., 2., 3.], [ 1., 2., 3.] ]) >>> prod_op = odl.ProductSpaceOperator([[I, I], ... [0, 0]], range=r3 ** 2) >>> prod_op(x) ProductSpace(rn(3), 2).element([ [ 5., 7., 9.], [ 0., 0., 0.] ])