Skip to content

Commit 2fa8df9

Browse files
committed
Update docstring of hypot function to use math where applicable
1 parent 4e43f61 commit 2fa8df9

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

dpnp/dpnp_iface_trigonometric.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,22 +1276,20 @@ def cumlogsumexp(
12761276
)
12771277

12781278

1279-
_HYPOT_DOCSTRING = """
1280-
Calculates the hypotenuse for a right triangle with "legs" `x1_i` and `x2_i` of
1281-
input arrays `x1` and `x2`.
1279+
_HYPOT_DOCSTRING = r"""
1280+
Computes the square root of the sum of squares for each element :math:`x1_i` of
1281+
the input array `x1` with the respective element :math:`x2_i` of the input
1282+
array `x2`.
12821283
12831284
For full documentation refer to :obj:`numpy.hypot`.
12841285
12851286
Parameters
12861287
----------
12871288
x1 : {dpnp.ndarray, usm_ndarray, scalar}
12881289
First input array, expected to have a real-valued floating-point data type.
1289-
Both inputs `x1` and `x2` can not be scalars at the same time.
12901290
x2 : {dpnp.ndarray, usm_ndarray, scalar}
1291-
Second input array, also expected to have a real-valued floating-point data type.
1292-
Both inputs `x1` and `x2` can not be scalars at the same time.
1293-
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1294-
(which becomes the shape of the output).
1291+
Second input array, also expected to have a real-valued floating-point data
1292+
type.
12951293
out : {None, dpnp.ndarray, usm_ndarray}, optional
12961294
Output array to populate.
12971295
Array must have the correct shape and the expected data type.
@@ -1305,8 +1303,8 @@ def cumlogsumexp(
13051303
Returns
13061304
-------
13071305
out : dpnp.ndarray
1308-
An array containing the element-wise hypotenuse. The data type
1309-
of the returned array is determined by the Type Promotion Rules.
1306+
An array containing the element-wise hypotenuse. The data type of the
1307+
returned array is determined by the Type Promotion Rules.
13101308
13111309
Limitations
13121310
-----------
@@ -1316,7 +1314,17 @@ def cumlogsumexp(
13161314
13171315
See Also
13181316
--------
1319-
:obj:`dpnp.reduce_hypot` : The square root of the sum of squares of elements in the input array.
1317+
:obj:`dpnp.reduce_hypot` : The square root of the sum of squares of elements
1318+
in the input array.
1319+
1320+
Notes
1321+
-----
1322+
At least one of `x1` or `x2` must be an array.
1323+
1324+
If ``x1.shape != x2.shape``, they must be broadcastable to a common shape
1325+
(which becomes the shape of the output).
1326+
1327+
This function is equivalent to :math:`\sqrt{x1^2 + x2^2}`, element-wise.
13201328
13211329
Examples
13221330
--------

0 commit comments

Comments
 (0)