ComplexModulus
- class odl.ComplexModulus(*args, **kwargs)
Bases:
OperatorOperator that computes the modulus (absolute value) of a vector.
- __init__(space)[source]
Initialize a new instance.
Parameters
- space
TensorSpace 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 asDiscretizedSpace:>>> 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.])
- space