DiagonalOperator¶
- class odl.operator.pspace_ops.DiagonalOperator(*args, **kwargs)[source]¶
Bases:
ProductSpaceOperatorDiagonal 'matrix' of operators.
For example, if
AandBare 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
ProductSpaceOperatorCase when the 'matrix' is dense.
BroadcastOperatorCase when a single argument is used by several ops.
ReductionOperatorCalculates sum of operator results.
- Attributes:
adjointAdjoint of this operator.
domainSet of objects on which this operator can be evaluated.
inverseInverse of this operator.
is_functionalTrueif this operator's range is aField.is_linearTrueif this operator is linear.operatorsTuple of sub-operators that comprise
self.opsThe sparse operator matrix representing this operator.
rangeSet in which the result of an evaluation of this operator lies.
shapeShape of the matrix of operators.
sizeTotal number of sub-operators.
Methods
__call__(x[, out])Return
self(x[, out, **kwargs]).derivative(point)Derivative of this operator.
norm([estimate])Return the operator norm of this operator.
- __init__(*operators, **kwargs)[source]¶
Initialize a new instance.
- Parameters:
- operator1,...,operatorN
Operatoror int The individual operators in the diagonal. Can be specified as
operator, nwithninteger, in which case the diagonal operator withnmultiples ofoperatoris created.- kwargs
Keyword arguments passed to the
ProductSpaceOperatorbackend.
- operator1,...,operatorN
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)))