DiagonalOperator

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

Bases: 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.

__init__(*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)))