:mod:`heat.complex_math` ============================= .. py:module:: heat.core.complex_math .. autoapi-nested-parse:: Complex numbers module. Module Contents --------------- .. function:: angle(x: heat.core.dndarray.DNDarray, deg: bool = False, out: Optional[heat.core.dndarray.DNDarray] = None) -> heat.core.dndarray.DNDarray Calculate the element-wise angle of the complex argument. :param x: Input array for which to compute the angle. :type x: DNDarray :param deg: Return the angle in degrees (True) or radiands (False). :type deg: bool, optional :param out: Output array with the angles. :type out: DNDarray, optional .. rubric:: Examples >>> ht.angle(ht.array([1.0, 1.0j, 1 + 1j, -2 + 2j, 3 - 3j])) DNDarray([ 0.0000, 1.5708, 0.7854, 2.3562, -0.7854], dtype=ht.float32, device=cpu:0, split=None) >>> ht.angle(ht.array([1.0, 1.0j, 1 + 1j, -2 + 2j, 3 - 3j]), deg=True) DNDarray([ 0., 90., 45., 135., -45.], dtype=ht.float32, device=cpu:0, split=None) .. function:: conjugate(x: heat.core.dndarray.DNDarray, out: Optional[heat.core.dndarray.DNDarray] = None) -> heat.core.dndarray.DNDarray Compute the complex conjugate, element-wise. :param x: Input array for which to compute the complex conjugate. :type x: DNDarray :param out: Output array with the complex conjugates. :type out: DNDarray, optional .. rubric:: Examples >>> ht.conjugate(ht.array([1.0, 1.0j, 1 + 1j, -2 + 2j, 3 - 3j])) DNDarray([ (1-0j), -1j, (1-1j), (-2-2j), (3+3j)], dtype=ht.complex64, device=cpu:0, split=None) .. function:: imag(x: heat.core.dndarray.DNDarray) -> heat.core.dndarray.DNDarray Return the imaginary part of the complex argument. The returned DNDarray and the input DNDarray share the same underlying storage. :param x: Input array for which the imaginary part is returned. :type x: DNDarray .. rubric:: Examples >>> ht.imag(ht.array([1.0, 1.0j, 1 + 1j, -2 + 2j, 3 - 3j])) DNDarray([ 0., 1., 1., 2., -3.], dtype=ht.float32, device=cpu:0, split=None) .. function:: real(x: heat.core.dndarray.DNDarray) -> heat.core.dndarray.DNDarray Return the real part of the complex argument. The returned DNDarray and the input DNDarray share the same underlying storage. :param x: Input array for which the real part is returned. :type x: DNDarray .. rubric:: Examples >>> ht.real(ht.array([1.0, 1.0j, 1 + 1j, -2 + 2j, 3 - 3j])) DNDarray([ 1., 0., 1., -2., 3.], dtype=ht.float32, device=cpu:0, split=None)