Skip to content

Commit 61be7bd

Browse files
committed
Update docstring of acos function to use math where applicable.
Also `arccos` is now alias on `acos` function. Limitation block is aligned along all trigonometric functions.
1 parent dabfaef commit 61be7bd

File tree

1 file changed

+31
-25
lines changed

1 file changed

+31
-25
lines changed

dpnp/dpnp_iface_trigonometric.py

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,18 @@ def _get_accumulation_res_dt(a, dtype):
109109

110110

111111
_ACOS_DOCSTRING = r"""
112-
Computes inverse cosine for each element `x_i` for input array `x`.
112+
Computes inverse cosine for each element :math:`x_i` for input array `x`.
113113
114-
The inverse of :obj:`dpnp.cos` so that, if ``y = cos(x)``, then ``x = arccos(y)``.
115-
Note that :obj:`dpnp.acos` is an alias of :obj:`dpnp.arccos`.
114+
The inverse of :obj:`dpnp.cos` so that, if :math:`y = cos(x)`, then
115+
:math:`x = acos(y)`. Note that :obj:`dpnp.arccos` is an alias of
116+
:obj:`dpnp.acos`.
116117
117-
For full documentation refer to :obj:`numpy.arccos`.
118+
For full documentation refer to :obj:`numpy.acos`.
118119
119120
Parameters
120121
----------
121122
x : {dpnp.ndarray, usm_ndarray}
122-
Input array, expected to have numeric data type.
123+
Input array, expected to have a floating-point data type.
123124
out : {None, dpnp.ndarray, usm_ndarray}, optional
124125
Output array to populate.
125126
Array must have the correct shape and the expected data type.
@@ -133,9 +134,9 @@ def _get_accumulation_res_dt(a, dtype):
133134
Returns
134135
-------
135136
out : dpnp.ndarray
136-
An array containing the element-wise inverse cosine, in radians
137-
and in the closed interval `[-pi/2, pi/2]`. The data type
138-
of the returned array is determined by the Type Promotion Rules.
137+
An array containing the element-wise inverse cosine, in radians and in the
138+
closed interval :math:`[0, pi]`. The data type of the returned array is
139+
determined by the Type Promotion Rules.
139140
140141
Limitations
141142
-----------
@@ -152,39 +153,40 @@ def _get_accumulation_res_dt(a, dtype):
152153
153154
Notes
154155
-----
155-
:obj:`dpnp.arccos` is a multivalued function: for each `x` there are infinitely
156-
many numbers `z` such that ``cos(z) = x``. The convention is to return the
157-
angle `z` whose real part lies in `[0, pi]`.
156+
:obj:`dpnp.acos` is a multivalued function: for each `x` there are infinitely
157+
many numbers `z` such that :math:`cos(z) = x`. The convention is to return the
158+
angle `z` whose real part lies in :math:`[0, pi]`.
158159
159-
For real-valued input data types, :obj:`dpnp.arccos` always returns real output.
160-
For each value that cannot be expressed as a real number or infinity, it yields
161-
``nan``.
160+
For real-valued floating-point input data types, :obj:`dpnp.acos` always
161+
returns real output. For each value that cannot be expressed as a real number
162+
or infinity, it yields ``NaN``.
162163
163-
For complex-valued input, :obj:`dpnp.arccos` is a complex analytic function that
164-
has, by convention, the branch cuts `[-inf, -1]` and `[1, inf]` and is continuous
165-
from above on the former and from below on the latter.
164+
For complex floating-point input data types, :obj:`dpnp.acos` is a complex
165+
analytic function that has, by convention, the branch cuts :math:`[-inf, -1]`
166+
and :math:`[1, inf]` and is continuous from above on the former and from below
167+
on the latter.
166168
167-
The inverse cos is also known as :math:`acos` or :math:`cos^{-1}`.
169+
The inverse cosine is also known as :math:`arccos` or :math:`cos^{-1}`.
168170
169171
Examples
170172
--------
171173
>>> import dpnp as np
172174
>>> x = np.array([1, -1])
173-
>>> np.arccos(x)
175+
>>> np.acos(x)
174176
array([0.0, 3.14159265])
175177
176178
"""
177179

178-
arccos = DPNPUnaryFunc(
179-
"arccos",
180+
acos = DPNPUnaryFunc(
181+
"acos",
180182
ti._acos_result_type,
181183
ti._acos,
182184
_ACOS_DOCSTRING,
183185
mkl_fn_to_call="_mkl_acos_to_call",
184186
mkl_impl_fn="_acos",
185187
)
186188

187-
acos = arccos # acos is an alias for arccos
189+
arccos = acos # arccos is an alias for acos
188190

189191

190192
_ACOSH_DOCSTRING = r"""
@@ -553,7 +555,7 @@ def _get_accumulation_res_dt(a, dtype):
553555
Limitations
554556
-----------
555557
Parameters `where` and `subok` are supported with their default values.
556-
Keyword arguments `kwargs` are currently unsupported.
558+
Keyword argument `kwargs` is currently unsupported.
557559
Otherwise ``NotImplementedError`` exception will be raised.
558560
559561
See Also
@@ -1335,6 +1337,7 @@ def cumlogsumexp(
13351337
Limitations
13361338
-----------
13371339
Parameters `where` and `subok` are supported with their default values.
1340+
Keyword argument `kwargs` is currently unsupported.
13381341
Otherwise ``NotImplementedError`` exception will be raised.
13391342
13401343
See Also
@@ -1592,7 +1595,7 @@ def cumlogsumexp(
15921595
Limitations
15931596
-----------
15941597
Parameters `where` and `subok` are supported with their default values.
1595-
Keyword arguments `kwargs` are currently unsupported.
1598+
Keyword argument `kwargs` is currently unsupported.
15961599
Otherwise ``NotImplementedError`` exception will be raised.
15971600
15981601
See Also
@@ -1669,7 +1672,7 @@ def cumlogsumexp(
16691672
Limitations
16701673
-----------
16711674
Parameters `where` and `subok` are supported with their default values.
1672-
Keyword arguments `kwargs` are currently unsupported.
1675+
Keyword argument `kwargs` is currently unsupported.
16731676
Otherwise ``NotImplementedError`` exception will be raised.
16741677
16751678
See Also
@@ -2181,6 +2184,7 @@ def reduce_hypot(x, /, *, axis=None, dtype=None, keepdims=False, out=None):
21812184
21822185
Limitations
21832186
-----------
2187+
Parameters `where` and `subok` are supported with their default values.
21842188
Keyword argument `kwargs` is currently unsupported.
21852189
Otherwise ``NotImplementedError`` exception will be raised.
21862190
@@ -2239,6 +2243,7 @@ def reduce_hypot(x, /, *, axis=None, dtype=None, keepdims=False, out=None):
22392243
Limitations
22402244
-----------
22412245
Parameters `where` and `subok` are supported with their default values.
2246+
Keyword argument `kwargs` is currently unsupported.
22422247
Otherwise ``NotImplementedError`` exception will be raised.
22432248
22442249
See Also
@@ -2297,6 +2302,7 @@ def reduce_hypot(x, /, *, axis=None, dtype=None, keepdims=False, out=None):
22972302
Limitations
22982303
-----------
22992304
Parameters `where` and `subok` are supported with their default values.
2305+
Keyword argument `kwargs` is currently unsupported.
23002306
Otherwise ``NotImplementedError`` exception will be raised.
23012307
23022308
See Also

0 commit comments

Comments
 (0)