ConstantOperator

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

Bases: Operator

Operator that always returns the same value.

Implements:

ConstantOperator(y)(x) == y
__init__(constant, domain=None, range=None)[source]

Initialize a new instance.

Parameters

constantLinearSpaceElement or range element-like

The constant space element to be returned. If range is not provided, constant must be a LinearSpaceElement since the operator range is then inferred from it.

domainLinearSpace, optional

Domain of the operator. Default: vector.space

rangeLinearSpace, optional

Range of the operator. Default: vector.space

Examples

>>> r3 = odl.rn(3)
>>> x = r3.element([1, 2, 3])
>>> op = ConstantOperator(x)
>>> op(x, out=r3.element())
rn(3).element([ 1.,  2.,  3.])