ConstantOperator
- class odl.ConstantOperator(*args, **kwargs)
Bases:
OperatorOperator that always returns the same value.
Implements:
ConstantOperator(y)(x) == y
- __init__(constant, domain=None, range=None)[source]
Initialize a new instance.
Parameters
- constant
LinearSpaceElementorrangeelement-like The constant space element to be returned. If
rangeis not provided,constantmust be aLinearSpaceElementsince the operator range is then inferred from it.- domain
LinearSpace, optional Domain of the operator. Default:
vector.space- range
LinearSpace, 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.])
- constant