Skip to content

Commit 963e22a

Browse files
committed
Update docstring of asin and asinh function to use math where applicable.
Also `arcsin` is now alias on `asin` function. And `arcsinh` is now alias on `asinh` function.
1 parent e4600e1 commit 963e22a

File tree

1 file changed

+56
-52
lines changed

1 file changed

+56
-52
lines changed

dpnp/dpnp_iface_trigonometric.py

Lines changed: 56 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -274,17 +274,17 @@ def _get_accumulation_res_dt(a, dtype):
274274

275275

276276
_ASIN_DOCSTRING = r"""
277-
Computes inverse sine for each element `x_i` for input array `x`.
277+
Computes inverse sine for each element :math:`x_i` for input array `x`.
278278
279-
The inverse of :obj:`dpnp.sin`, so that if ``y = sin(x)`` then ``x = arcsin(y)``.
280-
Note that :obj:`dpnp.asin` is an alias of :obj:`dpnp.arcsin`.
279+
The inverse of :obj:`dpnp.sin`, so that if :math:`y = sin(x)` then
280+
:math:`x = asin(y)`. Note that :obj:`dpnp.arcsin` is an alias of :obj:`dpnp.asin`.
281281
282-
For full documentation refer to :obj:`numpy.arcsin`.
282+
For full documentation refer to :obj:`numpy.asin`.
283283
284284
Parameters
285285
----------
286286
x : {dpnp.ndarray, usm_ndarray}
287-
Input array, expected to have numeric data type.
287+
Input array, expected to have a floating-point data type.
288288
out : {None, dpnp.ndarray, usm_ndarray}, optional
289289
Output array to populate.
290290
Array must have the correct shape and the expected data type.
@@ -298,9 +298,9 @@ def _get_accumulation_res_dt(a, dtype):
298298
Returns
299299
-------
300300
out : dpnp.ndarray
301-
An array containing the element-wise inverse sine, in radians
302-
and in the closed interval `[-\pi/2, \pi/2]`. The data type
303-
of the returned array is determined by the Type Promotion Rules.
301+
An array containing the element-wise inverse sine, in radians and in the
302+
closed interval :math:`[-\pi/2, \pi/2]`. The data type of the returned
303+
array is determined by the Type Promotion Rules.
304304
305305
Limitations
306306
-----------
@@ -312,61 +312,65 @@ def _get_accumulation_res_dt(a, dtype):
312312
--------
313313
:obj:`dpnp.sin` : Trigonometric sine, element-wise.
314314
:obj:`dpnp.cos` : Trigonometric cosine, element-wise.
315-
:obj:`dpnp.arccos` : Trigonometric inverse cosine, element-wise.
315+
:obj:`dpnp.acos` : Trigonometric inverse cosine, element-wise.
316316
:obj:`dpnp.tan` : Trigonometric tangent, element-wise.
317-
:obj:`dpnp.arctan` : Trigonometric inverse tangent, element-wise.
318-
:obj:`dpnp.arctan2` : Element-wise arc tangent of `x1/x2` choosing the quadrant correctly.
319-
:obj:`dpnp.arcsinh` : Hyperbolic inverse sine, element-wise.
317+
:obj:`dpnp.atan` : Trigonometric inverse tangent, element-wise.
318+
:obj:`dpnp.atan2` : Element-wise arc tangent of `x1/x2`
319+
choosing the quadrant correctly.
320+
:obj:`dpnp.asinh` : Hyperbolic inverse sine, element-wise.
320321
321322
Notes
322323
-----
323-
:obj:`dpnp.arcsin` is a multivalued function: for each `x` there are infinitely
324-
many numbers `z` such that ``sin(z) = x``. The convention is to return the
325-
angle `z` whose real part lies in `[-\pi/2, \pi/2]`.
324+
:obj:`dpnp.asin` is a multivalued function: for each `x` there are infinitely
325+
many numbers `z` such that :math:`sin(z) = x`. The convention is to return the
326+
angle `z` whose the real part lies in the interval :math:`[-\pi/2, \pi/2]`.
326327
327-
For real-valued input data types, :obj:`dpnp.arcsin` always returns real output.
328-
For each value that cannot be expressed as a real number or infinity, it yields
329-
``NaN``.
328+
For real-valued floating-point input data types, :obj:`dpnp.asin` always
329+
returns real output. For each value that cannot be expressed as a real number
330+
or infinity, it yields ``NaN``.
330331
331-
For complex-valued input, :obj:`dpnp.arcsin` is a complex analytic function that
332-
has, by convention, the branch cuts `[-\infty, -1]` and `[1, \infty]` and is continuous
333-
from above on the former and from below on the latter.
332+
For complex floating-point input data types, :obj:`dpnp.asin` is a complex
333+
analytic function that has, by convention, the branch cuts
334+
:math:`(-\infty, -1]` and :math:`[1, \infty)` and is continuous from above on
335+
the former and from below on the latter.
334336
335-
The inverse sine is also known as :math:`asin` or :math:`sin^{-1}`.
337+
The inverse sine is also known as :math:`sin^{-1}`.
336338
337339
Examples
338340
--------
339341
>>> import dpnp as np
340342
>>> x = np.array([0, 1, -1])
341-
>>> np.arcsin(x)
343+
>>> np.asin(x)
342344
array([0.0, 1.5707963267948966, -1.5707963267948966])
343345
344346
"""
345347

346-
arcsin = DPNPUnaryFunc(
347-
"arcsin",
348+
asin = DPNPUnaryFunc(
349+
"asin",
348350
ti._asin_result_type,
349351
ti._asin,
350352
_ASIN_DOCSTRING,
351353
mkl_fn_to_call="_mkl_asin_to_call",
352354
mkl_impl_fn="_asin",
353355
)
354356

355-
asin = arcsin # asin is an alias for arcsin
357+
arcsin = asin # arcsin is an alias for asin
356358

357359

358360
_ASINH_DOCSTRING = r"""
359-
Computes inverse hyperbolic sine for each element `x_i` for input array `x`.
361+
Computes inverse hyperbolic sine for each element :math:`x_i` for input array
362+
`x`.
360363
361-
The inverse of :obj:`dpnp.sinh`, so that if ``y = sinh(x)`` then ``x = arcsinh(y)``.
362-
Note that :obj:`dpnp.asinh` is an alias of :obj:`dpnp.arcsinh`.
364+
The inverse of :obj:`dpnp.sinh`, so that if :math:`y = sinh(x)` then
365+
:math:`x = asinh(y)`. Note that :obj:`dpnp.arcsinh` is an alias of
366+
:obj:`dpnp.asinh`.
363367
364-
For full documentation refer to :obj:`numpy.arcsinh`.
368+
For full documentation refer to :obj:`numpy.asinh`.
365369
366370
Parameters
367371
----------
368372
x : {dpnp.ndarray, usm_ndarray}
369-
Input array, expected to have numeric data type.
373+
Input array, expected to have a floating-point data type.
370374
out : {None, dpnp.ndarray, usm_ndarray}, optional
371375
Output array to populate.
372376
Array must have the correct shape and the expected data type.
@@ -380,9 +384,9 @@ def _get_accumulation_res_dt(a, dtype):
380384
Returns
381385
-------
382386
out : dpnp.ndarray
383-
An array containing the element-wise inverse hyperbolic sine.
384-
The data type of the returned array is determined by
385-
the Type Promotion Rules.
387+
An array containing the element-wise inverse hyperbolic sine, in radians.
388+
The data type of the returned array is determined by the Type Promotion
389+
Rules.
386390
387391
Limitations
388392
-----------
@@ -393,46 +397,46 @@ def _get_accumulation_res_dt(a, dtype):
393397
See Also
394398
--------
395399
:obj:`dpnp.sinh` : Hyperbolic sine, element-wise.
396-
:obj:`dpnp.arctanh` : Hyperbolic inverse tangent, element-wise.
397-
:obj:`dpnp.arccosh` : Hyperbolic inverse cosine, element-wise.
398-
:obj:`dpnp.arcsin` : Trigonometric inverse sine, element-wise.
400+
:obj:`dpnp.atanh` : Hyperbolic inverse tangent, element-wise.
401+
:obj:`dpnp.acosh` : Hyperbolic inverse cosine, element-wise.
402+
:obj:`dpnp.asin` : Trigonometric inverse sine, element-wise.
399403
400404
Notes
401405
-----
402-
:obj:`dpnp.arcsinh` is a multivalued function: for each `x` there are infinitely
403-
many numbers `z` such that ``sin(z) = x``. The convention is to return the
404-
angle `z` whose real part lies in `[-\pi/2, \pi/2]`.
405-
406-
For real-valued input data types, :obj:`dpnp.arcsinh` always returns real output.
407-
For each value that cannot be expressed as a real number or infinity, it yields
408-
``NaN``.
406+
:obj:`dpnp.asinh` is a multivalued function: for each `x` there are infinitely
407+
many numbers `z` such that :math:`sin(z) = x`. The convention is to return the
408+
angle `z` whose the imaginary part lies in the interval :math:`[-\pi/2, \pi/2]`.
409409
410-
For complex-valued input, :obj:`dpnp.arcsinh` is a complex analytic function that
411-
has, by convention, the branch cuts `[1j, infj]` and `[`1j, -infj]` and is continuous
412-
from above on the former and from below on the latter.
410+
For real-valued floating-point input data types, :obj:`dpnp.asinh` always
411+
returns real output. For each value that cannot be expressed as a real number
412+
or infinity, it yields ``NaN``.
413413
414-
The inverse hyperbolic sine is also known as :math:`asinh` or :math:`sinh^{-1}`.
414+
For complex floating-point input data types, :obj:`dpnp.asinh` is a complex
415+
analytic function that has, by convention, the branch cuts
416+
:math:`(-\inftyj, -j]` and :math:`[j, \inftyj)` and is continuous from the left
417+
on the former and from the right on the latter.
415418
419+
The inverse hyperbolic sine is also known as :math:`sinh^{-1}`.
416420
417421
Examples
418422
--------
419423
>>> import dpnp as np
420424
>>> x = np.array([np.e, 10.0])
421-
>>> np.arcsinh(x)
425+
>>> np.asinh(x)
422426
array([1.72538256, 2.99822295])
423427
424428
"""
425429

426-
arcsinh = DPNPUnaryFunc(
427-
"arcsinh",
430+
asinh = DPNPUnaryFunc(
431+
"asinh",
428432
ti._asinh_result_type,
429433
ti._asinh,
430434
_ASINH_DOCSTRING,
431435
mkl_fn_to_call="_mkl_asinh_to_call",
432436
mkl_impl_fn="_asinh",
433437
)
434438

435-
asinh = arcsinh # asinh is an alias for arcsinh
439+
arcsinh = asinh # arcsinh is an alias for asinh
436440

437441

438442
_ATAN_DOCSTRING = r"""

0 commit comments

Comments
 (0)