DiagonalOperator

class odl.operator.pspace_ops.DiagonalOperator(*args, **kwargs)[source]

Bases: odl.operator.pspace_ops.ProductSpaceOperator

Diagonal ‘matrix’ of operators.

For example, if A and B are operators, the diagonal operator can be seen as a matrix of operators:

[[A, 0],
 [0, B]]

When evaluated it gives:

DiagonalOperator(op1, op2)(x) = [op1(x[0]), op2(x[1])]

See also

ProductSpaceOperator

Case when the ‘matrix’ is dense.

BroadcastOperator

Case when a single argument is used by several ops.

ReductionOperator

Calculates sum of operator results.

Attributes
adjoint

Adjoint of this operator.

domain

Set of objects on which this operator can be evaluated.

inverse

Inverse of this operator.

is_functional

True if this operator’s range is a Field.

is_linear

True if this operator is linear.

operators

Tuple of sub-operators that comprise self.

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 number of sub-operators.

Methods

_call(self, x[, out])

Call the operators on the parts of x.

derivative(self, point)

Derivative of this operator.

norm(self[, estimate])

Return the operator norm of this operator.

__init__(self, \*operators, \*\*kwargs)[source]

Initialize a new instance.

Parameters
operator1,…,operatorNOperator or int

The individual operators in the diagonal. Can be specified as operator, n with n integer, in which case the diagonal operator with n multiples of operator is created.

kwargs :

Keyword arguments passed to the ProductSpaceOperator backend.

Examples

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

Evaluation is distributed so each argument is given to one operator. The argument order is the same as the order of the operators:

>>> op([[1, 2, 3],
...     [4, 5, 6]])
ProductSpace(rn(3), 2).element([
    [ 1.,  2.,  3.],
    [  8.,  10.,  12.]
])

Can also be created using a multiple of a single operator

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