ComplexModulus

class odl.operator.default_ops.ComplexModulus(*args, **kwargs)[source]

Bases: odl.operator.operator.Operator

Operator that computes the modulus (absolute value) of a vector.

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 a Field.

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)

Return self(x).

derivative(self, x)

Return the derivative operator in the “C = R^2” sense.

norm(self[, estimate])

Return the operator norm of this operator.

__init__(self, space)[source]

Initialize a new instance.

Parameters
spaceTensorSpace

Space in which the modulus should be taken, needs to implement space.real_space.

Examples

Take the modulus of a complex vector:

>>> c2 = odl.cn(2)
>>> op = odl.ComplexModulus(c2)
>>> op([3 + 4j, 2])
rn(2).element([ 5.,  2.])

The operator is the absolute value on real spaces:

>>> r2 = odl.rn(2)
>>> op = odl.ComplexModulus(r2)
>>> op([1, -2])
rn(2).element([ 1.,  2.])

The operator also works on other TensorSpace’s such as DiscretizedSpace:

>>> space = odl.uniform_discr(0, 1, 2, dtype=complex)
>>> op = odl.ComplexModulus(space)
>>> op([3 + 4j, 2])
uniform_discr(0.0, 1.0, 2).element([ 5.,  2.])