DiscretizedSpaceElement.real

property DiscretizedSpaceElement.real

Real part of this element.

Returns:
realDiscretizedSpaceElement

Examples

Get the real part:

>>> discr = odl.uniform_discr(0, 1, 3, dtype=complex)
>>> x = discr.element([5+1j, 3, 2-2j])
>>> x.real
uniform_discr(0.0, 1.0, 3).element([ 5.,  3.,  2.])

Set the real part:

>>> x = discr.element([1 + 1j, 2, 3 - 3j])
>>> zero = discr.real_space.zero()
>>> x.real = zero
>>> x.real
uniform_discr(0.0, 1.0, 3).element([ 0.,  0.,  0.])

Other array-like types and broadcasting:

>>> x.real = 1.0
>>> x.real
uniform_discr(0.0, 1.0, 3).element([ 1.,  1.,  1.])
>>> x.real = [2, 3, 4]
>>> x.real
uniform_discr(0.0, 1.0, 3).element([ 2.,  3.,  4.])