Skip to content

Commit

Permalink
TST: fix doctests to use new array printing
Browse files Browse the repository at this point in the history
  • Loading branch information
Holger Kohr committed Aug 17, 2017
1 parent 8607432 commit 28df22f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions odl/operator/default_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1299,32 +1299,32 @@ def __init__(self, space):
Parameters
----------
space : `FnBase`
Space which real part should be taken, needs to implement
Space whose real part should be taken, needs to implement
``space.real_space``.
Examples
--------
Take the real part of complex vector:
Take the real part of a complex vector:
>>> c2 = odl.cn(2)
>>> op = odl.ComplexModulus(c2)
>>> op([3 + 4j, 2])
rn(2).element([5.0, 2.0])
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.0, 2.0])
rn(2).element([ 1., 2.])
The operator also works on other `FnBase` spaces such as
`DiscreteLp` spaces:
>>> r2 = odl.uniform_discr(0, 1, 2, dtype=complex)
>>> op = odl.ComplexModulus(r2)
>>> op([3 + 4j, 2])
uniform_discr(0.0, 1.0, 2).element([5.0, 2.0])
uniform_discr(0.0, 1.0, 2).element([ 5., 2.])
"""
real_space = space.real_space
linear = (space == real_space)
Expand All @@ -1345,15 +1345,15 @@ def inverse(self):
>>> r2 = odl.rn(2)
>>> op = ComplexModulus(r2)
>>> op.inverse(op([1, -2]))
rn(2).element([1.0, 2.0])
rn(2).element([ 1., 2.])
If the domain is complex, a pseudo-inverse is taken, assigning equal
positive weights to the real and complex parts:
>>> c2 = odl.cn(2)
>>> op = ComplexModulus(c2)
>>> op.inverse(op([np.sqrt(2), 2 + 2j]))
cn(2).element([(1+1j), (2+2j)])
cn(2).element([ 1.+1.j, 2.+2.j])
"""
if self.is_linear:
return IdentityOperator(self.domain)
Expand Down

0 comments on commit 28df22f

Please sign in to comment.