dpnp.atan2
- dpnp.atan2(x1, x2, out=None, where=True, order='K', dtype=None, subok=True, **kwargs)
Calculates the inverse tangent of the quotient \(\frac{x1_i}{x2_i}\) for each element \(x1_i\) of the input array x1 with the respective element \(x2_i\) of the input array x2.
Note that
dpnp.arctan2is an alias ofdpnp.atan2. This function is not defined for complex-valued arguments; for the so-called argument of complex values, usedpnp.angle.For full documentation refer to
numpy.atan2.- Parameters:
x1 ({dpnp.ndarray, usm_ndarray, scalar}) -- First input array, expected to have a real-valued floating-point data type.
x2 ({dpnp.ndarray, usm_ndarray, scalar}) -- Second input array, also expected to have a real-valued floating-point 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 ({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 inverse tangent of the quotient \(\frac{x1}{x2}\), in radians. The returned array must have a real-valued floating-point data type determined by Type Promotion Rules.
- Return type:
dpnp.ndarray
Limitations
Parameters where and subok are supported with their default values. Keyword argument kwargs is currently unsupported. Otherwise
NotImplementedErrorexception will be raised.See also
dpnp.atanTrigonometric inverse tangent, element-wise.
dpnp.tanCompute tangent element-wise.
dpnp.angleReturn the angle of the complex argument.
dpnp.asinTrigonometric inverse sine, element-wise.
dpnp.acosTrigonometric inverse cosine, element-wise.
dpnp.atanhInverse hyperbolic tangent, element-wise.
Notes
At least one of x1 or x2 must be an array.
If
x1.shape != x2.shape, they must be broadcastable to a common shape (which becomes the shape of the output).Examples
>>> import dpnp as np >>> x1 = np.array([1., -1.]) >>> x2 = np.array([0., 0.]) >>> np.atan2(x1, x2) array([1.57079633, -1.57079633])
>>> x1 = np.array([0., 0., np.inf]) >>> x2 = np.array([+0., -0., np.inf]) >>> np.atan2(x1, x2) array([0.0 , 3.14159265, 0.78539816])
>>> x1 = np.array([-1, +1, +1, -1]) >>> x2 = np.array([-1, -1, +1, +1]) >>> np.atan2(x1, x2) * 180 / np.pi array([-135., -45., 45., 135.])