Operator¶
-
class
odl.operator.operator.
Operator
(*args, **kwargs)[source]¶ Bases:
object
Abstract mathematical operator.
An operator is a mapping
between sets (domain) and (range). The evaluation of at an element is denoted by and produces an element in :
Programmatically, these properties are reflected in the
Operator
class described in the following.Abstract attributes and methods
Operator
is an abstract class, i.e. it can only be subclassed, not used directly.Any subclass of
Operator
must have the following attributes:It is highly recommended to call
super(MyOp, self).__init__(domain, range)
in the__init__()
method of any subclassMyOp
, wheredomain
andrange
are the arguments specifying domain and range of the new operator. In that case, the attributesOperator.domain
andOperator.range
are automatically provided by the parent classOperator
.In addition, any subclass must implement the private method
Operator._call()
. It signature determines how it is interpreted:In-place-only evaluation:
_call(self, x, out[, **kwargs])
In-place evaluation means that the operator is applied, and the result is written to an existing element
out
provided, i.e._call(self, x, out) <==> out <-- operator(x)
Parameters:
- x
Operator.domain
element An object in the operator domain to which the operator is applied
- out
Operator.range
element An object in the operator range to which the result of the operator evaluation is written.
Returns:
None (return value is ignored)
Out-of-place-only evaluation:
_call(self, x[, **kwargs])
Out-of-place evaluation means that the operator is applied, and the result is written to a new element which is returned. In this case, a subclass has to implement the method
_call(self, x) <==> operator(x)
Parameters:
- x
Operator.domain
element An object in the operator domain to which the operator is applied
Returns:
- out
Operator.range
element-like
An object in the operator range holding the result of the operator evaluation
Dual-use evaluation:
_call(self, x, out=None[, **kwargs])
Evaluate in-place if
out
is given, otherwise out-of-place.Parameters:
- x
Operator.domain
element An object in the operator domain to which the operator is applied
- out
Operator.range
element, optional An object in the operator range to which the result of the operator evaluation is written
Returns:
None (return value is ignored)
Notes
If
Operator._call
is implemented in-place-only or out-of-place-only and theOperator.range
is aLinearSpace
, a default implementation of the respective other is provided.Operator._call
is allowed to have keyword-only arguments (Python 3 only).The term “element-like” means that an object must be convertible to an element by the
domain.element()
method.
- Attributes
adjoint
Adjoint of this operator (abstract).
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.range
Set in which the result of an evaluation of this operator lies.
Methods
_call
(self, x[, out])Implementation of the operator evaluation.
derivative
(self, point)Return the operator derivative at
point
.norm
(self[, estimate])Return the operator norm of this operator.
-
__init__
(self, domain, range, linear=False)[source]¶ Initialize a new instance.
- Parameters
- domain
Set
The domain of this operator, i.e., the set of elements to which this operator can be applied
- range
Set
The range of this operator, i.e., the set this operator maps to
- linearbool, optional
If
True
, the operator is considered as linear. In this case,domain
andrange
have to be instances ofLinearSpace
, orField
.
- domain
- x