MultiplyOperator¶
- class odl.operator.default_ops.MultiplyOperator(*args, **kwargs)[source]¶
Bases:
Operator
Operator multiplying by a fixed space or field element.
Implements:
MultiplyOperator(y)(x) == x * y
Here,
y
is aLinearSpaceElement
orField
element andx
is aLinearSpaceElement
. Hence, this operator can be defined either on aLinearSpace
or on aField
. In the first case it is the pointwise multiplication, in the second the scalar 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.multiplicand
Value to multiply by.
range
Set in which the result of an evaluation of this operator lies.
Methods
__call__
(x[, out])Return
self(x[, out, **kwargs])
.derivative
(point)Return the operator derivative at
point
.norm
([estimate])Return the operator norm of this operator.
- __init__(multiplicand, domain=None, range=None)[source]¶
Initialize a new instance.
- Parameters:
- multiplicand
LinearSpaceElement
or scalar Value to multiply by.
- domain
LinearSpace
orField
, optional Set to which the operator can be applied. Default:
multiplicand.space
.- range
LinearSpace
orField
, optional Set to which the operator maps. Default:
multiplicand.space
.
- multiplicand
Examples
>>> r3 = odl.rn(3) >>> x = r3.element([1, 2, 3])
Multiply by vector:
>>> op = MultiplyOperator(x) >>> op(x) rn(3).element([ 1., 4., 9.]) >>> out = r3.element() >>> op(x, out) rn(3).element([ 1., 4., 9.])
Multiply by scalar:
>>> op2 = MultiplyOperator(x, domain=r3.field) >>> op2(3) rn(3).element([ 3., 6., 9.]) >>> out = r3.element() >>> op2(3, out) rn(3).element([ 3., 6., 9.])