@@ -66,9 +66,10 @@ def _wrap_sort_argsort(
66
66
raise NotImplementedError (
67
67
"order keyword argument is only supported with its default value."
68
68
)
69
- if kind is not None and kind != "stable" :
70
- raise NotImplementedError (
71
- "kind keyword argument can only be None or 'stable'."
69
+ if kind is not None and stable is not None :
70
+ raise ValueError (
71
+ "`kind` and `stable` parameters can't be provided at the same time."
72
+ " Use only one of them."
72
73
)
73
74
74
75
usm_a = dpnp .get_usm_ndarray (a )
@@ -77,11 +78,11 @@ def _wrap_sort_argsort(
77
78
axis = - 1
78
79
79
80
axis = normalize_axis_index (axis , ndim = usm_a .ndim )
80
- usm_res = _sorting_fn (usm_a , axis = axis , stable = stable )
81
+ usm_res = _sorting_fn (usm_a , axis = axis , stable = stable , kind = kind )
81
82
return dpnp_array ._create_from_usm_ndarray (usm_res )
82
83
83
84
84
- def argsort (a , axis = - 1 , kind = None , order = None , * , stable = True ):
85
+ def argsort (a , axis = - 1 , kind = None , order = None , * , stable = None ):
85
86
"""
86
87
Returns the indices that would sort an array.
87
88
@@ -94,9 +95,9 @@ def argsort(a, axis=-1, kind=None, order=None, *, stable=True):
94
95
axis : {None, int}, optional
95
96
Axis along which to sort. If ``None``, the array is flattened before
96
97
sorting. The default is ``-1``, which sorts along the last axis.
97
- kind : {None, "stable"}, optional
98
+ kind : {None, "stable", "mergesort", "radixsort" }, optional
98
99
Sorting algorithm. Default is ``None``, which is equivalent to
99
- ``"stable"``. Unlike NumPy, no other option is accepted here.
100
+ ``"stable"``.
100
101
stable : {None, bool}, optional
101
102
Sort stability. If ``True``, the returned array will maintain
102
103
the relative order of ``a`` values which compare as equal.
@@ -121,8 +122,9 @@ def argsort(a, axis=-1, kind=None, order=None, *, stable=True):
121
122
Limitations
122
123
-----------
123
124
Parameters `order` is only supported with its default value.
124
- Parameter `kind` can only be ``None`` or ``"stable"`` which are equivalent.
125
125
Otherwise ``NotImplementedError`` exception will be raised.
126
+ Sorting algorithms ``"quicksort"`` and ``"heapsort"`` are not supported.
127
+
126
128
127
129
See Also
128
130
--------
@@ -203,7 +205,7 @@ def partition(x1, kth, axis=-1, kind="introselect", order=None):
203
205
return call_origin (numpy .partition , x1 , kth , axis , kind , order )
204
206
205
207
206
- def sort (a , axis = - 1 , kind = None , order = None , * , stable = True ):
208
+ def sort (a , axis = - 1 , kind = None , order = None , * , stable = None ):
207
209
"""
208
210
Return a sorted copy of an array.
209
211
@@ -216,9 +218,9 @@ def sort(a, axis=-1, kind=None, order=None, *, stable=True):
216
218
axis : {None, int}, optional
217
219
Axis along which to sort. If ``None``, the array is flattened before
218
220
sorting. The default is ``-1``, which sorts along the last axis.
219
- kind : {None, "stable"}, optional
221
+ kind : {None, "stable", "mergesort", "radixsort" }, optional
220
222
Sorting algorithm. Default is ``None``, which is equivalent to
221
- ``"stable"``. Unlike NumPy, no other option is accepted here.
223
+ ``"stable"``.
222
224
stable : {None, bool}, optional
223
225
Sort stability. If ``True``, the returned array will maintain
224
226
the relative order of ``a`` values which compare as equal.
@@ -239,8 +241,8 @@ def sort(a, axis=-1, kind=None, order=None, *, stable=True):
239
241
Limitations
240
242
-----------
241
243
Parameters `order` is only supported with its default value.
242
- Parameter `kind` can only be ``None`` or ``"stable"`` which are equivalent.
243
244
Otherwise ``NotImplementedError`` exception will be raised.
245
+ Sorting algorithms ``"quicksort"`` and ``"heapsort"`` are not supported.
244
246
245
247
See Also
246
248
--------
0 commit comments