You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/array_api_stubs/_draft/sorting_functions.py
+23-19Lines changed: 23 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -10,24 +10,26 @@ def argsort(
10
10
"""
11
11
Returns the indices that sort an array ``x`` along a specified axis.
12
12
13
-
.. note::
14
-
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
15
-
16
13
Parameters
17
14
----------
18
-
x: array
19
-
input array. Should have a real-valued data type.
15
+
x: array
16
+
input array. **Should** have a real-valued data type.
20
17
axis: int
21
-
axis along which to sort. If set to ``-1``, the function must sort along the last axis. Default: ``-1``.
18
+
axis along which to sort. A valid axis **must** be an integer on the interval ``[-N, N)``, where ``N`` is the number of axes in ``x``. If an axis is specified as a negative integer, the function **must** determine the axis along which to perform the operation by counting backward from the last axis (where ``-1`` refers to the last axis). If provided an invalid axis, the function **must** raise an exception. Default: ``-1``.
22
19
descending: bool
23
-
sort order. If ``True``, the returned indices sort ``x`` in descending order (by value). If ``False``, the returned indices sort ``x`` in ascending order (by value). Default: ``False``.
20
+
sort order. If ``True``, the returned indices **must** sort ``x`` in descending order (by value). If ``False``, the returned indices **must** sort ``x`` in ascending order (by value). Default: ``False``.
24
21
stable: bool
25
-
sort stability. If ``True``, the returned indices must maintain the relative order of ``x`` values which compare as equal. If ``False``, the returned indices may or may not maintain the relative order of ``x`` values which compare as equal (i.e., the relative order of ``x`` values which compare as equal is implementation-dependent). Default: ``True``.
22
+
sort stability. If ``True``, the returned indices **must** maintain the relative order of ``x`` values which compare as equal. If ``False``, the returned indices **may** maintain the relative order of ``x`` values which compare as equal (i.e., the relative order of ``x`` values which compare as equal is implementation-dependent). Default: ``True``.
26
23
27
24
Returns
28
25
-------
29
-
out : array
30
-
an array of indices. The returned array must have the same shape as ``x``. The returned array must have the default array index data type.
26
+
out: array
27
+
an array of indices. The returned array **must** have the same shape as ``x``. The returned array **must** have the default array index data type.
28
+
29
+
Notes
30
+
-----
31
+
32
+
- For backward compatibility, conforming implementations **may** support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
31
33
"""
32
34
33
35
@@ -37,22 +39,24 @@ def sort(
37
39
"""
38
40
Returns a sorted copy of an input array ``x``.
39
41
40
-
.. note::
41
-
For backward compatibility, conforming implementations may support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
42
-
43
42
Parameters
44
43
----------
45
44
x: array
46
-
input array. Should have a real-valued data type.
45
+
input array. **Should** have a real-valued data type.
47
46
axis: int
48
-
axis along which to sort. If set to ``-1``, the function must sort along the last axis. Default: ``-1``.
47
+
axis along which to sort. A valid axis **must** be an integer on the interval ``[-N, N)``, where ``N`` is the number of axes in ``x``. If an axis is specified as a negative integer, the function **must** determine the axis along which to perform the operation by counting backward from the last axis (where ``-1`` refers to the last axis). If provided an invalid axis, the function **must** raise an exception. Default: ``-1``.
49
48
descending: bool
50
-
sort order. If ``True``, the array must be sorted in descending order (by value). If ``False``, the array must be sorted in ascending order (by value). Default: ``False``.
49
+
sort order. If ``True``, the array **must** be sorted in descending order (by value). If ``False``, the array **must** be sorted in ascending order (by value). Default: ``False``.
51
50
stable: bool
52
-
sort stability. If ``True``, the returned array must maintain the relative order of ``x`` values which compare as equal. If ``False``, the returned array may or may not maintain the relative order of ``x`` values which compare as equal (i.e., the relative order of ``x`` values which compare as equal is implementation-dependent). Default: ``True``.
51
+
sort stability. If ``True``, the returned array **must** maintain the relative order of ``x`` values which compare as equal. If ``False``, the returned array **may** maintain the relative order of ``x`` values which compare as equal (i.e., the relative order of ``x`` values which compare as equal is implementation-dependent). Default: ``True``.
53
52
54
53
Returns
55
54
-------
56
-
out : array
57
-
a sorted array. The returned array must have the same data type and shape as ``x``.
55
+
out: array
56
+
a sorted array. The returned array **must** have the same data type and shape as ``x``.
57
+
58
+
Notes
59
+
-----
60
+
61
+
- For backward compatibility, conforming implementations **may** support complex numbers; however, inequality comparison of complex numbers is unspecified and thus implementation-dependent (see :ref:`complex-number-ordering`).
0 commit comments