dpnp.angle
- dpnp.angle(x, deg=False, out=None, order='K')
Computes the phase angle (also called the argument) of each element \(x_i\) for input array x.
For full documentation refer to
numpy.angle
.- Parameters:
x ({dpnp.ndarray, usm_ndarray}) -- Input array, expected to have a complex floating-point data type.
deg (bool, optional) --
Return angle in degrees if
True
, radians ifFalse
.Default:
False
.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 ({None, "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 phase angles. The returned array has a floating-point data type determined by the Type Promotion Rules.
- Return type:
dpnp.ndarray
Notes
Although the angle of the complex number
0
is undefined,dpnp.angle(0)
returns the value0
.See also
dpnp.atan2
Element-wise arc tangent of \(\frac{x1}{x2}\) choosing the quadrant correctly.
dpnp.atan
Trigonometric inverse tangent, element-wise.
dpnp.abs
Calculate the absolute value element-wise.
dpnp.real
Return the real part of the complex argument.
dpnp.imag
Return the imaginary part of the complex argument.
dpnp.real_if_close
Return the real part of the input is complex with all imaginary parts close to zero.
Examples
>>> import dpnp as np >>> a = np.array([1.0, 1.0j, 1+1j]) >>> np.angle(a) # in radians array([0. , 1.57079633, 0.78539816]) # may vary
>>> np.angle(a, deg=True) # in degrees array([ 0., 90., 45.])