dpnp.arctan2

dpnp.arctan2(x1, x2, out=None, where=True, order='K', dtype=None, subok=True, **kwargs)

Calculates the inverse tangent of the quotient 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. Each element-wise result is expressed in radians.

For full documentation refer to numpy.arctan2.

Parameters:
  • x1 ({dpnp.ndarray, usm_ndarray}) – First input array, expected to have a real-valued floating-point data type.

  • x2 ({dpnp.ndarray, usm_ndarray}) – Second input array, also expected to have a real-valued floating-point data type.

  • out ({None, dpnp.ndarray}, optional) – Output array to populate. Array must have the correct shape and the expected data type.

  • 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 inverse tangent of the quotient x1/x2. 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 arguments kwargs are currently unsupported. Otherwise NotImplementedError exception will be raised.

See also

dpnp.arctan

Trigonometric inverse tangent, element-wise.

dpnp.tan

Compute tangent element-wise.

dpnp.angle

Return the angle of the complex argument.

dpnp.arcsin

Trigonometric inverse sine, element-wise.

dpnp.arccos

Trigonometric inverse cosine, element-wise.

dpnp.arctanh

Inverse hyperbolic tangent, element-wise.

Examples

>>> import dpnp as np
>>> x1 = np.array([1., -1.])
>>> x2 = np.array([0., 0.])
>>> np.arctan2(x1, x2)
array([1.57079633, -1.57079633])
>>> x1 = np.array([0., 0., np.inf])
>>> x2 = np.array([+0., -0., np.inf])
>>> np.arctan2(x1, x2)
array([0.0 , 3.14159265, 0.78539816])
>>> x1 = np.array([-1, +1, +1, -1])
>>> x2 = np.array([-1, -1, +1, +1])
>>> np.arctan2(x1, x2) * 180 / np.pi
array([-135.,  -45.,   45.,  135.])