Skip to content

Commit 4e43f61

Browse files
committed
Update docstring of exp, exp2, and expm1 functions to use math where applicable
1 parent 58eb8df commit 4e43f61

File tree

1 file changed

+32
-25
lines changed

1 file changed

+32
-25
lines changed

dpnp/dpnp_iface_trigonometric.py

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,14 +1092,14 @@ def cumlogsumexp(
10921092

10931093

10941094
_EXP_DOCSTRING = """
1095-
Computes the exponent for each element `x_i` of input array `x`.
1095+
Computes the exponential for each element :math:`x_i` of input array `x`.
10961096
10971097
For full documentation refer to :obj:`numpy.exp`.
10981098
10991099
Parameters
11001100
----------
11011101
x : {dpnp.ndarray, usm_ndarray}
1102-
Input array, expected to have numeric data type.
1102+
Input array, expected to have a floating-point data type.
11031103
out : {None, dpnp.ndarray, usm_ndarray}, optional
11041104
Output array to populate.
11051105
Array must have the correct shape and the expected data type.
@@ -1113,9 +1113,9 @@ def cumlogsumexp(
11131113
Returns
11141114
-------
11151115
out : dpnp.ndarray
1116-
An array containing the element-wise exponent of `x`.
1117-
The data type of the returned array is determined by
1118-
the Type Promotion Rules.
1116+
An array containing the element-wise exponential of `x`.
1117+
The data type of the returned array is determined by the Type Promotion
1118+
Rules.
11191119
11201120
Limitations
11211121
-----------
@@ -1125,8 +1125,8 @@ def cumlogsumexp(
11251125
11261126
See Also
11271127
--------
1128-
:obj:`dpnp.expm1` : Calculate ``exp(x) - 1`` for all elements in the array.
1129-
:obj:`dpnp.exp2` : Calculate `2**x` for all elements in the array.
1128+
:obj:`dpnp.expm1` : Calculate :math:`e^x - 1`, element-wise.
1129+
:obj:`dpnp.exp2` : Calculate :math:`2^x`, element-wise.
11301130
11311131
Examples
11321132
--------
@@ -1148,7 +1148,8 @@ def cumlogsumexp(
11481148

11491149

11501150
_EXP2_DOCSTRING = """
1151-
Computes the base-2 exponent for each element `x_i` for input array `x`.
1151+
Computes the base-2 exponential for each element :math:`x_i` for input array
1152+
`x`.
11521153
11531154
For full documentation refer to :obj:`numpy.exp2`.
11541155
@@ -1169,9 +1170,9 @@ def cumlogsumexp(
11691170
Returns
11701171
-------
11711172
out : dpnp.ndarray
1172-
An array containing the element-wise base-2 exponents.
1173-
The data type of the returned array is determined by
1174-
the Type Promotion Rules.
1173+
An array containing the element-wise base-2 exponentials.
1174+
The data type of the returned array is determined by the Type Promotion
1175+
Rules.
11751176
11761177
Limitations
11771178
-----------
@@ -1181,9 +1182,10 @@ def cumlogsumexp(
11811182
11821183
See Also
11831184
--------
1184-
:obj:`dpnp.exp` : Calculate exponent for all elements in the array.
1185-
:obj:`dpnp.expm1` : ``exp(x) - 1``, the inverse of :obj:`dpnp.log1p`.
1186-
:obj:`dpnp.power` : First array elements raised to powers from second array, element-wise.
1185+
:obj:`dpnp.exp` : Calculate :math:`e^x`, element-wise.
1186+
:obj:`dpnp.expm1` : Calculate :math:`e^x - 1`, element-wise.
1187+
:obj:`dpnp.power` : Exponentiation by raising the first array to the power of
1188+
the second array, element-wise.
11871189
11881190
Examples
11891191
--------
@@ -1204,17 +1206,16 @@ def cumlogsumexp(
12041206
)
12051207

12061208

1207-
_EXPM1_DOCSTRING = """
1208-
Computes the exponent minus 1 for each element `x_i` of input array `x`.
1209-
1210-
This function calculates `exp(x) - 1.0` more accurately for small values of `x`.
1209+
_EXPM1_DOCSTRING = r"""
1210+
Computes the exponential minus 1 for each element :math:`x_i` of input array
1211+
`x`.
12111212
12121213
For full documentation refer to :obj:`numpy.expm1`.
12131214
12141215
Parameters
12151216
----------
12161217
x : {dpnp.ndarray, usm_ndarray}
1217-
Input array, expected to have numeric data type.
1218+
Input array, expected to have a floating-point data type.
12181219
out : {None, dpnp.ndarray, usm_ndarray}, optional
12191220
Output array to populate.
12201221
Array must have the correct shape and the expected data type.
@@ -1228,9 +1229,9 @@ def cumlogsumexp(
12281229
Returns
12291230
-------
12301231
out : dpnp.ndarray
1231-
An array containing the element-wise `exp(x) - 1` results.
1232-
The data type of the returned array is determined by the Type
1233-
Promotion Rules.
1232+
An array containing containing the evaluated result for each element in `x`.
1233+
The data type of the returned array is determined by the Type Promotion
1234+
Rules.
12341235
12351236
Limitations
12361237
-----------
@@ -1240,9 +1241,15 @@ def cumlogsumexp(
12401241
12411242
See Also
12421243
--------
1243-
:obj:`dpnp.exp` : Calculate exponents for all elements in the array.
1244-
:obj:`dpnp.exp2` : Calculate `2**x` for all elements in the array.
1245-
:obj:`dpnp.log1p` : Calculate ``log(1 + x)``, the inverse of :obj:`dpnp.expm1`.
1244+
:obj:`dpnp.exp` : Calculate :math:`e^x`, element-wise.
1245+
:obj:`dpnp.exp2` : Calculate :math:`2^x`, element-wise.
1246+
:obj:`dpnp.log1p` : Calculate :math:`\log(1 + x)`, element-wise,
1247+
the inverse of :obj:`dpnp.expm1`.
1248+
1249+
Notes
1250+
-----
1251+
This function provides greater precision than :math:`e^x - 1` for small values
1252+
of `x`.
12461253
12471254
Examples
12481255
--------

0 commit comments

Comments
 (0)