ComplexModulusSquared

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

Bases: odl.operator.operator.Operator

Operator that computes the squared complex modulus (absolute value).

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 squared modulus of a complex vector:

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

On a real space, this is the same as squaring:

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

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

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