dpnp.imag
- dpnp.imag(x, out=None, order='K')
Computes imaginary part of each element x_i for input array x.
For full documentation refer to
numpy.imag
.- Parameters:
x ({dpnp.ndarray, usm_ndarray}) -- Input array, expected to have numeric data type.
out ({None, dpnp.ndarray, usm_ndarray}, optional) -- Output array to populate. Array must have the correct shape and the expected data type. Default:
None
.order ({"C", "F", "A", "K"}, optional) -- Memory layout of the newly output array, if parameter out is
None
. Default:"K"
.
- Returns:
out -- An array containing the element-wise imaginary component of input. If the input is a real-valued data type, the returned array has the same data type. If the input is a complex floating-point data type, the returned array has a floating-point data type with the same floating-point precision as complex input.
- Return type:
dpnp.ndarray
See also
dpnp.real
Return the real part of the complex argument.
dpnp.angle
Return the angle of the complex argument.
dpnp.real_if_close
Return the real part of the input is complex with all imaginary parts close to zero.
dpnp.conj
Return the complex conjugate, element-wise.
dpnp.conjugate
Return the complex conjugate, element-wise.
Examples
>>> import dpnp as np >>> a = np.array([1+2j, 3+4j, 5+6j]) >>> a.imag array([2., 4., 6.])
>>> a.imag = np.array([8, 10, 12]) >>> a array([1. +8.j, 3.+10.j, 5.+12.j])
>>> np.imag(np.array(1 + 1j)) array(1.)